diff --git a/src/Illuminate/Support/Stringable.php b/src/Illuminate/Support/Stringable.php index 3410dc43b1d9..27bf7e50ca23 100644 --- a/src/Illuminate/Support/Stringable.php +++ b/src/Illuminate/Support/Stringable.php @@ -454,11 +454,12 @@ public function lower() * Convert GitHub flavored Markdown into HTML. * * @param array $options + * @param array $extensions * @return static */ - public function markdown(array $options = []) + public function markdown(array $options = [], array $extensions = []) { - return new static(Str::markdown($this->value, $options)); + return new static(Str::markdown($this->value, $options, $extensions)); } /** diff --git a/tests/Support/SupportStringableTest.php b/tests/Support/SupportStringableTest.php index a1de110b6fc7..e7978bd2c4fc 100644 --- a/tests/Support/SupportStringableTest.php +++ b/tests/Support/SupportStringableTest.php @@ -6,6 +6,8 @@ use Illuminate\Support\Collection; use Illuminate\Support\HtmlString; use Illuminate\Support\Stringable; +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\ExtensionInterface; use PHPUnit\Framework\TestCase; class SupportStringableTest extends TestCase @@ -1130,6 +1132,18 @@ public function testMarkdown() { $this->assertEquals("

hello world

\n", $this->stringable('*hello world*')->markdown()); $this->assertEquals("

hello world

\n", $this->stringable('# hello world')->markdown()); + + $extension = new class implements ExtensionInterface + { + public bool $configured = false; + + public function register(EnvironmentBuilderInterface $environment): void + { + $this->configured = true; + } + }; + $this->stringable('# hello world')->markdown([], [$extension]); + $this->assertTrue($extension->configured); } public function testInlineMarkdown()