diff --git a/README.md b/README.md index d00e2b5..c037106 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ As well as some additional **features**: - Added `inlineimg` shortcode to render images (e.g. SVGs) in-line - Added support for `![](image title="title")` syntax for image titles - Random, somewhat humorous messages at the end of each post +- Added support for [mermaid](https://mermaid.js.org/) diagrams (*loads via CDN by default, can be set via `mermaidCDN`*) And some **bugfixes**: - Modified the CSS to @@ -86,7 +87,7 @@ cd into your hugo site's root directory and: ```sh cd themes -git submodule add https://github.com/chollinger93/ink-free +git submodule add https://github.com/chollinger93/ink-free ``` For more information read the [official setup guide](https://gohugo.io/overview/installing/) of Hugo. diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 06b7e13..d28bcbf 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -18,6 +18,7 @@ copyright = "© Copyright notice" #avatar = "https://image.freepik.com/free-vector/young-man-head-with-beard-avatar-character_24877-36786.jpg" featherIconsCDN = false + mermaidCDN = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" # Site color - dark/light/auto mode = "auto" @@ -36,7 +37,7 @@ copyright = "© Copyright notice" wpm = 250 # Stupid footers :) - footers = [ + footers = [ "What Tiger King can teach us about x86 Assembly", "10 Reasons why gcc SHOULD be re-written in JavaScript - You won't believe #8!" ] @@ -104,4 +105,4 @@ url = "/index.xml" [markup.tableOfContents] endLevel = 3 ordered = true - startLevel = 2 + startLevel = 2 diff --git a/exampleSite/content/posts/post-6.md b/exampleSite/content/posts/post-6.md index da7d33e..7bddd64 100644 --- a/exampleSite/content/posts/post-6.md +++ b/exampleSite/content/posts/post-6.md @@ -29,6 +29,18 @@ tags: [markdown] {{< vimeo id="146022717" >}} -## Instagram - - +## Mermaid + +```mermaid +sequenceDiagram + participant Alice + participant Bob + Alice->>John: Hello John, how are you? + loop Healthcheck + John->>John: Fight against hypochondria + end + Note right of John: Rational thoughts
prevail! + John-->>Alice: Great! + John->>Bob: How about you? + Bob-->>John: Jolly good! +``` diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..cf56253 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -0,0 +1,4 @@ +
+    {{- .Inner | htmlEscape | safeHTML }}
+  
+{{ .Page.Store.Set "hasMermaid" true }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 4879d94..e819152 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -8,3 +8,39 @@ {{- with .Site.Params.Social -}} {{- end -}} + +{{ if .Store.Get "hasMermaid" }} +{{ $jsUrl:= default "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" .Site.Params.mermaidCDN }} + +{{ end }}