Skip to content

Commit

Permalink
Merge branch '2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
colinodell committed Sep 8, 2024
2 parents 7d06b89 + 06e7fda commit 4509fb3
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 13 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

## [Unreleased][unreleased]

## [2.5.3] - 2024-08-16

### 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 Expand Up @@ -624,7 +631,8 @@ 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.5.2...main
[unreleased]: https://github.com/thephpleague/commonmark/compare/2.5.3...main
[2.5.3]: https://github.com/thephpleague/commonmark/compare/2.5.2...2.5.3
[2.5.2]: https://github.com/thephpleague/commonmark/compare/2.5.1...2.5.2
[2.5.1]: https://github.com/thephpleague/commonmark/compare/2.5.0...2.5.1
[2.5.0]: https://github.com/thephpleague/commonmark/compare/2.4.4...2.5.0
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ 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
- [Taylor Otwell](https://twitter.com/taylorotwell) for sponsoring this project through GitHub sponsors

Are you interested in sponsoring development of this project? See <https://www.colinodell.com/sponsor> for a list of ways to contribute.

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 docs/2.5/extensions/autolinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use League\CommonMark\MarkdownConverter;
$config = [
'autolink' => [
'allowed_protocols' => ['https'], // defaults to ['https', 'http', 'ftp']
'default_protocols' => 'https', // defaults to 'http'
'default_protocol' => 'https', // defaults to 'http'
],
];

Expand Down
6 changes: 6 additions & 0 deletions docs/2.5/extensions/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ of embeddable content.
To use that library, you'll need to `composer install embed/embed` and then pass `new OscaroteroEmbedAdapter()` as the `adapter`
configuration option, as shown in the [**Usage**](#usage) section above.

Note: `embed/embed` *requires* a PSR-17 implementation to be installed. If you do not have one installed, the library will not work. By default these libraries are detected automatically:
* [laminas/laminas-diactoros](https://github.com/laminas/laminas-diactoros)
* [guzzle/psr7](https://github.com/guzzle/psr7)
* [nyholm/psr7](https://github.com/Nyholm/psr7)
* [sunrise/http-message](https://github.com/sunrise-php/http-message)

Need to customize the maximum width/height of the embedded content? You can do that by instantiating the service provided by
`embed/embed`, [configuring it as needed](https://github.com/oscarotero/Embed#settings), and passing that customized instance into the adapter:

Expand Down
2 changes: 1 addition & 1 deletion docs/2.5/extensions/footnotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $environment->addExtension(new FootnoteExtension());

// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
echo $converter->convert('# Hello World!');
echo $converter->convert("This is a footnote[^test] test.\n\n[^test]: Doesn't it look good!");
```

## Configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/2.6/extensions/autolinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use League\CommonMark\MarkdownConverter;
$config = [
'autolink' => [
'allowed_protocols' => ['https'], // defaults to ['https', 'http', 'ftp']
'default_protocols' => 'https', // defaults to 'http'
'default_protocol' => 'https', // defaults to 'http'
],
];

Expand Down
6 changes: 6 additions & 0 deletions docs/2.6/extensions/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ of embeddable content.
To use that library, you'll need to `composer install embed/embed` and then pass `new OscaroteroEmbedAdapter()` as the `adapter`
configuration option, as shown in the [**Usage**](#usage) section above.

Note: `embed/embed` *requires* a PSR-17 implementation to be installed. If you do not have one installed, the library will not work. By default these libraries are detected automatically:
* [laminas/laminas-diactoros](https://github.com/laminas/laminas-diactoros)
* [guzzle/psr7](https://github.com/guzzle/psr7)
* [nyholm/psr7](https://github.com/Nyholm/psr7)
* [sunrise/http-message](https://github.com/sunrise-php/http-message)

Need to customize the maximum width/height of the embedded content? You can do that by instantiating the service provided by
`embed/embed`, [configuring it as needed](https://github.com/oscarotero/Embed#settings), and passing that customized instance into the adapter:

Expand Down
2 changes: 1 addition & 1 deletion docs/2.6/extensions/footnotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $environment->addExtension(new FootnoteExtension());

// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
echo $converter->convert('# Hello World!');
echo $converter->convert("This is a footnote[^test] test.\n\n[^test]: Doesn't it look good!");
```

## Configuration
Expand Down
1 change: 1 addition & 0 deletions src/Parser/Cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public function advanceToNextNonSpaceOrNewline(): int

// [0][0] contains the matched text
// [0][1] contains the index of that match
\assert(isset($matches[0]));
$increment = $matches[0][1] + \strlen($matches[0][0]);

$this->advanceBy($increment);
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
1 change: 1 addition & 0 deletions src/Util/SpecReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static function read(string $data): iterable
$exampleNumber = 0;

foreach ($matches as $match) {
\assert(isset($match[1], $match[2], $match[3]));
if (isset($match[4])) {
$currentSection = $match[4];
continue;
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 4509fb3

Please sign in to comment.