From a0c0e9eb55237fdcda13f98ccc9bb653832f5983 Mon Sep 17 00:00:00 2001
From: Xavier Lacot
Date: Thu, 8 Feb 2024 18:12:46 +0100
Subject: [PATCH 1/7] add a test with valid CSS level 3 selectors
---
.../Extension/Attributes/data/class_names.html | 6 ++++++
.../Extension/Attributes/data/class_names.md | 17 +++++++++++++++++
2 files changed, 23 insertions(+)
create mode 100644 tests/functional/Extension/Attributes/data/class_names.html
create mode 100644 tests/functional/Extension/Attributes/data/class_names.md
diff --git a/tests/functional/Extension/Attributes/data/class_names.html b/tests/functional/Extension/Attributes/data/class_names.html
new file mode 100644
index 0000000000..e92bcd308b
--- /dev/null
+++ b/tests/functional/Extension/Attributes/data/class_names.html
@@ -0,0 +1,6 @@
+Some text
+Some text
+Some text
+Some text
+Some text
+Some text
diff --git a/tests/functional/Extension/Attributes/data/class_names.md b/tests/functional/Extension/Attributes/data/class_names.md
new file mode 100644
index 0000000000..25ee4f5a5d
--- /dev/null
+++ b/tests/functional/Extension/Attributes/data/class_names.md
@@ -0,0 +1,17 @@
+{class="some-class(value)"}
+Some text
+
+{.some-class(value)}
+Some text
+
+{.-hello}
+Some text
+
+{.smile-😎 .some-class}
+Some text
+
+{id="smile-😎"}
+Some text
+
+{#smile-😎}
+Some text
From 3d76b7fd46da81c70811f72625d29c293a329000 Mon Sep 17 00:00:00 2001
From: Xavier Lacot
Date: Thu, 8 Feb 2024 18:15:15 +0100
Subject: [PATCH 2/7] allow valid CSS level 3 selectors for classes and ids in
the attributes extension
---
src/Extension/Attributes/Util/AttributesHelper.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Extension/Attributes/Util/AttributesHelper.php b/src/Extension/Attributes/Util/AttributesHelper.php
index de5c111e1d..41171fae7e 100644
--- a/src/Extension/Attributes/Util/AttributesHelper.php
+++ b/src/Extension/Attributes/Util/AttributesHelper.php
@@ -23,7 +23,7 @@
*/
final class AttributesHelper
{
- private const SINGLE_ATTRIBUTE = '\s*([.#][_a-z0-9-]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
+ private const SINGLE_ATTRIBUTE = '\s*([.]-?[_a-z]\S*|[#]\S+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
private const ATTRIBUTE_LIST = '/^{:?(' . self::SINGLE_ATTRIBUTE . ')+}/i';
/**
From 3bc81377e448e8dcd9a0f374f3149e8d31da0314 Mon Sep 17 00:00:00 2001
From: Nick
Date: Thu, 21 Mar 2024 14:20:49 -0400
Subject: [PATCH 3/7] Update embed.md
Changed an instance of `composer install` to `composer require`.
---
docs/2.4/extensions/embed.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/2.4/extensions/embed.md b/docs/2.4/extensions/embed.md
index 244e5b5d42..0755d95bc4 100644
--- a/docs/2.4/extensions/embed.md
+++ b/docs/2.4/extensions/embed.md
@@ -107,7 +107,7 @@ We do provide an adapter for the popular [`embed/embed`](https://github.com/osca
because it supports fetching multiple URLs in parallel, which is ideal for performance, and it supports a wide range
of embeddable content.
-To use that library, you'll need to `composer install embed/embed` and then pass `new OscaroteroEmbedAdapter()` as the `adapter`
+To use that library, you'll need to `composer require embed/embed` and then pass `new OscaroteroEmbedAdapter()` as the `adapter`
configuration option, as shown in the [**Usage**](#usage) section above.
Need to customize the maximum width/height of the embedded content? You can do that by instantiating the service provided by
From da459bb2c52b0857df2373f8c3d95299295c5607 Mon Sep 17 00:00:00 2001
From: Andrew Minion
Date: Wed, 22 May 2024 11:48:05 -0500
Subject: [PATCH 4/7] add failing test
---
tests/functional/Extension/Autolink/UrlAutolinkParserTest.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php
index 0057b68bfd..ddca1bcc71 100644
--- a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php
+++ b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php
@@ -71,6 +71,7 @@ public static function dataProviderForAutolinkTests(): iterable
yield ['(www.google.com/search?q=Markup+(business)', '(www.google.com/search?q=Markup+(business)
'];
yield ['www.google.com/search?q=(business))+ok', 'www.google.com/search?q=(business))+ok
'];
yield ['(https://www.example.com/test).', '(https://www.example.com/test).
'];
+ yield ['WWW text followed by [link](https://example.com/)', 'WWW text followed by link
'];
// Tests involving semi-colon endings
yield ['www.google.com/search?q=commonmark&hl=en', 'www.google.com/search?q=commonmark&hl=en
'];
From 6ab9ee07452b7ad8ad969fb01d9926aa309c67fa Mon Sep 17 00:00:00 2001
From: Andrew Minion
Date: Wed, 22 May 2024 11:56:15 -0500
Subject: [PATCH 5/7] improve test to make breaking behavior more visible
#1025
---
tests/functional/Extension/Autolink/UrlAutolinkParserTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php
index ddca1bcc71..30ea154332 100644
--- a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php
+++ b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php
@@ -71,7 +71,7 @@ public static function dataProviderForAutolinkTests(): iterable
yield ['(www.google.com/search?q=Markup+(business)', '(www.google.com/search?q=Markup+(business)
'];
yield ['www.google.com/search?q=(business))+ok', 'www.google.com/search?q=(business))+ok
'];
yield ['(https://www.example.com/test).', '(https://www.example.com/test).
'];
- yield ['WWW text followed by [link](https://example.com/)', 'WWW text followed by link
'];
+ yield ['WWW text followed by a [link](https://example.com/foo-bar-test)', 'WWW text followed by a link
'];
// Tests involving semi-colon endings
yield ['www.google.com/search?q=commonmark&hl=en', 'www.google.com/search?q=commonmark&hl=en
'];
From 41403348f06ddf13500757d4b54856a82a74af94 Mon Sep 17 00:00:00 2001
From: Andrew Minion
Date: Wed, 22 May 2024 11:57:00 -0500
Subject: [PATCH 6/7] fix text containing www and following link
#1025
---
src/Extension/Autolink/UrlAutolinkParser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Extension/Autolink/UrlAutolinkParser.php b/src/Extension/Autolink/UrlAutolinkParser.php
index f44da3357e..0d8f6a97e4 100644
--- a/src/Extension/Autolink/UrlAutolinkParser.php
+++ b/src/Extension/Autolink/UrlAutolinkParser.php
@@ -56,7 +56,7 @@ final class UrlAutolinkParser implements InlineParserInterface
*
* @psalm-readonly
*/
- private array $prefixes = ['www'];
+ private array $prefixes = ['www.'];
/**
* @psalm-var non-empty-string
From b7a7af3a23a818dcc5836e62e93e4b9ce4704481 Mon Sep 17 00:00:00 2001
From: Colin O'Dell
Date: Mon, 22 Jul 2024 08:31:21 -0400
Subject: [PATCH 7/7] Prepare to release 2.4.3
---
CHANGELOG.md | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 481fb22042..1045aa0885 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,13 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
## [Unreleased][unreleased]
+## [2.4.3] - 2024-07-22
+
+### Fixed
+
+- Fixed the Attributes extension not supporting CSS level 3 selectors (#1013)
+- Fixed `UrlAutolinkParser` incorrectly parsing text containing `www` anywhere before an autolink (#1025)
+
## [2.4.2] - 2024-02-02
### Fixed
@@ -567,7 +574,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.4.2...main
+[unreleased]: https://github.com/thephpleague/commonmark/compare/2.4.3...main
+[2.4.3]: https://github.com/thephpleague/commonmark/compare/2.4.2...2.4.3
[2.4.2]: https://github.com/thephpleague/commonmark/compare/2.4.1...2.4.2
[2.4.1]: https://github.com/thephpleague/commonmark/compare/2.4.0...2.4.1
[2.4.0]: https://github.com/thephpleague/commonmark/compare/2.3.9...2.4.0