mirror of
https://github.com/docker/docs.git
synced 2026-06-19 07:35:16 +00:00
Merge pull request #25178 from dvdksn/mermaid-codeblock-hook
layouts: render mermaid code blocks as diagrams
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{{- .Page.Store.Set "mermaid" true -}}
|
||||
<pre
|
||||
class="mermaid not-prose my-4 flex justify-center bg-transparent"
|
||||
data-pagefind-ignore
|
||||
>{{- .Inner -}}</pre>
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ $mermaid := resources.Get "js/mermaid.js"
|
||||
| js.Build (dict "minify" true "targetPath" "mermaid.js")
|
||||
}}
|
||||
<script defer src="{{ $mermaid.Permalink }}"></script>
|
||||
@@ -95,5 +95,9 @@
|
||||
{{ with .Store.Get "youtube" }}
|
||||
{{ partialCached "youtube-script.html" "-" "-" }}
|
||||
{{ end }}
|
||||
{{/* Load mermaid if the page contains a mermaid code block */}}
|
||||
{{ with .Store.Get "mermaid" }}
|
||||
{{ partialCached "mermaid-script.html" "-" "-" }}
|
||||
{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user