diff --git a/layouts/_default/_markup/render-codeblock-echarts.html b/layouts/_default/_markup/render-codeblock-echarts.html index 00c669c2..1a519c8e 100644 --- a/layouts/_default/_markup/render-codeblock-echarts.html +++ b/layouts/_default/_markup/render-codeblock-echarts.html @@ -1 +1,2 @@ {{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/echarts.html" -}} +{{- .Page.Store.Set "hasEcharts" true -}} diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html index 79b23615..cb0afbc3 100644 --- a/layouts/_default/_markup/render-codeblock-mermaid.html +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -1,5 +1,2 @@ -
-  {{- .Inner | safeHTML }}
-
- +{{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/mermaid.html" -}} {{- .Page.Store.Set "hasMermaid" true -}} diff --git a/layouts/partials/plugin/echarts.html b/layouts/partials/plugin/echarts.html index df6a2718..10b646c1 100644 --- a/layouts/partials/plugin/echarts.html +++ b/layouts/partials/plugin/echarts.html @@ -4,4 +4,4 @@ {{- $attrs := printf `style="width: %v; height: %v;"` $width $height -}}
-{{- page.Store.Set "hasEcharts" true -}} +{{- /* EOF */ -}} diff --git a/layouts/partials/plugin/mermaid.html b/layouts/partials/plugin/mermaid.html new file mode 100644 index 00000000..8f6f2ed6 --- /dev/null +++ b/layouts/partials/plugin/mermaid.html @@ -0,0 +1,4 @@ +{{- /* Mermaid support for code fences extended and shortcodes. */ -}} +
{{ .Inner | safeHTML }}
+ +{{- /* EOF */ -}} diff --git a/layouts/shortcodes/echarts.html b/layouts/shortcodes/echarts.html index 3ce66b61..a250074e 100644 --- a/layouts/shortcodes/echarts.html +++ b/layouts/shortcodes/echarts.html @@ -1,3 +1,4 @@ {{- $options := .Get "width" | default (.Get 0) | dict "width" -}} {{- $options = .Get "height" | default (.Get 1) | dict "height" | merge $options -}} {{- dict "Options" $options "Inner" .Inner | partial "plugin/echarts.html" -}} +{{- .Page.Store.Set "hasEcharts" true -}} diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html index 79b23615..878e3b8c 100644 --- a/layouts/shortcodes/mermaid.html +++ b/layouts/shortcodes/mermaid.html @@ -1,5 +1,3 @@ -
-  {{- .Inner | safeHTML }}
-
- +{{- $options := dict -}} +{{- dict "Options" $options "Inner" .Inner | partial "plugin/mermaid.html" -}} {{- .Page.Store.Set "hasMermaid" true -}}