From a17ed29842491c3da5ac0322e909a0fbd154f1ed Mon Sep 17 00:00:00 2001 From: DualFroz Date: Thu, 27 Aug 2026 23:37:32 +0200 Subject: [PATCH] fix: accept unordered_list_markers config in InlinesOnlyExtension The unordered_list_markers option is declared in the shared 'commonmark' config schema by CommonMarkCoreExtension, but InlinesOnlyExtension did not declare it in its own schema for the same 'commonmark' namespace. Setting the option while using InlinesOnlyExtension therefore failed schema validation with 'Unexpected item commonmark unordered_list_markers'. Declare the option in InlinesOnlyExtension using the same definition so it is accepted. InlinesOnlyExtension does not render lists, so this only makes the option valid without changing rendering behaviour. Adds a regression test asserting the option is accepted and rendering still works. Closes #1015 --- .../InlinesOnly/InlinesOnlyExtension.php | 1 + .../InlinesOnly/InlinesOnlyFunctionalTest.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Extension/InlinesOnly/InlinesOnlyExtension.php b/src/Extension/InlinesOnly/InlinesOnlyExtension.php index 7777510..f85fad5 100644 --- a/src/Extension/InlinesOnly/InlinesOnlyExtension.php +++ b/src/Extension/InlinesOnly/InlinesOnlyExtension.php @@ -30,6 +30,7 @@ final class InlinesOnlyExtension implements ConfigurableExtensionInterface 'use_underscore' => Expect::bool(true), 'enable_strong' => Expect::bool(true), 'enable_em' => Expect::bool(true), + 'unordered_list_markers' => Expect::listOf('string')->min(1)->default(['*', '+', '-'])->mergeDefaults(false), ])); } diff --git a/tests/functional/Extension/InlinesOnly/InlinesOnlyFunctionalTest.php b/tests/functional/Extension/InlinesOnly/InlinesOnlyFunctionalTest.php index 8b06183..60b55a3 100644 --- a/tests/functional/Extension/InlinesOnly/InlinesOnlyFunctionalTest.php +++ b/tests/functional/Extension/InlinesOnly/InlinesOnlyFunctionalTest.php @@ -64,4 +64,20 @@ final class InlinesOnlyFunctionalTest extends TestCase [$markdown, $html], ]; } + + /** + * InlinesOnlyExtension reuses the shared 'commonmark' config schema, so the + * option must be accepted even though it renders no lists. + * + * @see https://github.com/thephpleague/commonmark/issues/1015 + */ + public function testUnorderedListMarkersConfigIsAccepted(): void + { + $environment = new Environment(['commonmark' => ['unordered_list_markers' => ['*']]]); + $environment->addExtension(new InlinesOnlyExtension()); + $converter = new MarkdownConverter($environment); + + $this->assertSame(['*'], $environment->getConfiguration()->get('commonmark/unordered_list_markers')); + $this->assertSame('foo', \trim($converter->convert('*foo*')->getContent())); + } }