From 260083d10a8aee33c6dc062d1131800b7d001888 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 | 17 +++++++++++++++++ 2 files changed, 18 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..79ca2e3 100644 --- a/tests/functional/Extension/InlinesOnly/InlinesOnlyFunctionalTest.php +++ b/tests/functional/Extension/InlinesOnly/InlinesOnlyFunctionalTest.php @@ -64,4 +64,21 @@ final class InlinesOnlyFunctionalTest extends TestCase [$markdown, $html], ]; } + + /** + * The unordered_list_markers option is part of the shared 'commonmark' config + * schema. InlinesOnlyExtension reuses that config key, so setting the option + * must be accepted even though this extension does not render 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())); + } }