Skip to content

Commit

Permalink
Merge pull request #1041 from thephpleague/commonmark-0.31.1
Browse files Browse the repository at this point in the history
commonmark 0.31.1 compatibility
  • Loading branch information
colinodell authored Aug 16, 2024
2 parents df09d5b + e41a23d commit ac01aa5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

## [Unreleased][unreleased]

### Changed

- Made compatible with CommonMark spec 0.31.1, including:
- Remove `source`, add `search` to list of recognized block tags

## [2.5.2] - 2024-08-14

### Changed
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"require-dev": {
"ext-json": "*",
"cebe/markdown": "^1.0",
"commonmark/cmark": "0.31.0",
"commonmark/commonmark.js": "0.31.0",
"commonmark/cmark": "0.31.1",
"commonmark/commonmark.js": "0.31.1",
"composer/package-versions-deprecated": "^1.8",
"embed/embed": "^4.4",
"erusev/parsedown": "^1.0",
Expand All @@ -56,9 +56,9 @@
"type": "package",
"package": {
"name": "commonmark/commonmark.js",
"version": "0.31.0",
"version": "0.31.1",
"dist": {
"url": "https://github.com/commonmark/commonmark.js/archive/0.31.0.zip",
"url": "https://github.com/commonmark/commonmark.js/archive/0.31.1.zip",
"type": "zip"
}
}
Expand All @@ -67,9 +67,9 @@
"type": "package",
"package": {
"name": "commonmark/cmark",
"version": "0.31.0",
"version": "0.31.1",
"dist": {
"url": "https://github.com/commonmark/cmark/archive/0.31.0.zip",
"url": "https://github.com/commonmark/cmark/archive/0.31.1.zip",
"type": "zip"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Util/RegexHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class RegexHelper
public const PARTIAL_REG_CHAR = '[^\\\\()\x00-\x20]';
public const PARTIAL_IN_PARENS_NOSP = '\((' . self::PARTIAL_REG_CHAR . '|' . self::PARTIAL_ESCAPED_CHAR . '|\\\\)*\)';
public const PARTIAL_TAGNAME = '[a-z][a-z0-9-]*';
public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)';
public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)';
public const PARTIAL_ATTRIBUTENAME = '[a-z_:][a-z0-9:._-]*';
public const PARTIAL_UNQUOTEDVALUE = '[^"\'=<>`\x00-\x20]+';
public const PARTIAL_SINGLEQUOTEDVALUE = '\'[^\']*\'';
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/CMarkRegressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public static function dataProvider(): \Generator
$example['output'] = \str_replace('</script></li>', "</script>\n</li>", $example['output']);
}

// The case-fold test from example 21 fails on PHP 8.0.* and below due to the behavior of mb_convert_case().
// See https://3v4l.org/7TeXJ.
if (\PHP_VERSION_ID < 81000 && $example['number'] === 21) {
continue;
}

yield $example;
}
}
Expand Down

0 comments on commit ac01aa5

Please sign in to comment.