mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
mermaid diagrams should use pre blocks #704
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mythz on GitHub (Oct 25, 2024).
The mermaid usage docs says mermaid diagrams should be included within
<pre class="mermaid">blocks.Currently Markdig generates mermaid diagrams:
Within a div block:
But this fails to render with the latest version (v11) of the
mermaidlibrary:But will work if it used a
<pre>tag:Can Markdig be configured to render diagrams in
<pre>blocks?@mythz commented on GitHub (Oct 26, 2024):
Thx for the quick PR, I've tried testing this with the latest v0.38.0 that was just released but this:
Now generates:
With and without
highlight.jsbeing enabled.Not sure what the best way to implement this in the code-base would be, but I've got it working by adding this CodeBlock renderer:
We're using the
.not-proseclass to disable Tailwind Typography styles so we can embed mermaid charts inside@tailwindcss/typographystyled docs.@xoofx commented on GitHub (Oct 26, 2024):
Hm, there is a unit test here so it might be a misusage on your side...
I'm confused, as mermaid is enabled in markdig if you use
.UseDiagrams()extension method on the MarkdownPipelineBuilder (code that handles mermaid is here). How do you enable the mermaid extension method in markdig then?@mythz commented on GitHub (Oct 26, 2024):
Weird, it started working after a clean & reinstall and I can't seem to repro the behavior above. I'm using
.UseAdvancedExtensions()so.UseDiagrams()was already being added.Also looks like the
not-proseclass can be added with:So replacing my temp hack with the default implementation, thx!