♻️ Refactor: mermaid shortcode and codeblock render

This commit is contained in:
Cell
2024-07-21 20:03:32 +08:00
parent 2a53dbac37
commit f44d89a52a
6 changed files with 10 additions and 9 deletions
@@ -1 +1,2 @@
{{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/echarts.html" -}}
{{- .Page.Store.Set "hasEcharts" true -}}
@@ -1,5 +1,2 @@
<pre class="mermaid">
{{- .Inner | safeHTML }}
</pre>
<template>{{- .Inner | safeHTML }}</template>
{{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/mermaid.html" -}}
{{- .Page.Store.Set "hasMermaid" true -}}
+1 -1
View File
@@ -4,4 +4,4 @@
{{- $attrs := printf `style="width: %v; height: %v;"` $width $height -}}
<div class="echarts" {{ $attrs | safeHTMLAttr }}></div>
<template>{{ .Inner | transform.Unmarshal | jsonify }}</template>
{{- page.Store.Set "hasEcharts" true -}}
{{- /* EOF */ -}}
+4
View File
@@ -0,0 +1,4 @@
{{- /* Mermaid support for code fences extended and shortcodes. */ -}}
<pre class="mermaid">{{ .Inner | safeHTML }}</pre>
<template>{{ .Inner | safeHTML }}</template>
{{- /* EOF */ -}}
+1
View File
@@ -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 -}}
+2 -4
View File
@@ -1,5 +1,3 @@
<pre class="mermaid">
{{- .Inner | safeHTML }}
</pre>
<template>{{- .Inner | safeHTML }}</template>
{{- $options := dict -}}
{{- dict "Options" $options "Inner" .Inner | partial "plugin/mermaid.html" -}}
{{- .Page.Store.Set "hasMermaid" true -}}