mermaid support

This commit is contained in:
mivinci 2021-08-19 12:42:47 +08:00
parent 0c9211f27b
commit e7eb6932e2
19 changed files with 125 additions and 124 deletions

View file

@ -5,14 +5,14 @@
<main>
<h1>{{ .Title }}</h1>
<div class="sm-1 mtb-1">
Posted at &mdash; {{ dateFormat "Jan 2, 2006" .Date }}
Posted at &mdash; {{ dateFormat .Site.Params.timeformat .Date }}
{{ if .Draft }}
<span class="tag ml-1">
DRAFT
</span>
{{ end }}
</div>
<p>{{ .Description }}</p>
<p>{{ .Description | markdownify | safeHTML }}</p>
<article class="md">
{{ .Content }}
</article>
@ -21,6 +21,10 @@
{{ partial "math.html" . }}
{{ end }}
{{ if or .Params.mermaid .Site.Params.mermaid }}
{{ partial "mermaid.html" . }}
{{ end }}
{{ if and .Params.comment (eq .Site.Params.comment "disqus")}}
{{ partial "disqus.html" . }}
{{ end }}

View file

@ -12,7 +12,7 @@
{{ $paginator := .Paginate (where .Site.RegularPages "Kind" "page") }}
{{ range $paginator.Pages }}
<div class="row row-mob mb-1 mb-1_5-mob gap-3">
<div class="sm-2-mob mb-0_5-mob mw-6">{{ dateFormat "Jan 2, 2006" .Date }}</div>
<div class="sm-2-mob mb-0_5-mob mw-6">{{ dateFormat .Site.Params.timeformat .Date }}</div>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</div>
{{ end }}

View file

@ -19,13 +19,14 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/normalize.css">
{{ $hash := now.Unix }}
{{ $options := (dict "targetPath" (printf `minima.%d.css` $hash) "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
<script src="/js/main.js"></script>
{{ $options := (dict "targetPath" (printf `minima.%d.js` $hash) "minify" true) }}
{{ $js := resources.Get "js/main.js" | js.Build $options }}
<script defer type="text/javascript" src="{{ $js.RelPermalink }}"></script>
</head>
<script>
try {

View file

@ -0,0 +1,4 @@
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>

View file

@ -0,0 +1 @@
<p class="mermaid">{{ safeHTML .Inner }}</p>