Skip to content

Commit

Permalink
fix: format diagram for mermaid shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jul 2, 2024
1 parent fd07584 commit 52d3f51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions layouts/_default/_markup/render-codeblock-mermaid-frame.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ $path := md5 .Inner | printf "mermaid/%s" }}
{{ $diagram := resources.Get "hugomods/mermaid/diagram.html" | resources.ExecuteAsTemplate $path . }}
<iframe src="{{ $diagram.RelPermalink }}"></iframe>
2 changes: 1 addition & 1 deletion layouts/shortcodes/mermaid.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ .Page.Store.Set "hasMermaid" true -}}
<pre class="mermaid">
{{- .Inner | safeHTML -}}
{{- .Inner | replaceRE "\n" "\n\t" -}}
</pre>

0 comments on commit 52d3f51

Please sign in to comment.