Skip to content

Commit

Permalink
feat: Markdown figure
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarlovi committed Dec 22, 2023
1 parent e452343 commit 9aea827
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ~
Expand All @@ -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 ]
-
Expand Down
4 changes: 4 additions & 0 deletions tests/functional/site/content/articles/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ class HelloWorld
}
}
```

^^^
![example-image](https://picsum.photos/id/237/200/300)
^^^ This is caption for this image
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ <h1>Hello World!</h1>
<span class="loc"> }</span>
<span class="loc">}</span>
<span class="loc"></span></code></pre>
<figure><p><img src="https://picsum.photos/id/237/200/300" alt="example-image" /></p>
<figcaption>This is caption for this image</figcaption></figure>

</div>
</div>
Expand Down

0 comments on commit 9aea827

Please sign in to comment.