v1.2.0
This commit is contained in:
parent
693e5ae2e6
commit
7d3fc1969d
52 changed files with 1776 additions and 295 deletions
|
|
@ -1,5 +1,65 @@
|
|||
== Changelog ==
|
||||
|
||||
= 1.2.0 =
|
||||
|
||||
_Release date: 2026-08-07_
|
||||
|
||||
**Highlights**
|
||||
|
||||
* New: synced post title is taken from the first H1 in the Markdown (and stripped from the body)
|
||||
* New: repo-relative links are rewritten to the matching WordPress permalink
|
||||
* New: repository images are sideloaded into the Media Library and referenced by attachment URL
|
||||
* All deferred findings from the 1.1.1 pre-deploy audit resolved
|
||||
* GitHub token encryption hardened with HKDF-SHA256 key derivation (with transparent migration of existing tokens)
|
||||
* CSRF nonce added to the Discover Files "Refresh" action
|
||||
* Minimum WordPress raised to 6.8; verified compatible with WordPress 7.1; PHP minimum declarations made consistent at 8.0 across all files
|
||||
|
||||
**Added**
|
||||
|
||||
* **Title from H1:** the synced post title is now taken from the first `# H1` heading in the Markdown (inline formatting stripped to plain text), with the H1 removed from the body to avoid a duplicate heading. Falls back to the filename-derived title when no H1 is present
|
||||
* **Internal link translation:** repo-relative Markdown links (e.g. `./api.md`, `../README.md`) are rewritten to the permalink of the matching mapped WordPress content. External, `mailto:`, and anchor links are left untouched; links with no matching mapping keep their original URL
|
||||
* **Repository image sideloading:** images referenced in the Markdown are downloaded from the repository, added to the Media Library, and their references replaced with the attachment URL. Already-imported images are reused on subsequent syncs (tracked per post); removed images are kept in the Media Library (non-destructive)
|
||||
|
||||
**Security**
|
||||
|
||||
* Patched CVE-2026-71478 (and advisory GHSA-2q4p-g7hv-5rgv) in league/commonmark — an unsafe-link filter bypass that could defeat `allow_unsafe_links: false`. Updated league/commonmark 2.8.2 → 2.9.0
|
||||
* GitHub token encryption now derives its AES-256 key with HKDF-SHA256 from `wp_salt('auth')` instead of using the salt directly; existing tokens are migrated transparently to the new `v2:` format on first decrypt (covers the cron path too)
|
||||
* Discover Files "Refresh from GitHub" action is now nonce-protected — previously a crafted link could force an unrequested GitHub API call (CSRF)
|
||||
* GitHub API request paths are now `rawurlencode()`d (defensive hardening)
|
||||
* Sideloaded images are validated by extension (jpg, jpeg, png, gif, webp) and size (< 10 MB) before storage; SVG is intentionally excluded
|
||||
|
||||
**Fixed**
|
||||
|
||||
* "Using cached data / fetching fresh data" indicator on Discover Files now reflects reality — it always showed "cached" because the cache was tested after being populated
|
||||
* `target_post_type` is now validated against registered public post types on save, falling back to `page`
|
||||
* Debug action dispatch refactored into a single `switch`, each case retaining its `check_admin_referer()` check, to reduce the chance of a missing nonce check
|
||||
|
||||
**Changed**
|
||||
|
||||
* Inline `onclick` confirm on Delete replaced with a `data-confirm` attribute + delegated handler (CSP-friendlier, less fragile)
|
||||
* Add Mapping "existing content" dropdown now queries only public post types (excludes attachments and the internal mapping CPT) with `no_found_rows` for better performance on large sites
|
||||
|
||||
**Compatibility**
|
||||
|
||||
* WordPress: 6.8 - 7.1
|
||||
* PHP: 8.0 - 8.5
|
||||
* MariaDB: 11.4 or newer
|
||||
|
||||
**Developer**
|
||||
|
||||
* Added `bin/preflight.sh` — automated pre-deploy gate (PHPCS, PHPStan 9, PHPCompatibility, PHPUnit, `composer audit`, candidate-ZIP inspection); PASS/FAIL report per section, never invokes `deploy.sh`
|
||||
* Added `.claude/settings.json` deny rules (`deploy.sh`, `git push/tag/merge`) enforcing the AGENTS.md operating boundaries mechanically
|
||||
* `composer.json` `require-dev` completed and pinned: added `dealerdirect/phpcodesniffer-composer-installer` + `phpcsstandards/phpcsutils`; pinned `squizlabs/php_codesniffer` and `johnbillion/wp-compat`
|
||||
* Patched two high-severity CVEs in dev tooling (not shipped — `deploy.sh` uses `--no-dev`): `squizlabs/php_codesniffer` 3.13.5 → 3.13.6 (CVE-2026-67434), `wp-coding-standards/wpcs` 3.3.0 → 3.4.1 (CVE-2026-45293). `composer audit` fully clean
|
||||
|
||||
**Tests**
|
||||
|
||||
* PHP Coding Standards: PHPCS with WordPress-Core, WordPress-Docs, WordPress-Extra — 0 errors
|
||||
* PHPStan: level 9, 0 errors
|
||||
* PHPCompatibility: PHP 8.0-8.5 validated
|
||||
* PHPUnit: plugin header tests pass
|
||||
* Manual testing: WordPress 7.1
|
||||
|
||||
= 1.1.1 =
|
||||
|
||||
_Release date: 2026-06-08_
|
||||
|
|
|
|||
47
readme.txt
47
readme.txt
|
|
@ -1,10 +1,10 @@
|
|||
=== Documentation Markdown (by ROBOTSTXT) ===
|
||||
Contributors: robotstxt
|
||||
Tags: github, documentation, markdown, sync, automation
|
||||
Requires at least: 6.7
|
||||
Requires at least: 6.8
|
||||
Tested up to: 7.1
|
||||
Requires PHP: 8.0
|
||||
Stable tag: 1.1.1
|
||||
Stable tag: 1.2.0
|
||||
License: GPLv3 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
|
@ -44,8 +44,8 @@ Synchronize Markdown documentation from GitHub repositories to WordPress pages a
|
|||
|
||||
= Requirements =
|
||||
|
||||
* PHP 8.2 or higher
|
||||
* WordPress 6.9 or higher
|
||||
* PHP 8.0 or higher
|
||||
* WordPress 6.8 or higher
|
||||
* GitHub Personal Access Token (free, for accessing repositories)
|
||||
* Composer (for production build with dependencies)
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ Synchronize Markdown documentation from GitHub repositories to WordPress pages a
|
|||
|
||||
* Clean, well-documented code
|
||||
* Follows WordPress Coding Standards (WPCS)
|
||||
* Modern PHP 8.2+ features
|
||||
* Modern PHP 8.0+ features
|
||||
* Extensive PHPDoc documentation
|
||||
* Procedural approach (KISS principles)
|
||||
* Extensible with WordPress hooks and filters
|
||||
|
|
@ -178,13 +178,46 @@ Then go to Documentation → Settings, and you'll see a "Debug Tools" section at
|
|||
|
||||
== Compatibility ==
|
||||
|
||||
* WordPress: 6.7 - 7.1
|
||||
* WordPress: 6.8 - 7.1
|
||||
* PHP: 8.0 - 8.5
|
||||
|
||||
== Changelog ==
|
||||
|
||||
For the complete changelog, see [changelog.txt](https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown/raw/branch/main/changelog.txt).
|
||||
|
||||
= 1.2.0 - 2026-08-07 =
|
||||
|
||||
**Added**
|
||||
|
||||
* **Title from H1:** the synced post title is now taken from the first `# H1` in the Markdown (inline formatting stripped), with the H1 removed from the body to avoid a duplicate heading. Falls back to the filename-derived title when no H1 is present
|
||||
* **Internal link translation:** repo-relative Markdown links (e.g. `./api.md`, `../README.md`) are rewritten to the permalink of the matching mapped WordPress content. External, `mailto:`, and anchor links are left untouched; links with no matching mapping keep their original URL
|
||||
* **Repository image sideloading:** images referenced in the Markdown are downloaded from the repository, added to the Media Library, and their references replaced with the attachment URL. Already-imported images are reused on subsequent syncs (tracked per post); removed images are kept in the Media Library (non-destructive)
|
||||
|
||||
**Security**
|
||||
|
||||
* Patched CVE-2026-71478 (and advisory GHSA-2q4p-g7hv-5rgv) in league/commonmark — an unsafe-link filter bypass that could defeat `allow_unsafe_links: false`. Updated league/commonmark 2.8.2 → 2.9.0
|
||||
* GitHub token encryption now derives its AES-256 key with HKDF-SHA256 from `wp_salt('auth')` instead of using the salt directly; existing tokens are migrated transparently to the new `v2:` format on first decrypt (covers the cron path too)
|
||||
* Discover Files "Refresh from GitHub" action is now nonce-protected — previously a crafted link could force an unrequested GitHub API call (CSRF)
|
||||
* GitHub API request paths are now `rawurlencode()`d (defensive hardening)
|
||||
* Sideloaded images are validated by extension (jpg, jpeg, png, gif, webp) and size (< 10 MB) before storage; SVG is intentionally excluded
|
||||
|
||||
**Fixed**
|
||||
|
||||
* "Using cached data / fetching fresh data" indicator on Discover Files now reflects reality — it always showed "cached" because the cache was tested after being populated
|
||||
* `target_post_type` is now validated against registered public post types on save, falling back to `page` (prevents saving an unregistered or internal type)
|
||||
* Debug action dispatch refactored into a single `switch`, each case retaining its `check_admin_referer()` check, to reduce the chance of a missing nonce check
|
||||
|
||||
**Changed**
|
||||
|
||||
* Inline `onclick` confirm on Delete replaced with a `data-confirm` attribute + delegated handler (CSP-friendlier, less fragile)
|
||||
* Add Mapping "existing content" dropdown now queries only public post types (excludes attachments and the internal mapping CPT) with `no_found_rows` for better performance on large sites
|
||||
|
||||
**Compatibility**
|
||||
|
||||
* Minimum WordPress raised to 6.8 (latest stable + two previous majors)
|
||||
* Verified compatible with WordPress 7.1
|
||||
* Declared PHP minimum made consistent across `readme.txt`, `composer.json`, `phpstan.neon`, and the PHPCompatibility scan range — real minimum remains 8.0
|
||||
|
||||
= 1.1.1 - 2026-06-08 =
|
||||
|
||||
**Security**
|
||||
|
|
@ -274,7 +307,7 @@ For the complete changelog, see [changelog.txt](https://git.robotstxt.es/ROBOTST
|
|||
|
||||
**Developer Features:**
|
||||
* Procedural PHP following KISS principles
|
||||
* PHP 8.2+ modern features
|
||||
* PHP 8.0+ modern features
|
||||
* Complete PHPDoc documentation
|
||||
* WordPress hooks and filters
|
||||
* Extensible architecture
|
||||
|
|
|
|||
422
robotstxt-documentation-markdown-content.php
Normal file
422
robotstxt-documentation-markdown-content.php
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
<?php
|
||||
/**
|
||||
* Synced-content processing: H1 title extraction, internal-link translation,
|
||||
* and repository image sideloading.
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
* @since 1.2.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce inline Markdown formatting in a single line to plain text.
|
||||
*
|
||||
* Used to derive a clean post title from an H1 that may contain links,
|
||||
* emphasis, inline code, or images.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param string $text Inline Markdown text (single line).
|
||||
* @return string Sanitized plain text.
|
||||
*/
|
||||
function robotstxt_docmd_plain_text_from_inline_markdown( string $text ): string {
|
||||
$patterns = array(
|
||||
'/!\[([^\]]*)\]\([^)]*\)/', // Images -> alt text.
|
||||
'/\[([^\]]*)\]\([^)]*\)/', // Links -> label text.
|
||||
'/`([^`]*)`/', // Inline code -> contents.
|
||||
'/(\*\*|__|~~|\*|_)(.+?)\1/', // Bold/italic/strikethrough -> contents.
|
||||
);
|
||||
$replacements = array( '$1', '$1', '$1', '$2' );
|
||||
|
||||
$result = preg_replace( $patterns, $replacements, $text );
|
||||
if ( ! is_string( $result ) ) {
|
||||
$result = $text;
|
||||
}
|
||||
|
||||
return sanitize_text_field( trim( $result ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the post title from the first H1 in the Markdown, and remove that
|
||||
* H1 line from the content so it does not duplicate the theme-rendered title.
|
||||
*
|
||||
* Falls back to $fallback_title when no H1 is present or the extracted text
|
||||
* is empty after sanitization.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param string $content Raw Markdown.
|
||||
* @param string $fallback_title Fallback title if no H1 is found.
|
||||
* @return array{title: string, content: string} {
|
||||
* Extracted title (plain text) and the Markdown with the first H1 removed.
|
||||
*
|
||||
* @type string $title Post title.
|
||||
* @type string $content Markdown with the first H1 line removed.
|
||||
* }
|
||||
*/
|
||||
function robotstxt_docmd_extract_h1_title( string $content, string $fallback_title ): array {
|
||||
if ( preg_match( '/^#[ \t]+(.+)$/m', $content, $matches ) ) {
|
||||
$title = robotstxt_docmd_plain_text_from_inline_markdown( trim( $matches[1] ) );
|
||||
if ( '' === $title ) {
|
||||
$title = $fallback_title;
|
||||
}
|
||||
|
||||
$replaced = preg_replace( '/^#[ \t]+.*$/m', '', $content, 1 );
|
||||
if ( is_string( $replaced ) ) {
|
||||
$content = $replaced;
|
||||
}
|
||||
} else {
|
||||
$title = $fallback_title;
|
||||
}
|
||||
|
||||
return array(
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a (possibly relative) Markdown link target to a canonical repository
|
||||
* path, relative to the file currently being synced.
|
||||
*
|
||||
* Handles "./file.md", "../file.md", "sub/file.md", and absolute "/file.md"
|
||||
* forms. Returns null for empty targets.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param string $current_file_path Repository path of the file being synced.
|
||||
* @param string $href Raw link target.
|
||||
* @return string|null Canonical repository path, or null if it cannot be resolved.
|
||||
*/
|
||||
function robotstxt_docmd_resolve_repo_path( string $current_file_path, string $href ): ?string {
|
||||
// Strip any fragment or query string before resolving.
|
||||
$path = preg_replace( '/[?#].*$/', '', $href );
|
||||
if ( ! is_string( $path ) || '' === $path ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( 0 === strpos( $path, '/' ) ) {
|
||||
// Absolute repository path.
|
||||
$base_segments = array();
|
||||
$rel_segments = explode( '/', ltrim( $path, '/' ) );
|
||||
} else {
|
||||
// Relative to the current file's directory.
|
||||
$dir = dirname( $current_file_path );
|
||||
$base_segments = '.' === $dir ? array() : explode( '/', $dir );
|
||||
$rel_segments = explode( '/', $path );
|
||||
}
|
||||
|
||||
$result = $base_segments;
|
||||
foreach ( $rel_segments as $segment ) {
|
||||
if ( '' === $segment || '.' === $segment ) {
|
||||
continue;
|
||||
}
|
||||
if ( '..' === $segment ) {
|
||||
array_pop( $result );
|
||||
continue;
|
||||
}
|
||||
$result[] = $segment;
|
||||
}
|
||||
|
||||
$normalized = implode( '/', $result );
|
||||
if ( '' === $normalized ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a lookup of canonical repository file paths to WordPress permalinks,
|
||||
* scoped to the given repository and branch. Only mappings with an existing
|
||||
* target post are included.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param string $owner Repository owner.
|
||||
* @param string $repo Repository name.
|
||||
* @param string $branch Branch name.
|
||||
* @return array<string, string> Map of repository path => permalink.
|
||||
*/
|
||||
function robotstxt_docmd_build_link_map( string $owner, string $repo, string $branch ): array {
|
||||
$mappings = robotstxt_docmd_get_all_mappings();
|
||||
$map = array();
|
||||
|
||||
foreach ( $mappings as $mapping ) {
|
||||
if ( $mapping['repo_owner'] !== $owner || $mapping['repo_name'] !== $repo || $mapping['branch'] !== $branch ) {
|
||||
continue;
|
||||
}
|
||||
if ( empty( $mapping['target_post_id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$permalink = get_permalink( (int) $mapping['target_post_id'] );
|
||||
if ( is_string( $permalink ) && '' !== $permalink ) {
|
||||
$map[ $mapping['file_path'] ] = $permalink;
|
||||
}
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the imported-image asset map for a synced post.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param int $post_id Target post ID.
|
||||
* @return array<string, int> Map of repository image path => attachment ID.
|
||||
*/
|
||||
function robotstxt_docmd_get_asset_map( int $post_id ): array {
|
||||
$raw = get_post_meta( $post_id, '_robotstxt_docmd_assets', true );
|
||||
if ( ! is_array( $raw ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$map = array();
|
||||
foreach ( $raw as $path => $attachment_id ) {
|
||||
if ( is_string( $path ) && ( is_int( $attachment_id ) || ( is_string( $attachment_id ) && ctype_digit( $attachment_id ) ) ) ) {
|
||||
$map[ $path ] = (int) $attachment_id;
|
||||
}
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the imported-image asset map for a synced post.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param int $post_id Target post ID.
|
||||
* @param array $map Map of repository image path => attachment ID.
|
||||
* @phpstan-param array<string, int> $map
|
||||
* @return void
|
||||
*/
|
||||
function robotstxt_docmd_save_asset_map( int $post_id, array $map ): void {
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_assets', $map );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of image extensions allowed for sideloading.
|
||||
*
|
||||
* SVG is intentionally excluded to avoid stored XSS via embedded scripts.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
function robotstxt_docmd_allowed_image_extensions(): array {
|
||||
return array( 'jpg', 'jpeg', 'png', 'gif', 'webp' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Download an image from the repository and import it into the Media Library.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param string $repo_path Canonical repository path of the image.
|
||||
* @param int $target_post_id Post to attach the image to.
|
||||
* @param string $owner Repository owner.
|
||||
* @param string $repo Repository name.
|
||||
* @param string $branch Branch name.
|
||||
* @param string $token Encrypted GitHub token.
|
||||
* @return int|WP_Error Attachment ID on success, or WP_Error.
|
||||
*/
|
||||
function robotstxt_docmd_sideload_repo_image( string $repo_path, int $target_post_id, string $owner, string $repo, string $branch, string $token ): int|WP_Error {
|
||||
$ext = strtolower( (string) pathinfo( $repo_path, PATHINFO_EXTENSION ) );
|
||||
$allowed = robotstxt_docmd_allowed_image_extensions();
|
||||
if ( ! in_array( $ext, $allowed, true ) ) {
|
||||
return new WP_Error(
|
||||
'unsupported_image_type',
|
||||
sprintf(
|
||||
/* translators: %s: file extension */
|
||||
__( 'Unsupported image type .%s. Allowed: jpg, jpeg, png, gif, webp.', 'robotstxt-documentation-markdown' ),
|
||||
$ext
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Fetch image bytes from GitHub.
|
||||
$bytes = robotstxt_docmd_get_file_content( $owner, $repo, $repo_path, $branch, $token );
|
||||
if ( is_wp_error( $bytes ) ) {
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
// Size guard (10 MB).
|
||||
if ( strlen( $bytes ) > 10 * 1024 * 1024 ) {
|
||||
return new WP_Error( 'image_too_large', __( 'Repository image exceeds the 10 MB import limit.', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'media_handle_sideload' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/media.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||
}
|
||||
|
||||
$filename = sanitize_file_name( basename( $repo_path ) );
|
||||
$tmp_name = wp_tempnam( $filename );
|
||||
if ( '' === $tmp_name ) {
|
||||
return new WP_Error( 'temp_failed', __( 'Could not create a temporary file for image import.', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
global $wp_filesystem;
|
||||
if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
WP_Filesystem();
|
||||
}
|
||||
|
||||
if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
|
||||
wp_delete_file( $tmp_name );
|
||||
return new WP_Error( 'fs_failed', __( 'Could not initialize the WordPress filesystem.', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
if ( ! $wp_filesystem->put_contents( $tmp_name, $bytes, FS_CHMOD_FILE ) ) {
|
||||
wp_delete_file( $tmp_name );
|
||||
return new WP_Error( 'write_failed', __( 'Could not write image to the temporary file.', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
$attach_id = media_handle_sideload(
|
||||
array(
|
||||
'name' => $filename,
|
||||
'tmp_name' => $tmp_name,
|
||||
),
|
||||
$target_post_id
|
||||
);
|
||||
|
||||
if ( is_wp_error( $attach_id ) ) {
|
||||
wp_delete_file( $tmp_name );
|
||||
return $attach_id;
|
||||
}
|
||||
|
||||
return (int) $attach_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post-process synced HTML: rewrite internal links to mapped permalinks and
|
||||
* sideload repository images into the Media Library.
|
||||
*
|
||||
* Internal-link and image references are parsed with DOMDocument (no regex on
|
||||
* HTML). Images already present in $asset_map are reused. Image import errors
|
||||
* are non-fatal: the original src is kept and the sync continues.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param string $html Converted HTML content.
|
||||
* @param array $mapping Mapping being synced.
|
||||
* @param int $target_post_id Target post ID (for image attachment).
|
||||
* @param string $token Encrypted GitHub token (for image fetch).
|
||||
* @param array $asset_map Existing imported-image map (path => attach ID).
|
||||
* @phpstan-param MappingData $mapping
|
||||
* @phpstan-param array<string, int> $asset_map
|
||||
* @return array{html: string, assets: array<string, int>} Processed HTML and the updated asset map.
|
||||
*/
|
||||
function robotstxt_docmd_process_synced_html( string $html, array $mapping, int $target_post_id, string $token, array $asset_map ): array {
|
||||
$dom = new DOMDocument();
|
||||
libxml_use_internal_errors( true );
|
||||
$dom->loadHTML(
|
||||
'<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>' . $html . '</body></html>'
|
||||
);
|
||||
libxml_clear_errors();
|
||||
|
||||
$link_map = robotstxt_docmd_build_link_map( $mapping['repo_owner'], $mapping['repo_name'], $mapping['branch'] );
|
||||
|
||||
// Rewrite internal anchor hrefs.
|
||||
foreach ( $dom->getElementsByTagName( 'a' ) as $link ) {
|
||||
$href = $link->getAttribute( 'href' );
|
||||
if ( '' === $href ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip absolute, protocol-relative, mailto/tel, and anchor-only links.
|
||||
if ( preg_match( '~^(https?:|mailto:|tel:|//|#)~', $href ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$resolved = robotstxt_docmd_resolve_repo_path( $mapping['file_path'], $href );
|
||||
if ( null === $resolved ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $link_map[ $resolved ] ) ) {
|
||||
$link->setAttribute( 'href', $link_map[ $resolved ] );
|
||||
}
|
||||
}
|
||||
|
||||
// Sideload or reuse repository images.
|
||||
foreach ( $dom->getElementsByTagName( 'img' ) as $image ) {
|
||||
$src = $image->getAttribute( 'src' );
|
||||
if ( '' === $src ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip absolute, protocol-relative, and data URIs.
|
||||
if ( preg_match( '~^(https?:|//|data:)~', $src ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$resolved = robotstxt_docmd_resolve_repo_path( $mapping['file_path'], $src );
|
||||
if ( null === $resolved ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reuse an already-imported attachment.
|
||||
if ( isset( $asset_map[ $resolved ] ) ) {
|
||||
$url = wp_get_attachment_url( (int) $asset_map[ $resolved ] );
|
||||
if ( is_string( $url ) && '' !== $url ) {
|
||||
$image->setAttribute( 'src', $url );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Import the image from the repository.
|
||||
$attach_id = robotstxt_docmd_sideload_repo_image(
|
||||
$resolved,
|
||||
$target_post_id,
|
||||
$mapping['repo_owner'],
|
||||
$mapping['repo_name'],
|
||||
$mapping['branch'],
|
||||
$token
|
||||
);
|
||||
|
||||
if ( is_wp_error( $attach_id ) ) {
|
||||
// Keep the original src; do not block the sync.
|
||||
continue;
|
||||
}
|
||||
|
||||
$asset_map[ $resolved ] = $attach_id;
|
||||
$url = wp_get_attachment_url( $attach_id );
|
||||
if ( is_string( $url ) && '' !== $url ) {
|
||||
$image->setAttribute( 'src', $url );
|
||||
}
|
||||
}
|
||||
|
||||
// Extract the processed body HTML.
|
||||
$body = $dom->getElementsByTagName( 'body' )->item( 0 );
|
||||
if ( ! $body instanceof DOMElement ) {
|
||||
return array(
|
||||
'html' => $html,
|
||||
'assets' => $asset_map,
|
||||
);
|
||||
}
|
||||
|
||||
$output = '';
|
||||
foreach ( $body->childNodes as $child ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- DOMDocument API property.
|
||||
$saved = $dom->saveHTML( $child );
|
||||
if ( is_string( $saved ) ) {
|
||||
$output .= $saved;
|
||||
}
|
||||
}
|
||||
|
||||
if ( '' === $output ) {
|
||||
$output = $html;
|
||||
}
|
||||
|
||||
return array(
|
||||
'html' => $output,
|
||||
'assets' => $asset_map,
|
||||
);
|
||||
}
|
||||
|
|
@ -10,21 +10,39 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Derive the AES-256-CBC key for token encryption using HKDF-SHA256.
|
||||
*
|
||||
* Uses wp_salt('auth') as input keying material and derives a 32-byte key
|
||||
* scoped to token encryption. Replaces the <= 1.1.1 practice of feeding
|
||||
* wp_salt('auth') directly to openssl_encrypt().
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @return string 32 raw key bytes.
|
||||
*/
|
||||
function robotstxt_docmd_token_key(): string {
|
||||
return hash_hkdf( 'sha256', wp_salt( 'auth' ), 32, 'robotstxt-docmd-github-token' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt GitHub token for storage
|
||||
*
|
||||
* Stored format: `v2:` followed by base64( IV || ciphertext ), encrypted with
|
||||
* the HKDF-derived key. The `v2:` prefix distinguishes v2 tokens from the
|
||||
* legacy (<= 1.1.1) format written by earlier versions.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $token Plain token.
|
||||
* @return string Encrypted token, or empty string on failure.
|
||||
* @return string Encrypted token (v2-prefixed), or empty string on failure.
|
||||
*/
|
||||
function robotstxt_docmd_encrypt_token( string $token ): string {
|
||||
if ( empty( $token ) ) {
|
||||
if ( '' === $token ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Use WordPress salts for encryption key.
|
||||
$key = wp_salt( 'auth' );
|
||||
$key = robotstxt_docmd_token_key();
|
||||
$iv_length = openssl_cipher_iv_length( 'aes-256-cbc' );
|
||||
$iv = openssl_random_pseudo_bytes( $iv_length );
|
||||
$encrypted = openssl_encrypt( $token, 'aes-256-cbc', $key, 0, $iv );
|
||||
|
|
@ -33,34 +51,97 @@ function robotstxt_docmd_encrypt_token( string $token ): string {
|
|||
return '';
|
||||
}
|
||||
|
||||
return base64_encode( $iv . $encrypted ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
|
||||
return 'v2:' . base64_encode( $iv . $encrypted ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypt GitHub token from storage
|
||||
*
|
||||
* Handles two storage formats:
|
||||
* - `v2:`-prefixed tokens are decrypted with the HKDF-derived key.
|
||||
* - Legacy (unprefixed) tokens are decrypted with wp_salt('auth') directly,
|
||||
* then transparently re-encrypted with the v2 scheme and persisted (one-time
|
||||
* lazy migration). This keeps the cron path working without an admin request.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $encrypted_token Encrypted token.
|
||||
* @param string $encrypted_token Encrypted token (v2 or legacy).
|
||||
* @return string Plain token, or empty string on failure.
|
||||
*/
|
||||
function robotstxt_docmd_decrypt_token( string $encrypted_token ): string {
|
||||
if ( empty( $encrypted_token ) ) {
|
||||
if ( '' === $encrypted_token ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$key = wp_salt( 'auth' );
|
||||
$iv_length = openssl_cipher_iv_length( 'aes-256-cbc' );
|
||||
|
||||
// v2 tokens use the HKDF-derived key.
|
||||
if ( str_starts_with( $encrypted_token, 'v2:' ) ) {
|
||||
$decoded = base64_decode( substr( $encrypted_token, 3 ), true ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
|
||||
if ( false === $decoded || strlen( $decoded ) <= $iv_length ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$iv = substr( $decoded, 0, $iv_length );
|
||||
$ciphertext = substr( $decoded, $iv_length );
|
||||
$decrypted = openssl_decrypt( $ciphertext, 'aes-256-cbc', robotstxt_docmd_token_key(), 0, $iv );
|
||||
|
||||
return false !== $decrypted ? $decrypted : '';
|
||||
}
|
||||
|
||||
// Legacy tokens (<= 1.1.1) used wp_salt('auth') directly as the key.
|
||||
$decoded = base64_decode( $encrypted_token, true ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
|
||||
if ( false === $decoded || strlen( $decoded ) <= $iv_length ) {
|
||||
return '';
|
||||
}
|
||||
$iv = substr( $decoded, 0, $iv_length );
|
||||
$encrypted = substr( $decoded, $iv_length );
|
||||
|
||||
$decrypted = openssl_decrypt( $encrypted, 'aes-256-cbc', $key, 0, $iv );
|
||||
return false !== $decrypted ? $decrypted : '';
|
||||
$iv = substr( $decoded, 0, $iv_length );
|
||||
$ciphertext = substr( $decoded, $iv_length );
|
||||
$decrypted = openssl_decrypt( $ciphertext, 'aes-256-cbc', wp_salt( 'auth' ), 0, $iv );
|
||||
|
||||
if ( false === $decrypted || '' === $decrypted ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Lazy one-time migration to the v2 scheme.
|
||||
$reencrypted = robotstxt_docmd_encrypt_token( $decrypted );
|
||||
if ( '' !== $reencrypted ) {
|
||||
robotstxt_docmd_persist_migrated_token( $reencrypted );
|
||||
}
|
||||
|
||||
return $decrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist a migrated (re-encrypted) token back into plugin settings.
|
||||
*
|
||||
* Runs at most once: after the first migration the stored value carries the
|
||||
* `v2:` prefix and the legacy branch in robotstxt_docmd_decrypt_token() is no
|
||||
* longer taken. Safe under concurrency because the re-encrypted value is
|
||||
* deterministic for a given plaintext + key.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @param string $reencrypted Re-encrypted token (v2 scheme).
|
||||
* @return void
|
||||
*/
|
||||
function robotstxt_docmd_persist_migrated_token( string $reencrypted ): void {
|
||||
$raw_settings = get_option( 'robotstxt_docmd_settings', array() );
|
||||
if ( ! is_array( $raw_settings ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$current = array_key_exists( 'github_token', $raw_settings ) && is_string( $raw_settings['github_token'] )
|
||||
? $raw_settings['github_token']
|
||||
: '';
|
||||
|
||||
// Only update while the stored token is still the legacy (unprefixed) one.
|
||||
if ( '' === $current || str_starts_with( $current, 'v2:' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$raw_settings['github_token'] = $reencrypted;
|
||||
update_option( 'robotstxt_docmd_settings', $raw_settings, false );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -135,10 +135,10 @@ function robotstxt_docmd_get_repository_contents_recursive( string $owner, strin
|
|||
|
||||
$url = sprintf(
|
||||
'https://api.github.com/repos/%s/%s/contents/%s?ref=%s',
|
||||
$owner,
|
||||
$repo,
|
||||
$path,
|
||||
$branch
|
||||
rawurlencode( $owner ),
|
||||
rawurlencode( $repo ),
|
||||
rawurlencode( $path ),
|
||||
rawurlencode( $branch )
|
||||
);
|
||||
|
||||
$response = wp_remote_get(
|
||||
|
|
@ -239,10 +239,10 @@ function robotstxt_docmd_get_file_content( string $owner, string $repo, string $
|
|||
|
||||
$url = sprintf(
|
||||
'https://api.github.com/repos/%s/%s/contents/%s?ref=%s',
|
||||
$owner,
|
||||
$repo,
|
||||
$file_path,
|
||||
$branch
|
||||
rawurlencode( $owner ),
|
||||
rawurlencode( $repo ),
|
||||
rawurlencode( $file_path ),
|
||||
rawurlencode( $branch )
|
||||
);
|
||||
|
||||
$response = wp_remote_get(
|
||||
|
|
|
|||
|
|
@ -292,6 +292,11 @@ function robotstxt_docmd_sync_mapping( int $mapping_id ): bool|WP_Error {
|
|||
return $content;
|
||||
}
|
||||
|
||||
// Derive the post title from the first H1 and remove that H1 from the body.
|
||||
$extracted = robotstxt_docmd_extract_h1_title( $content, $mapping['title'] );
|
||||
$content = $extracted['content'];
|
||||
$post_title = $extracted['title'];
|
||||
|
||||
// Convert Markdown to HTML using CommonMark.
|
||||
// Strip raw HTML from Markdown to prevent stored XSS via compromised upstream repos.
|
||||
$converter = new \League\CommonMark\CommonMarkConverter(
|
||||
|
|
@ -307,7 +312,7 @@ function robotstxt_docmd_sync_mapping( int $mapping_id ): bool|WP_Error {
|
|||
// Create new post.
|
||||
$post_id = wp_insert_post(
|
||||
array(
|
||||
'post_title' => $mapping['title'],
|
||||
'post_title' => $post_title,
|
||||
'post_content' => $html_content,
|
||||
'post_type' => $mapping['target_post_type'],
|
||||
'post_status' => 'publish',
|
||||
|
|
@ -325,20 +330,35 @@ function robotstxt_docmd_sync_mapping( int $mapping_id ): bool|WP_Error {
|
|||
|
||||
// Save the post ID for future syncs.
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_target_post_id', $post_id );
|
||||
$target_post_id = (int) $post_id;
|
||||
} else {
|
||||
// Update existing post.
|
||||
$update_result = wp_update_post(
|
||||
array(
|
||||
'ID' => $mapping['target_post_id'],
|
||||
'post_content' => $html_content,
|
||||
),
|
||||
true
|
||||
);
|
||||
$target_post_id = (int) $mapping['target_post_id'];
|
||||
}
|
||||
|
||||
if ( is_wp_error( $update_result ) ) {
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'error' );
|
||||
return $update_result;
|
||||
}
|
||||
// Post-process: translate internal links and sideload repository images.
|
||||
$asset_map = robotstxt_docmd_get_asset_map( $target_post_id );
|
||||
$processed = robotstxt_docmd_process_synced_html( $html_content, $mapping, $target_post_id, $token, $asset_map );
|
||||
|
||||
if ( '' !== $processed['html'] ) {
|
||||
$html_content = $processed['html'];
|
||||
}
|
||||
robotstxt_docmd_save_asset_map( $target_post_id, $processed['assets'] );
|
||||
|
||||
// Persist the rewritten content and the H1-derived title.
|
||||
// NOTE: post_name (slug) is intentionally NEVER passed here, so the slug
|
||||
// remains stable across syncs even though the title follows the H1.
|
||||
$update_result = wp_update_post(
|
||||
array(
|
||||
'ID' => $target_post_id,
|
||||
'post_title' => $post_title,
|
||||
'post_content' => $html_content,
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_wp_error( $update_result ) ) {
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'error' );
|
||||
return $update_result;
|
||||
}
|
||||
|
||||
// Update sync status.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* Plugin Name: Documentation Markdown (by ROBOTSTXT)
|
||||
* Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown
|
||||
* Description: Synchronizes Markdown documentation from GitHub repositories to WordPress pages and posts automatically.
|
||||
* Version: 1.1.1
|
||||
* Requires at least: 6.7
|
||||
* Version: 1.2.0
|
||||
* Requires at least: 6.8
|
||||
* Requires PHP: 8.0
|
||||
* Security: robotstxt@robotstxt.es
|
||||
* Author: ROBOTSTXT
|
||||
|
|
@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
|
||||
// Define plugin constants.
|
||||
define( 'ROBOTSTXT_DOCMD_VERSION', '1.1.1' );
|
||||
define( 'ROBOTSTXT_DOCMD_VERSION', '1.2.0' );
|
||||
define( 'ROBOTSTXT_DOCMD_PLUGIN_FILE', __FILE__ );
|
||||
define( 'ROBOTSTXT_DOCMD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'ROBOTSTXT_DOCMD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
|
@ -41,6 +41,7 @@ if ( file_exists( ROBOTSTXT_DOCMD_PLUGIN_DIR . 'vendor/autoload.php' ) ) {
|
|||
require_once ROBOTSTXT_DOCMD_PLUGIN_DIR . 'robotstxt-documentation-markdown-functions.php';
|
||||
require_once ROBOTSTXT_DOCMD_PLUGIN_DIR . 'robotstxt-documentation-markdown-github.php';
|
||||
require_once ROBOTSTXT_DOCMD_PLUGIN_DIR . 'robotstxt-documentation-markdown-map.php';
|
||||
require_once ROBOTSTXT_DOCMD_PLUGIN_DIR . 'robotstxt-documentation-markdown-content.php';
|
||||
require_once ROBOTSTXT_DOCMD_PLUGIN_DIR . 'robotstxt-documentation-markdown-cron.php';
|
||||
|
||||
// Activation/Deactivation hooks.
|
||||
|
|
@ -254,35 +255,34 @@ function robotstxt_docmd_handle_admin_actions() {
|
|||
if ( isset( $_GET['page'] ) && 'robotstxt-docmd-settings' === $_GET['page'] && isset( $_GET['debug_action'] ) ) {
|
||||
$debug_action = sanitize_key( wp_unslash( robotstxt_docmd_input_string( $_GET, 'debug_action' ) ) );
|
||||
|
||||
if ( 'test_github' === $debug_action ) {
|
||||
check_admin_referer( 'robotstxt_docmd_debug_test_github' );
|
||||
robotstxt_docmd_debug_test_github();
|
||||
return;
|
||||
}
|
||||
switch ( $debug_action ) {
|
||||
case 'test_github':
|
||||
check_admin_referer( 'robotstxt_docmd_debug_test_github' );
|
||||
robotstxt_docmd_debug_test_github();
|
||||
return;
|
||||
|
||||
if ( 'test_token' === $debug_action ) {
|
||||
check_admin_referer( 'robotstxt_docmd_debug_test_token' );
|
||||
robotstxt_docmd_debug_test_token();
|
||||
return;
|
||||
}
|
||||
case 'test_token':
|
||||
check_admin_referer( 'robotstxt_docmd_debug_test_token' );
|
||||
robotstxt_docmd_debug_test_token();
|
||||
return;
|
||||
|
||||
if ( 'run_cron' === $debug_action && isset( $_GET['mapping_id'] ) ) {
|
||||
$mapping_id = robotstxt_docmd_input_int( $_GET, 'mapping_id' );
|
||||
check_admin_referer( 'robotstxt_docmd_debug_run_cron_' . $mapping_id );
|
||||
robotstxt_docmd_debug_run_cron( $mapping_id );
|
||||
return;
|
||||
}
|
||||
case 'run_cron':
|
||||
if ( isset( $_GET['mapping_id'] ) ) {
|
||||
$mapping_id = robotstxt_docmd_input_int( $_GET, 'mapping_id' );
|
||||
check_admin_referer( 'robotstxt_docmd_debug_run_cron_' . $mapping_id );
|
||||
robotstxt_docmd_debug_run_cron( $mapping_id );
|
||||
}
|
||||
return;
|
||||
|
||||
if ( 'clear_cache' === $debug_action ) {
|
||||
check_admin_referer( 'robotstxt_docmd_debug_clear_cache' );
|
||||
robotstxt_docmd_debug_clear_cache();
|
||||
return;
|
||||
}
|
||||
case 'clear_cache':
|
||||
check_admin_referer( 'robotstxt_docmd_debug_clear_cache' );
|
||||
robotstxt_docmd_debug_clear_cache();
|
||||
return;
|
||||
|
||||
if ( 'fix_crons' === $debug_action ) {
|
||||
check_admin_referer( 'robotstxt_docmd_debug_fix_crons' );
|
||||
robotstxt_docmd_debug_fix_crons();
|
||||
return;
|
||||
case 'fix_crons':
|
||||
check_admin_referer( 'robotstxt_docmd_debug_fix_crons' );
|
||||
robotstxt_docmd_debug_fix_crons();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -374,11 +374,23 @@ function robotstxt_docmd_render_mappings_page() {
|
|||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ( ! empty( $mapping['target_post_id'] ) ) : ?>
|
||||
<a href="<?php echo esc_url( (string) get_permalink( (int) $mapping['target_post_id'] ) ); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?php echo esc_html( (string) get_the_title( (int) $mapping['target_post_id'] ) ); ?>
|
||||
<?php
|
||||
if ( ! empty( $mapping['target_post_id'] ) ) :
|
||||
$target_id = (int) $mapping['target_post_id'];
|
||||
$permalink = get_permalink( $target_id );
|
||||
$uri = get_page_uri( $target_id );
|
||||
$post_type = get_post_type( $target_id );
|
||||
?>
|
||||
<a href="<?php echo esc_url( (string) $permalink ); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?php echo esc_html( (string) get_the_title( $target_id ) ); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<br><small>
|
||||
<code><?php echo esc_html( '/' . ( is_string( $uri ) ? $uri : '' ) ); ?></code>
|
||||
<span class="description"><?php echo esc_html( is_string( $post_type ) ? $post_type : '' ); ?> #<?php echo esc_html( (string) $target_id ); ?></span>
|
||||
</small>
|
||||
<?php
|
||||
else :
|
||||
?>
|
||||
<em><?php esc_html_e( 'Not created yet', 'robotstxt-documentation-markdown' ); ?></em>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
|
@ -392,9 +404,9 @@ function robotstxt_docmd_render_mappings_page() {
|
|||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=robotstxt-docmd-add-mapping&mapping_id=' . $mapping['id'] ) ); ?>" class="button button-small">
|
||||
<?php esc_html_e( 'Edit', 'robotstxt-documentation-markdown' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=robotstxt-docmd-mappings&action=delete&mapping_id=' . $mapping['id'] ), 'robotstxt_docmd_delete_' . $mapping['id'] ) ); ?>" class="button button-small button-link-delete" onclick="return confirm('<?php echo esc_js( __( 'Are you sure?', 'robotstxt-documentation-markdown' ) ); ?>');">
|
||||
<?php esc_html_e( 'Delete', 'robotstxt-documentation-markdown' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=robotstxt-docmd-mappings&action=delete&mapping_id=' . $mapping['id'] ), 'robotstxt_docmd_delete_' . $mapping['id'] ) ); ?>" class="button button-small button-link-delete robotstxt-docmd-confirm" data-confirm="<?php esc_attr_e( 'Are you sure?', 'robotstxt-documentation-markdown' ); ?>">
|
||||
<?php esc_html_e( 'Delete', 'robotstxt-documentation-markdown' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
|
@ -402,6 +414,19 @@ function robotstxt_docmd_render_mappings_page() {
|
|||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<script>
|
||||
// Delegated confirmation for delete actions (replaces inline onclick).
|
||||
(function() {
|
||||
var links = document.querySelectorAll('.robotstxt-docmd-confirm');
|
||||
links.forEach(function(link) {
|
||||
link.addEventListener('click', function(e) {
|
||||
if (!confirm(link.getAttribute('data-confirm'))) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
@ -450,12 +475,20 @@ function robotstxt_docmd_render_discover_page() {
|
|||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$branch = sanitize_text_field( wp_unslash( robotstxt_docmd_input_string( $_GET, 'branch', 'main' ) ) );
|
||||
|
||||
// Check if refresh requested.
|
||||
// Cache key for this repository + branch.
|
||||
$cache_key = sprintf( 'robotstxt_docmd_files_%s_%s_%s', $repo_data['owner'], $repo_data['repo'], $branch );
|
||||
|
||||
// Detect cache state BEFORE the fetch below repopulates it, so the
|
||||
// "cached vs fresh" indicator reflects where the displayed data came from.
|
||||
$was_cached = false !== get_transient( $cache_key );
|
||||
|
||||
// Check if refresh requested (CSRF-protected; forces a fresh GitHub API call).
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$refresh = '1' === robotstxt_docmd_input_string( $_GET, 'refresh' );
|
||||
if ( $refresh ) {
|
||||
$cache_key = sprintf( 'robotstxt_docmd_files_%s_%s_%s', $repo_data['owner'], $repo_data['repo'], $branch );
|
||||
check_admin_referer( 'robotstxt_docmd_discover_refresh' );
|
||||
delete_transient( $cache_key );
|
||||
$was_cached = false;
|
||||
}
|
||||
|
||||
// Get files from GitHub.
|
||||
|
|
@ -476,6 +509,7 @@ function robotstxt_docmd_render_discover_page() {
|
|||
|
||||
<form method="get" style="margin-bottom: 20px;">
|
||||
<input type="hidden" name="page" value="robotstxt-docmd-discover">
|
||||
<?php wp_nonce_field( 'robotstxt_docmd_discover_refresh', '_wpnonce', false ); ?>
|
||||
<label>
|
||||
<?php esc_html_e( 'Branch:', 'robotstxt-documentation-markdown' ); ?>
|
||||
<input type="text" name="branch" value="<?php echo esc_attr( $branch ); ?>" class="regular-text">
|
||||
|
|
@ -508,9 +542,7 @@ function robotstxt_docmd_render_discover_page() {
|
|||
?>
|
||||
<br>
|
||||
<?php
|
||||
$cache_key = sprintf( 'robotstxt_docmd_files_%s_%s_%s', $repo_data['owner'], $repo_data['repo'], $branch );
|
||||
$cached_value = get_transient( $cache_key );
|
||||
if ( false !== $cached_value ) {
|
||||
if ( $was_cached ) {
|
||||
echo '<span style="color: green;">✓ ' . esc_html__( 'Using cached data (24 hour cache)', 'robotstxt-documentation-markdown' ) . '</span>';
|
||||
} else {
|
||||
echo '<span style="color: orange;">⟲ ' . esc_html__( 'Fetching fresh data from GitHub API', 'robotstxt-documentation-markdown' ) . '</span>';
|
||||
|
|
@ -761,25 +793,50 @@ function robotstxt_docmd_render_add_mapping_page() {
|
|||
<label>
|
||||
<?php esc_html_e( 'Select Page/Post:', 'robotstxt-documentation-markdown' ); ?>
|
||||
<?php
|
||||
$all_posts = get_posts(
|
||||
// Only query public, sync-relevant post types (excludes the
|
||||
// internal robotstxt_map CPT and attachments).
|
||||
$selectable_types = get_post_types( array( 'public' => true ), 'names' );
|
||||
unset( $selectable_types['attachment'] );
|
||||
$existing_posts = get_posts(
|
||||
array(
|
||||
'post_type' => 'any',
|
||||
'posts_per_page' => 100,
|
||||
'post_type' => array_values( $selectable_types ),
|
||||
// phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page -- Deliberate cap for the admin "existing content" dropdown; query uses no_found_rows for performance.
|
||||
'posts_per_page' => 200,
|
||||
'orderby' => 'title',
|
||||
'order' => 'ASC',
|
||||
'no_found_rows' => true,
|
||||
'ignore_sticky_posts' => true,
|
||||
)
|
||||
);
|
||||
|
||||
// Build a path-based label per post so nested and duplicate
|
||||
// pages are distinguishable, then sort by path to group the tree.
|
||||
$options = array();
|
||||
foreach ( $existing_posts as $existing ) {
|
||||
$uri = get_page_uri( $existing );
|
||||
$path = ( is_string( $uri ) && '' !== $uri ) ? $uri : $existing->post_name;
|
||||
$depth = substr_count( $path, '/' );
|
||||
$label = str_repeat( '— ', $depth )
|
||||
. $existing->post_title
|
||||
. ' — /' . $path
|
||||
. ' (#' . (string) $existing->ID . ', ' . $existing->post_type . ')';
|
||||
|
||||
$options[ $path . "\0" . (string) $existing->ID ] = array(
|
||||
'id' => $existing->ID,
|
||||
'label' => $label,
|
||||
);
|
||||
}
|
||||
ksort( $options );
|
||||
?>
|
||||
<select name="target_post_id">
|
||||
<option value="0"><?php esc_html_e( 'Select a page...', 'robotstxt-documentation-markdown' ); ?></option>
|
||||
<?php
|
||||
foreach ( $all_posts as $post ) {
|
||||
foreach ( $options as $option ) {
|
||||
printf(
|
||||
'<option value="%d" %s>%s (%s)</option>',
|
||||
esc_attr( (string) $post->ID ),
|
||||
selected( $data['target_post_id'], $post->ID, false ),
|
||||
esc_html( $post->post_title ),
|
||||
esc_html( $post->post_type )
|
||||
'<option value="%d" %s>%s</option>',
|
||||
esc_attr( (string) $option['id'] ),
|
||||
selected( $data['target_post_id'], $option['id'], false ),
|
||||
esc_html( $option['label'] )
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
|
@ -863,13 +920,20 @@ function robotstxt_docmd_handle_save_mapping() {
|
|||
|
||||
$mapping_id = robotstxt_docmd_input_int( $_POST, 'mapping_id' );
|
||||
|
||||
// Validate target post type against registered public post types; fall back to 'page'.
|
||||
$target_post_type = sanitize_key( wp_unslash( robotstxt_docmd_input_string( $_POST, 'target_post_type', 'page' ) ) );
|
||||
$public_post_types = get_post_types( array( 'public' => true ), 'names' );
|
||||
if ( ! in_array( $target_post_type, $public_post_types, true ) ) {
|
||||
$target_post_type = 'page';
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'title' => sanitize_text_field( wp_unslash( robotstxt_docmd_input_string( $_POST, 'title' ) ) ),
|
||||
'repo_owner' => sanitize_text_field( wp_unslash( robotstxt_docmd_input_string( $_POST, 'repo_owner' ) ) ),
|
||||
'repo_name' => sanitize_text_field( wp_unslash( robotstxt_docmd_input_string( $_POST, 'repo_name' ) ) ),
|
||||
'file_path' => sanitize_text_field( wp_unslash( robotstxt_docmd_input_string( $_POST, 'file_path' ) ) ),
|
||||
'branch' => sanitize_text_field( wp_unslash( robotstxt_docmd_input_string( $_POST, 'branch', 'main' ) ) ),
|
||||
'target_post_type' => sanitize_key( wp_unslash( robotstxt_docmd_input_string( $_POST, 'target_post_type', 'page' ) ) ),
|
||||
'target_post_type' => $target_post_type,
|
||||
'target_author' => robotstxt_docmd_input_int( $_POST, 'target_author', get_current_user_id() ),
|
||||
'target_parent' => robotstxt_docmd_input_int( $_POST, 'target_parent' ),
|
||||
'target_order' => robotstxt_docmd_input_int( $_POST, 'target_order' ),
|
||||
|
|
|
|||
16
update.json
16
update.json
|
|
@ -1,22 +1,22 @@
|
|||
{
|
||||
"name": "Documentation Markdown (by ROBOTSTXT)",
|
||||
"slug": "robotstxt-documentation-markdown",
|
||||
"version": "1.1.1",
|
||||
"download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown/releases/download/1.1.1/robotstxt-documentation-markdown-1.1.1.zip",
|
||||
"requires": "6.7",
|
||||
"version": "1.2.0",
|
||||
"download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown/releases/download/1.2.0/robotstxt-documentation-markdown-1.2.0.zip",
|
||||
"requires": "6.8",
|
||||
"requires_php": "8.0",
|
||||
"tested": "7.1",
|
||||
"last_updated": "2026-06-08",
|
||||
"last_updated": "2026-08-07",
|
||||
"author": "ROBOTSTXT",
|
||||
"author_profile": "https://www.robotstxt.es/",
|
||||
"homepage": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown",
|
||||
"description": "Synchronizes Markdown documentation from GitHub repositories to WordPress pages and posts automatically. Perfect for maintaining technical documentation, API references, and knowledge bases with version control.",
|
||||
"changelog": "<h3>1.0.0 - 2026-01-26</h3><h4>Initial Release</h4><ul><li><strong>Core:</strong> GitHub repository synchronization system</li><li><strong>Core:</strong> Markdown to HTML conversion using CommonMark</li><li><strong>Core:</strong> Encrypted GitHub token storage (AES-256-CBC)</li><li><strong>Feature:</strong> Flexible file-to-content mapping system</li><li><strong>Feature:</strong> Custom Post Type for mapping management</li><li><strong>Feature:</strong> Configurable sync frequency (manual, hourly, twice daily, daily)</li><li><strong>Feature:</strong> Manual on-demand synchronization</li><li><strong>Feature:</strong> Support for pages, posts, and custom post types</li><li><strong>Feature:</strong> Page order (menu_order) configuration</li><li><strong>Feature:</strong> Configurable post author and parent page</li><li><strong>Admin:</strong> Complete admin interface with status monitoring</li><li><strong>Admin:</strong> Settings page for GitHub configuration</li><li><strong>Admin:</strong> Mappings management interface</li><li><strong>Debug:</strong> Built-in debug tools (visible when WP_DEBUG enabled)</li><li><strong>Debug:</strong> Test GitHub connection and token validity</li><li><strong>Debug:</strong> View and manage scheduled cron jobs</li><li><strong>Debug:</strong> Fix/reschedule broken cron jobs</li><li><strong>Debug:</strong> Cache management tools</li><li><strong>Security:</strong> Complete input sanitization and output escaping</li><li><strong>Security:</strong> Nonce verification on all forms</li><li><strong>Security:</strong> Capability checks for admin actions</li><li><strong>i18n:</strong> Full internationalization support</li><li><strong>Quality:</strong> WordPress Coding Standards compliant</li></ul>",
|
||||
"description": "Synchronizes Markdown documentation from GitHub repositories to WordPress pages and posts automatically. Perfect for maintaining technical documentation, API references, knowledge bases, and more with version control.",
|
||||
"changelog": "<h3>1.2.0 - 2026-08-07</h3><h4>Added</h4><ul><li><strong>Title from H1:</strong> synced post title taken from the first Markdown H1 (and stripped from the body)</li><li><strong>Internal link translation:</strong> repo-relative links rewritten to the matching WordPress permalink</li><li><strong>Image sideloading:</strong> repository images imported into the Media Library and referenced by attachment URL</li></ul><h4>Security</h4><ul><li>Patched CVE-2026-71478 in league/commonmark (2.8.2 -> 2.9.0)</li><li>GitHub token encryption hardened with HKDF-SHA256 key derivation (transparent migration)</li><li>CSRF nonce added to Discover Files refresh; GitHub API paths rawurlencode()d</li></ul><h3>1.1.1 - 2026-06-08</h3><h4>Security</h4><ul><li>CommonMark raw HTML passthrough disabled; token option no longer autoloaded</li></ul><h3>1.0.0 - 2026-01-26</h3><h4>Initial Release</h4><ul><li><strong>Core:</strong> GitHub repository synchronization system</li><li><strong>Core:</strong> Markdown to HTML conversion using CommonMark</li><li><strong>Core:</strong> Encrypted GitHub token storage (AES-256-CBC)</li><li><strong>Feature:</strong> Flexible file-to-content mapping system</li><li><strong>Feature:</strong> Custom Post Type for mapping management</li><li><strong>Feature:</strong> Configurable sync frequency (manual, hourly, twice daily, daily)</li><li><strong>Feature:</strong> Manual on-demand synchronization</li><li><strong>Feature:</strong> Support for pages, posts, and custom post types</li><li><strong>Feature:</strong> Page order (menu_order) configuration</li><li><strong>Feature:</strong> Configurable post author and parent page</li><li><strong>Admin:</strong> Complete admin interface with status monitoring</li><li><strong>Admin:</strong> Settings page for GitHub configuration</li><li><strong>Admin:</strong> Mappings management interface</li><li><strong>Debug:</strong> Built-in debug tools (visible when WP_DEBUG enabled)</li><li><strong>Debug:</strong> Test GitHub connection and token validity</li><li><strong>Debug:</strong> View and manage scheduled cron jobs</li><li><strong>Debug:</strong> Fix/reschedule broken cron jobs</li><li><strong>Debug:</strong> Cache management tools</li><li><strong>Security:</strong> Complete input sanitization and output escaping</li><li><strong>Security:</strong> Nonce verification on all forms</li><li><strong>Security:</strong> Capability checks for admin actions</li><li><strong>i18n:</strong> Full internationalization support</li><li><strong>Quality:</strong> WordPress Coding Standards compliant</li></ul>",
|
||||
"sections": {
|
||||
"description": "<p><strong>Documentation Markdown</strong> is a powerful WordPress plugin that enables seamless synchronization of Markdown documentation files from GitHub repositories into your WordPress site.</p><h4>Key Features</h4><ul><li><strong>Automatic Synchronization:</strong> Schedule automatic syncs via WordPress Cron (hourly, twice daily, daily)</li><li><strong>Markdown to HTML:</strong> Convert GitHub Flavored Markdown to clean HTML using CommonMark</li><li><strong>Flexible Mapping:</strong> Map individual MD files to specific WordPress posts or pages</li><li><strong>Secure:</strong> Encrypted GitHub token storage, full input validation & output escaping</li><li><strong>Translatable:</strong> Full internationalization support (i18n/l10n ready)</li><li><strong>Multi-Repository:</strong> Sync from multiple GitHub repos simultaneously</li><li><strong>Manual Sync:</strong> On-demand synchronization from admin interface</li><li><strong>Debug Tools:</strong> Built-in debugging tools (visible when WP_DEBUG is enabled)</li></ul><h4>Use Cases</h4><ul><li>API Documentation - Keep your API docs in sync between GitHub and WordPress</li><li>Technical Documentation - Maintain version-controlled technical docs</li><li>Knowledge Base - Build a knowledge base powered by GitHub</li><li>Blog Posts - Write blog posts in Markdown with Git workflow</li><li>Product Documentation - Sync product documentation from your repository</li></ul><h4>Requirements</h4><ul><li>PHP 8.2 or higher</li><li>WordPress 6.5 or higher (single-site installations only)</li><li>GitHub Personal Access Token (free)</li></ul>",
|
||||
"description": "<p><strong>Documentation Markdown</strong> is a powerful WordPress plugin that enables seamless synchronization of Markdown documentation files from GitHub repositories into your WordPress site.</p><h4>Key Features</h4><ul><li><strong>Automatic Synchronization:</strong> Schedule automatic syncs via WordPress Cron (hourly, twice daily, daily)</li><li><strong>Markdown to HTML:</strong> Convert GitHub Flavored Markdown to clean HTML using CommonMark</li><li><strong>Flexible Mapping:</strong> Map individual MD files to specific WordPress posts or pages</li><li><strong>Title from H1:</strong> Post titles are derived from the first Markdown H1 heading</li><li><strong>Link & Image Translation:</strong> Repo-relative links are rewritten to permalinks; images are sideloaded into the Media Library</li><li><strong>Secure:</strong> Encrypted GitHub token storage (HKDF-SHA256), full input validation & output escaping</li><li><strong>Translatable:</strong> Full internationalization support (i18n/l10n ready)</li><li><strong>Multi-Repository:</strong> Sync from multiple GitHub repos simultaneously</li><li><strong>Manual Sync:</strong> On-demand synchronization from admin interface</li><li><strong>Debug Tools:</strong> Built-in debugging tools (visible when WP_DEBUG is enabled)</li></ul><h4>Use Cases</h4><ul><li>API Documentation - Keep your API docs in sync between GitHub and WordPress</li><li>Technical Documentation - Maintain version-controlled technical docs</li><li>Knowledge Base - Build a knowledge base powered by GitHub</li><li>Blog Posts - Write blog posts in Markdown with Git workflow</li><li>Product Documentation - Sync product documentation from your repository</li></ul><h4>Requirements</h4><ul><li>PHP 8.0 or higher</li><li>WordPress 6.8 or higher</li><li>GitHub Personal Access Token (free)</li></ul>",
|
||||
"installation": "<h4>Installation</h4><ol><li>Upload the plugin files to <code>/wp-content/plugins/robotstxt-documentation-markdown/</code></li><li>Activate the plugin through the 'Plugins' menu in WordPress</li><li>Navigate to 'Documentation → Settings' in the WordPress admin menu</li><li>Generate a GitHub Personal Access Token:<ul><li>Go to GitHub → Settings → Developer settings → Personal access tokens</li><li>Click 'Generate new token'</li><li>For public repositories: No specific scopes needed</li><li>For private repositories: Select <code>repo</code> scope</li></ul></li><li>Paste your token in the plugin settings and save</li><li>Create your first mapping under 'Documentation → Mappings'</li></ol><h4>Configuration</h4><ol><li>Go to <strong>Documentation → Add Mapping</strong></li><li>Fill in the repository details (owner, name, file path, branch)</li><li>Configure target content (post type, author, parent, order)</li><li>Set synchronization frequency</li><li>Save and click 'Sync Now' to perform first sync</li></ol>",
|
||||
"faq": "<h4>Do I need a GitHub account?</h4><p>Yes, you need a GitHub account to generate a Personal Access Token. The token is required to access repositories (public or private).</p><h4>Can I sync from private repositories?</h4><p>Yes! When generating your GitHub Personal Access Token, make sure to select the <code>repo</code> scope for full access to private repositories.</p><h4>How often does synchronization happen?</h4><p>You can configure synchronization frequency per mapping: Manual only, Hourly, Twice daily, or Daily. You can also manually trigger sync at any time.</p><h4>Will the plugin delete my WordPress content if I uninstall it?</h4><p>By default, NO. When you uninstall the plugin, it preserves all synced WordPress pages/posts. However, there's an option in Settings to delete plugin data on uninstall - but this never deletes the actual WordPress content.</p><h4>Can I sync multiple files from the same repository?</h4><p>Yes! You can create multiple mappings, each pointing to different files in the same repository or different repositories.</p><h4>How do I debug synchronization issues?</h4><p>Enable WP_DEBUG in your wp-config.php, then go to Documentation → Settings. You'll see a 'Debug Tools' section with options to test GitHub connection, validate token, view cron jobs, and run manual syncs.</p>",
|
||||
"changelog": "<h3>1.0.0 - 2026-01-26</h3><h4>Initial Release</h4><ul><li><strong>Core:</strong> GitHub repository synchronization system</li><li><strong>Core:</strong> Markdown to HTML conversion using CommonMark</li><li><strong>Core:</strong> Encrypted GitHub token storage (AES-256-CBC)</li><li><strong>Feature:</strong> Flexible file-to-content mapping system</li><li><strong>Feature:</strong> Custom Post Type for mapping management</li><li><strong>Feature:</strong> Configurable sync frequency (manual, hourly, twice daily, daily)</li><li><strong>Feature:</strong> Manual on-demand synchronization</li><li><strong>Feature:</strong> Support for pages, posts, and custom post types</li><li><strong>Feature:</strong> Page order (menu_order) configuration</li><li><strong>Feature:</strong> Configurable post author and parent page</li><li><strong>Admin:</strong> Complete admin interface with status monitoring</li><li><strong>Admin:</strong> Settings page for GitHub configuration</li><li><strong>Admin:</strong> Mappings management interface</li><li><strong>Debug:</strong> Built-in debug tools (visible when WP_DEBUG enabled)</li><li><strong>Debug:</strong> Test GitHub connection and token validity</li><li><strong>Debug:</strong> View and manage scheduled cron jobs</li><li><strong>Debug:</strong> Fix/reschedule broken cron jobs</li><li><strong>Debug:</strong> Cache management tools</li><li><strong>Security:</strong> Complete input sanitization and output escaping</li><li><strong>Security:</strong> Nonce verification on all forms</li><li><strong>Security:</strong> Capability checks for admin actions</li><li><strong>i18n:</strong> Full internationalization support</li><li><strong>Quality:</strong> WordPress Coding Standards compliant</li></ul>"
|
||||
"changelog": "<h3>1.2.0 - 2026-08-07</h3><h4>Added</h4><ul><li><strong>Title from H1:</strong> synced post title taken from the first Markdown H1 (and stripped from the body)</li><li><strong>Internal link translation:</strong> repo-relative links rewritten to the matching WordPress permalink</li><li><strong>Image sideloading:</strong> repository images imported into the Media Library and referenced by attachment URL</li></ul><h4>Security</h4><ul><li>Patched CVE-2026-71478 in league/commonmark (2.8.2 -> 2.9.0)</li><li>GitHub token encryption hardened with HKDF-SHA256 key derivation (transparent migration)</li><li>CSRF nonce added to Discover Files refresh; GitHub API paths rawurlencode()d</li></ul><h3>1.1.1 - 2026-06-08</h3><h4>Security</h4><ul><li>CommonMark raw HTML passthrough disabled; token option no longer autoloaded</li></ul><h3>1.0.0 - 2026-01-26</h3><h4>Initial Release</h4><ul><li>Core synchronization, CommonMark conversion, encrypted token storage, mapping system, multi-repo support, debug tools</li></ul>"
|
||||
},
|
||||
"banners": {
|
||||
"low": "",
|
||||
|
|
|
|||
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
|
@ -19,4 +19,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit062b6bfebe9519df3bcac54aafa83aec::getLoader();
|
||||
return ComposerAutoloaderInitc097ca862608a882f291ae6b935e271c::getLoader();
|
||||
|
|
|
|||
3
vendor/composer/autoload_classmap.php
vendored
3
vendor/composer/autoload_classmap.php
vendored
|
|
@ -185,6 +185,8 @@ return array(
|
|||
'League\\CommonMark\\Extension\\Mention\\Mention' => $vendorDir . '/league/commonmark/src/Extension/Mention/Mention.php',
|
||||
'League\\CommonMark\\Extension\\Mention\\MentionExtension' => $vendorDir . '/league/commonmark/src/Extension/Mention/MentionExtension.php',
|
||||
'League\\CommonMark\\Extension\\Mention\\MentionParser' => $vendorDir . '/league/commonmark/src/Extension/Mention/MentionParser.php',
|
||||
'League\\CommonMark\\Extension\\NormalizeHeadings\\NormalizeHeadingsExtension' => $vendorDir . '/league/commonmark/src/Extension/NormalizeHeadings/NormalizeHeadingsExtension.php',
|
||||
'League\\CommonMark\\Extension\\NormalizeHeadings\\NormalizeHeadingsProcessor' => $vendorDir . '/league/commonmark/src/Extension/NormalizeHeadings/NormalizeHeadingsProcessor.php',
|
||||
'League\\CommonMark\\Extension\\SmartPunct\\DashParser' => $vendorDir . '/league/commonmark/src/Extension/SmartPunct/DashParser.php',
|
||||
'League\\CommonMark\\Extension\\SmartPunct\\EllipsesParser' => $vendorDir . '/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php',
|
||||
'League\\CommonMark\\Extension\\SmartPunct\\Quote' => $vendorDir . '/league/commonmark/src/Extension/SmartPunct/Quote.php',
|
||||
|
|
@ -361,6 +363,7 @@ return array(
|
|||
'Nette\\Utils\\AssertionException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php',
|
||||
'Nette\\Utils\\Callback' => $vendorDir . '/nette/utils/src/Utils/Callback.php',
|
||||
'Nette\\Utils\\DateTime' => $vendorDir . '/nette/utils/src/Utils/DateTime.php',
|
||||
'Nette\\Utils\\DateTimeImmutable' => $vendorDir . '/nette/utils/src/Utils/DateTimeImmutable.php',
|
||||
'Nette\\Utils\\FileInfo' => $vendorDir . '/nette/utils/src/Utils/FileInfo.php',
|
||||
'Nette\\Utils\\FileSystem' => $vendorDir . '/nette/utils/src/Utils/FileSystem.php',
|
||||
'Nette\\Utils\\Finder' => $vendorDir . '/nette/utils/src/Utils/Finder.php',
|
||||
|
|
|
|||
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit062b6bfebe9519df3bcac54aafa83aec
|
||||
class ComposerAutoloaderInitc097ca862608a882f291ae6b935e271c
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
|
@ -24,16 +24,16 @@ class ComposerAutoloaderInit062b6bfebe9519df3bcac54aafa83aec
|
|||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit062b6bfebe9519df3bcac54aafa83aec', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitc097ca862608a882f291ae6b935e271c', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit062b6bfebe9519df3bcac54aafa83aec', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitc097ca862608a882f291ae6b935e271c', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitc097ca862608a882f291ae6b935e271c::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitc097ca862608a882f291ae6b935e271c::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
|||
11
vendor/composer/autoload_static.php
vendored
11
vendor/composer/autoload_static.php
vendored
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec
|
||||
class ComposerStaticInitc097ca862608a882f291ae6b935e271c
|
||||
{
|
||||
public static $files = array (
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||
|
|
@ -243,6 +243,8 @@ class ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec
|
|||
'League\\CommonMark\\Extension\\Mention\\Mention' => __DIR__ . '/..' . '/league/commonmark/src/Extension/Mention/Mention.php',
|
||||
'League\\CommonMark\\Extension\\Mention\\MentionExtension' => __DIR__ . '/..' . '/league/commonmark/src/Extension/Mention/MentionExtension.php',
|
||||
'League\\CommonMark\\Extension\\Mention\\MentionParser' => __DIR__ . '/..' . '/league/commonmark/src/Extension/Mention/MentionParser.php',
|
||||
'League\\CommonMark\\Extension\\NormalizeHeadings\\NormalizeHeadingsExtension' => __DIR__ . '/..' . '/league/commonmark/src/Extension/NormalizeHeadings/NormalizeHeadingsExtension.php',
|
||||
'League\\CommonMark\\Extension\\NormalizeHeadings\\NormalizeHeadingsProcessor' => __DIR__ . '/..' . '/league/commonmark/src/Extension/NormalizeHeadings/NormalizeHeadingsProcessor.php',
|
||||
'League\\CommonMark\\Extension\\SmartPunct\\DashParser' => __DIR__ . '/..' . '/league/commonmark/src/Extension/SmartPunct/DashParser.php',
|
||||
'League\\CommonMark\\Extension\\SmartPunct\\EllipsesParser' => __DIR__ . '/..' . '/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php',
|
||||
'League\\CommonMark\\Extension\\SmartPunct\\Quote' => __DIR__ . '/..' . '/league/commonmark/src/Extension/SmartPunct/Quote.php',
|
||||
|
|
@ -419,6 +421,7 @@ class ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec
|
|||
'Nette\\Utils\\AssertionException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php',
|
||||
'Nette\\Utils\\Callback' => __DIR__ . '/..' . '/nette/utils/src/Utils/Callback.php',
|
||||
'Nette\\Utils\\DateTime' => __DIR__ . '/..' . '/nette/utils/src/Utils/DateTime.php',
|
||||
'Nette\\Utils\\DateTimeImmutable' => __DIR__ . '/..' . '/nette/utils/src/Utils/DateTimeImmutable.php',
|
||||
'Nette\\Utils\\FileInfo' => __DIR__ . '/..' . '/nette/utils/src/Utils/FileInfo.php',
|
||||
'Nette\\Utils\\FileSystem' => __DIR__ . '/..' . '/nette/utils/src/Utils/FileSystem.php',
|
||||
'Nette\\Utils\\Finder' => __DIR__ . '/..' . '/nette/utils/src/Utils/Finder.php',
|
||||
|
|
@ -460,9 +463,9 @@ class ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit062b6bfebe9519df3bcac54aafa83aec::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitc097ca862608a882f291ae6b935e271c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitc097ca862608a882f291ae6b935e271c::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitc097ca862608a882f291ae6b935e271c::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
|
|||
48
vendor/composer/installed.json
vendored
48
vendor/composer/installed.json
vendored
|
|
@ -80,17 +80,17 @@
|
|||
},
|
||||
{
|
||||
"name": "league/commonmark",
|
||||
"version": "2.8.2",
|
||||
"version_normalized": "2.8.2.0",
|
||||
"version": "2.9.0",
|
||||
"version_normalized": "2.9.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/commonmark.git",
|
||||
"reference": "59fb075d2101740c337c7216e3f32b36c204218b"
|
||||
"reference": "5703d83ba3da3b2e356a5fedc848ed6d8ffb6529"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/59fb075d2101740c337c7216e3f32b36c204218b",
|
||||
"reference": "59fb075d2101740c337c7216e3f32b36c204218b",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/5703d83ba3da3b2e356a5fedc848ed6d8ffb6529",
|
||||
"reference": "5703d83ba3da3b2e356a5fedc848ed6d8ffb6529",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -112,8 +112,8 @@
|
|||
"github/gfm": "0.29.0",
|
||||
"michelf/php-markdown": "^1.4 || ^2.0",
|
||||
"nyholm/psr7": "^1.5",
|
||||
"phpstan/phpstan": "^1.8.2",
|
||||
"phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",
|
||||
"phpstan/phpstan": "^2.0.0",
|
||||
"phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0 || ^12.0.0 || ^13.0.0",
|
||||
"scrutinizer/ocular": "^1.8.1",
|
||||
"symfony/finder": "^5.3 | ^6.0 | ^7.0 || ^8.0",
|
||||
"symfony/process": "^5.4 | ^6.0 | ^7.0 || ^8.0",
|
||||
|
|
@ -124,11 +124,11 @@
|
|||
"suggest": {
|
||||
"symfony/yaml": "v2.3+ required if using the Front Matter extension"
|
||||
},
|
||||
"time": "2026-03-19T13:16:38+00:00",
|
||||
"time": "2026-08-03T13:42:31+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.9-dev"
|
||||
"dev-main": "2.10-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
|
|
@ -345,17 +345,17 @@
|
|||
},
|
||||
{
|
||||
"name": "nette/utils",
|
||||
"version": "v4.1.4",
|
||||
"version_normalized": "4.1.4.0",
|
||||
"version": "v4.1.5",
|
||||
"version_normalized": "4.1.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nette/utils.git",
|
||||
"reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7"
|
||||
"reference": "b043439dbdf954e6c28b5ea7e34b0100f83165e0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nette/utils/zipball/7da6c396d7ebe142bc857c20479d5e70a5e1aac7",
|
||||
"reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7",
|
||||
"url": "https://api.github.com/repos/nette/utils/zipball/b043439dbdf954e6c28b5ea7e34b0100f83165e0",
|
||||
"reference": "b043439dbdf954e6c28b5ea7e34b0100f83165e0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -375,13 +375,13 @@
|
|||
},
|
||||
"suggest": {
|
||||
"ext-gd": "to use Image",
|
||||
"ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()",
|
||||
"ext-iconv": "to use Strings::chr(), ord() and reverse()",
|
||||
"ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()",
|
||||
"ext-json": "to use Nette\\Utils\\Json",
|
||||
"ext-mbstring": "to use Strings::lower() etc...",
|
||||
"ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()"
|
||||
},
|
||||
"time": "2026-05-11T20:49:54+00:00",
|
||||
"time": "2026-07-17T23:02:45+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
|
@ -433,7 +433,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nette/utils/issues",
|
||||
"source": "https://github.com/nette/utils/tree/v4.1.4"
|
||||
"source": "https://github.com/nette/utils/tree/v4.1.5"
|
||||
},
|
||||
"install-path": "../nette/utils"
|
||||
},
|
||||
|
|
@ -492,23 +492,23 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
"version": "v3.7.0",
|
||||
"version_normalized": "3.7.0.0",
|
||||
"version": "v3.7.1",
|
||||
"version_normalized": "3.7.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||
"reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b"
|
||||
"reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/50f59d1f3ca46d41ac911f97a78626b6756af35b",
|
||||
"reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d",
|
||||
"reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"time": "2026-04-13T15:52:40+00:00",
|
||||
"time": "2026-06-05T06:23:12+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
|
|
@ -542,7 +542,7 @@
|
|||
"description": "A generic function and convention to trigger deprecation notices",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.0"
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
|
|||
18
vendor/composer/installed.php
vendored
18
vendor/composer/installed.php
vendored
|
|
@ -20,9 +20,9 @@
|
|||
'dev_requirement' => false,
|
||||
),
|
||||
'league/commonmark' => array(
|
||||
'pretty_version' => '2.8.2',
|
||||
'version' => '2.8.2.0',
|
||||
'reference' => '59fb075d2101740c337c7216e3f32b36c204218b',
|
||||
'pretty_version' => '2.9.0',
|
||||
'version' => '2.9.0.0',
|
||||
'reference' => '5703d83ba3da3b2e356a5fedc848ed6d8ffb6529',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../league/commonmark',
|
||||
'aliases' => array(),
|
||||
|
|
@ -47,9 +47,9 @@
|
|||
'dev_requirement' => false,
|
||||
),
|
||||
'nette/utils' => array(
|
||||
'pretty_version' => 'v4.1.4',
|
||||
'version' => '4.1.4.0',
|
||||
'reference' => '7da6c396d7ebe142bc857c20479d5e70a5e1aac7',
|
||||
'pretty_version' => 'v4.1.5',
|
||||
'version' => '4.1.5.0',
|
||||
'reference' => 'b043439dbdf954e6c28b5ea7e34b0100f83165e0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../nette/utils',
|
||||
'aliases' => array(),
|
||||
|
|
@ -74,9 +74,9 @@
|
|||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/deprecation-contracts' => array(
|
||||
'pretty_version' => 'v3.7.0',
|
||||
'version' => '3.7.0.0',
|
||||
'reference' => '50f59d1f3ca46d41ac911f97a78626b6756af35b',
|
||||
'pretty_version' => 'v3.7.1',
|
||||
'version' => '3.7.1.0',
|
||||
'reference' => 'f3202fa1b5097b0af062dc978b32ecf63404e31d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
|
||||
'aliases' => array(),
|
||||
|
|
|
|||
2
vendor/league/commonmark/.phpstorm.meta.php
vendored
2
vendor/league/commonmark/.phpstorm.meta.php
vendored
|
|
@ -36,6 +36,8 @@ namespace PHPSTORM_META
|
|||
'renderer/block_separator',
|
||||
'renderer/inner_separator',
|
||||
'renderer/soft_break',
|
||||
'xml',
|
||||
'xml/max_indentation_level',
|
||||
'commonmark',
|
||||
'commonmark/enable_em',
|
||||
'commonmark/enable_strong',
|
||||
|
|
|
|||
43
vendor/league/commonmark/CHANGELOG.md
vendored
43
vendor/league/commonmark/CHANGELOG.md
vendored
|
|
@ -6,6 +6,45 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
|
|||
|
||||
## [Unreleased][unreleased]
|
||||
|
||||
## [2.9.0] - 2026-08-03
|
||||
|
||||
This is a **security release** to address five denial of service vulnerabilities and one cross-site scripting (XSS) vulnerability.
|
||||
|
||||
### Added
|
||||
|
||||
- Added a new `NormalizeHeadingsExtension` to constrain headings to a configured level range (#989)
|
||||
- Rewrites headings that skip levels so the resulting HTML is valid (#1115)
|
||||
- `normalize_headings/rebase_to_min_level` - rebases each document so its headings begin at `min_level`
|
||||
- Added a new `footnote/enable_inline_footnotes` config option to disable the inline `^[Footnote text]` syntax (#1112)
|
||||
- Added `Cursor::getBytePosition()` for obtaining the cursor's current byte offset within the line
|
||||
- Added a new `xml/max_indentation_level` config option to control how far `XmlRenderer` indents nested elements (default: `16`; set to `0` for unindented output)
|
||||
|
||||
### Changed
|
||||
|
||||
- The `FootnoteExtension` now uses only the first definition of a footnote label, removing any duplicate definitions instead of rendering them in place
|
||||
- `NumberFootnotesListener` now stores footnote backrefs under a single `footnote/backrefs` key in the document data instead of one key per footnote destination
|
||||
- Optimized `Cursor` to translate character positions to byte offsets in constant time instead of re-decoding the line with `mb_substr()`
|
||||
- Optimized `Cursor::match()` to match against the line at the cursor's byte offset instead of copying the remaining line on every call
|
||||
- Optimized `InlineParserEngine` and `UrlAutolinkParser` to work with byte offsets directly
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed quadratic parsing performance on lines containing multibyte characters, which could be abused to cause a denial of service (GHSA-2q4p-g7hv-5rgv)
|
||||
- Fixed the unsafe link filter failing to detect dangerous schemes obfuscated with embedded tabs, newlines, or leading control characters (such as `java<TAB>script:`), which allowed the `allow_unsafe_links` protection to be bypassed via `href` and `src` attributes (GHSA-29pj-957v-52mc)
|
||||
- Fixed duplicate footnote definitions each claiming the full list of backrefs for their label, causing a quadratic number of backrefs to be generated, which could be abused to cause a denial of service (GHSA-jfm3-95jq-q3rf)
|
||||
- Fixed footnote labels being treated as `.`/`/`-delimited key paths when storing backrefs, which allowed distinct labels such as `[^a.b]` and `[^a/b]` to share a single backref list (GHSA-jfm3-95jq-q3rf)
|
||||
- Fixed a fatal error when one footnote label was a prefix of another, such as `[^a]` and `[^a.b]`
|
||||
- Fixed the unique slug normalizer restarting its suffix search from `1` on every collision, causing headings or inline footnotes which normalize to the same slug to be de-duplicated in quadratic time, which could be abused to cause a denial of service (GHSA-mh25-x5hq-wrqp)
|
||||
- Fixed the `AttributesExtension` scanning the remaining siblings of an inline attribute which can only apply to its parent block, causing long runs of adjacent inline attributes to be resolved in quadratic time, which could be abused to cause a denial of service (GHSA-g2gp-3wwq-f4ph)
|
||||
- Fixed `XmlRenderer` indenting every element by its full nesting depth without any upper bound, causing deeply-nested documents to render as quadratically-sized XML, which could be abused to cause a denial of service (GHSA-mj63-m3rc-8ppr)
|
||||
- Fixed `MarkDelimiterProcessor` not being declared as a `CacheableDelimiterProcessorInterface`, preventing the delimiter stack from caching the opener search for `==` runs (#1133)
|
||||
|
||||
## [2.8.3] - 2026-07-12
|
||||
|
||||
### Fixed
|
||||
- Fixed tab-indented fenced code blocks inside list items losing the first character of each line and having their info string mangled (#981, #1130)
|
||||
- Fixed the unsafe link filter incorrectly blocking safe URLs containing `vbscript:`, `file:`, or `data:` anywhere after the start (#1131)
|
||||
|
||||
## [2.8.2] - 2026-03-19
|
||||
|
||||
This is a **security release** to address an issue where the `allowed_domains` setting for the `Embed` extension can be bypassed, resulting in a possible SSRF and XSS vulnerabilities.
|
||||
|
|
@ -732,7 +771,9 @@ No changes were introduced since the previous release.
|
|||
- Alternative 1: Use `CommonMarkConverter` or `GithubFlavoredMarkdownConverter` if you don't need to customize the environment
|
||||
- Alternative 2: Instantiate a new `Environment` and add the necessary extensions yourself
|
||||
|
||||
[unreleased]: https://github.com/thephpleague/commonmark/compare/2.8.2...HEAD
|
||||
[unreleased]: https://github.com/thephpleague/commonmark/compare/2.9.0...HEAD
|
||||
[2.9.0]: https://github.com/thephpleague/commonmark/compare/2.8.3...2.9.0
|
||||
[2.8.3]: https://github.com/thephpleague/commonmark/compare/2.8.2...2.8.3
|
||||
[2.8.2]: https://github.com/thephpleague/commonmark/compare/2.8.1...2.8.2
|
||||
[2.8.1]: https://github.com/thephpleague/commonmark/compare/2.8.0...2.8.1
|
||||
[2.8.0]: https://github.com/thephpleague/commonmark/compare/2.7.1...2.8.0
|
||||
|
|
|
|||
1
vendor/league/commonmark/README.md
vendored
1
vendor/league/commonmark/README.md
vendored
|
|
@ -181,6 +181,7 @@ We'd also like to extend our sincere thanks the following sponsors who support o
|
|||
- [Tidelift](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme) for offering support to both the maintainers and end-users through their [professional support](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme) program
|
||||
- [Blackfire](https://www.blackfire.io/) for providing an Open-Source Profiler subscription
|
||||
- [JetBrains](https://www.jetbrains.com/) for supporting this project with complimentary [PhpStorm](https://www.jetbrains.com/phpstorm/) licenses
|
||||
- [Anthropic](https://www.anthropic.com/) for providing complimentary access to Claude Max through their [Open Source Program](https://claude.com/contact-sales/claude-for-oss)
|
||||
|
||||
Are you interested in sponsoring development of this project? See <https://www.colinodell.com/sponsor> for a list of ways to contribute.
|
||||
|
||||
|
|
|
|||
6
vendor/league/commonmark/composer.json
vendored
6
vendor/league/commonmark/composer.json
vendored
|
|
@ -39,8 +39,8 @@
|
|||
"github/gfm": "0.29.0",
|
||||
"michelf/php-markdown": "^1.4 || ^2.0",
|
||||
"nyholm/psr7": "^1.5",
|
||||
"phpstan/phpstan": "^1.8.2",
|
||||
"phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",
|
||||
"phpstan/phpstan": "^2.0.0",
|
||||
"phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0 || ^12.0.0 || ^13.0.0",
|
||||
"scrutinizer/ocular": "^1.8.1",
|
||||
"symfony/finder": "^5.3 | ^6.0 | ^7.0 || ^8.0",
|
||||
"symfony/process": "^5.4 | ^6.0 | ^7.0 || ^8.0",
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.9-dev"
|
||||
"dev-main": "2.10-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ final class DelimiterStack
|
|||
/** @psalm-suppress PropertyTypeCoercion */
|
||||
$this->missingIndexCache = new \WeakMap(); // @phpstan-ignore-line
|
||||
} else {
|
||||
$this->missingIndexCache = new \SplObjectStorage(); // @phpstan-ignore-line
|
||||
$this->missingIndexCache = new \SplObjectStorage();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -438,6 +438,9 @@ final class Environment implements EnvironmentInterface, EnvironmentBuilderInter
|
|||
'inner_separator' => Expect::string("\n"),
|
||||
'soft_break' => Expect::string("\n"),
|
||||
]),
|
||||
'xml' => Expect::structure([
|
||||
'max_indentation_level' => Expect::int()->min(0)->default(16),
|
||||
]),
|
||||
'slug_normalizer' => Expect::structure([
|
||||
'instance' => Expect::type(TextNormalizerInterface::class)->default(new SlugNormalizer()),
|
||||
'max_length' => Expect::int()->min(0)->default(255),
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue