From 9aea82754d931e9b274e6b2c69f3540a20bc1bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Fri, 22 Dec 2023 10:01:14 +0100 Subject: [PATCH] feat: Markdown figure --- composer.json | 1 + config/services.yaml | 3 +++ tests/functional/site/content/articles/hello-world.md | 4 ++++ .../site/fixtures/en/article/hello-world/index.html | 2 ++ 4 files changed, 10 insertions(+) diff --git a/composer.json b/composer.json index 2a87403..c3eb476 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "php": "^8.2", "ext-zlib": "*", "bentools/cartesian-product": "^1.4", + "jsw/commonmark-figure-extension": "^1.1", "league/commonmark": "^2.3", "phpdocumentor/type-resolver": "^1.0", "phpstan/phpdoc-parser": "^1.0", diff --git a/config/services.yaml b/config/services.yaml index faf686d..7d5f272 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -109,6 +109,7 @@ services: League\CommonMark\Extension\Attributes\AttributesExtension: ~ League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension: ~ League\CommonMark\Extension\TableOfContents\TableOfContentsExtension: ~ + JSW\Figure\FigureExtension: ~ Spatie\CommonMarkHighlighter\FencedCodeRenderer: ~ Spatie\CommonMarkHighlighter\IndentedCodeRenderer: ~ @@ -129,6 +130,8 @@ services: addExtension: [ '@League\CommonMark\Extension\Footnote\FootnoteExtension' ] - addExtension: [ '@League\CommonMark\Extension\Attributes\AttributesExtension' ] + - + addExtension: [ '@JSW\Figure\FigureExtension' ] - addRenderer: [ League\CommonMark\Extension\CommonMark\Node\Block\FencedCode, '@Spatie\CommonMarkHighlighter\FencedCodeRenderer', 10 ] - diff --git a/tests/functional/site/content/articles/hello-world.md b/tests/functional/site/content/articles/hello-world.md index 3d32e0b..1d4ba9c 100644 --- a/tests/functional/site/content/articles/hello-world.md +++ b/tests/functional/site/content/articles/hello-world.md @@ -16,3 +16,7 @@ class HelloWorld } } ``` + +^^^ +![example-image](https://picsum.photos/id/237/200/300) +^^^ This is caption for this image diff --git a/tests/functional/site/fixtures/en/article/hello-world/index.html b/tests/functional/site/fixtures/en/article/hello-world/index.html index 6fbc841..e87e39d 100644 --- a/tests/functional/site/fixtures/en/article/hello-world/index.html +++ b/tests/functional/site/fixtures/en/article/hello-world/index.html @@ -26,6 +26,8 @@

Hello World!

} } +

example-image

+
This is caption for this image