feat(mermaid): improve mermaid style and render
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` -}}
|
||||
<div class="align-left">
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
@@ -1,4 +0,0 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` -}}
|
||||
<div class="align-right">
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
5
layouts/shortcodes/align.html
Normal file
5
layouts/shortcodes/align.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` -}}
|
||||
<!-- [left, center, right] -->
|
||||
<div class={{ .Get 0 | printf "align-%s" }}>
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
{{ if .Get "date" -}}
|
||||
{{ $date := .Get "date" }}
|
||||
{{ $id := delimit (split (md5 $date) "" | shuffle) "" | printf "cd-%s" -}}
|
||||
{{ $id := delimit (split (md5 $date) "" | shuffle) "" | printf "countdown-%s" -}}
|
||||
{{ $defaultPattern := printf "%%D %s %%H %s %%M %s %%S %s" (T "day") (T "hour") (T "minute") (T "second") }}
|
||||
{{ $new := dict $id (dict "date" $date "pattern" (.Get "pattern" | default $defaultPattern)) }}
|
||||
{{ with .Page.Scratch.Get "countdownMap" -}}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!-- shuffle md5 as id -->
|
||||
{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "ec-%s" -}}
|
||||
{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "echarts-%s" -}}
|
||||
{{ $echartsMap := .Page.Scratch.Get "echartsMap" -}}
|
||||
{{ if $echartsMap -}}
|
||||
{{ $echartsMap = dict $id .Inner | merge $echartsMap -}}
|
||||
{{ $echartsMap = .Inner | printf "{%s}" | dict $id | merge $echartsMap -}}
|
||||
{{ else -}}
|
||||
{{ $echartsMap = dict $id .Inner -}}
|
||||
{{ $echartsMap = .Inner | printf "{%s}" | dict $id -}}
|
||||
{{ end -}}
|
||||
{{ .Page.Scratch.Set "echartsMap" $echartsMap -}}
|
||||
<div class="echarts" id="{{ $id }}"></div>
|
||||
@@ -1,5 +0,0 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` -}}
|
||||
{{ .Page.Scratch.Set "diagram" "true" }}
|
||||
<div class="mermaid">
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
@@ -1,4 +0,0 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` -}}
|
||||
<div class="float-right">
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
@@ -1,4 +1,5 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` -}}
|
||||
<div class="align-center">
|
||||
<!-- [left, right] -->
|
||||
<div class={{ .Get 0 | printf "float-%s" }}>
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
10
layouts/shortcodes/mermaid.html
Normal file
10
layouts/shortcodes/mermaid.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!-- shuffle md5 as id -->
|
||||
{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "mermaid-%s" -}}
|
||||
{{ $mermaidMap := .Page.Scratch.Get "mermaidMap" -}}
|
||||
{{ if $mermaidMap -}}
|
||||
{{ $mermaidMap = trim .Inner "\n" | dict $id | merge $mermaidMap -}}
|
||||
{{ else -}}
|
||||
{{ $mermaidMap = trim .Inner "\n" | dict $id -}}
|
||||
{{ end -}}
|
||||
{{ .Page.Scratch.Set "mermaidMap" $mermaidMap -}}
|
||||
<div class="mermaid" id="{{ $id }}"></div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- only the trailing newline is retained -->
|
||||
{{ $content := replaceRE `(?s)^\n*(.*?)\n*$` "$1\n" .Inner }}
|
||||
<!-- shuffle md5 as id -->
|
||||
{{ $id := delimit (split (md5 $content) "" | shuffle) "" | printf "tp-%s" }}
|
||||
{{ $id := delimit (split (md5 $content) "" | shuffle) "" | printf "typeit-%s" }}
|
||||
|
||||
<div class={{ .Get "class" | default "typeit" }}>
|
||||
<!-- raw html content -->
|
||||
|
||||
Reference in New Issue
Block a user