From efde6331566776c7c178d49413cce99c696f0f74 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Mon, 13 Feb 2023 08:15:07 +0100 Subject: [PATCH] Pull in latest mermaid version by default --- layouts/partials/scripts/mermaid.html | 6 ++---- .../en/docs/adding-content/diagrams-and-formulae/index.md | 2 +- userguide/hugo.yaml | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/layouts/partials/scripts/mermaid.html b/layouts/partials/scripts/mermaid.html index 0b1c4b6309..dfb5e67e3b 100644 --- a/layouts/partials/scripts/mermaid.html +++ b/layouts/partials/scripts/mermaid.html @@ -1,12 +1,10 @@ -{{ $version := "9.3.0" -}} +{{ $version := cond ( ge hugo.Version "0.90.0" ) "latest" "9.3.0" -}} {{ with .Site.Params.mermaid.version -}} {{ $version = . -}} {{ end -}} {{ $cdnurl := printf "https://cdn.jsdelivr.net/npm/mermaid@%s/dist/mermaid.min.js" $version -}} - {{ if ge hugo.Version "0.90.0" -}} -{{ warnf "Mermaid version %s" $version -}} {{ $mermaidjs := resources.GetRemote $cdnurl -}} {{ if eq $mermaidjs nil -}} {{ errorf "Invalid Mermaid version %s, could not retrieve this version from CDN" $version -}} @@ -16,6 +14,6 @@ {{ end }} {{ else -}} - + {{ warnf "Outdated Hugo version %s, consider upgrading to make full use of all theme features" hugo.Version -}} {{ end -}} diff --git a/userguide/content/en/docs/adding-content/diagrams-and-formulae/index.md b/userguide/content/en/docs/adding-content/diagrams-and-formulae/index.md index 59381bd628..61a0fa5649 100644 --- a/userguide/content/en/docs/adding-content/diagrams-and-formulae/index.md +++ b/userguide/content/en/docs/adding-content/diagrams-and-formulae/index.md @@ -367,7 +367,7 @@ graph TD With hugo version 0.93 or higher, support of Mermaid diagrams is automatically enabled as soon as you use a `mermaid` code block on your page. -Mermaid has a very active community and frequently releases new versions, making it difficult for docsy's dev team to catch up with. Fortunately, you can specify your desired mermaid version inside of your `hugo.toml`. Give either give a specific version number (e.g. `9.3.0`) or specify `latest` in order to use the latest released mermaid version. +By default, docsy pulls in the latest officially released version of Mermaid at build time. If that doesn't fit your needs, you can specify the wanted mermaid version inside your `hugo.toml`: {{< tabpane persistLang=false >}} {{< tab header="Hugo version >= 0.90 only:" disabled=true />}} diff --git a/userguide/hugo.yaml b/userguide/hugo.yaml index aba7658722..c2f998e81e 100644 --- a/userguide/hugo.yaml +++ b/userguide/hugo.yaml @@ -116,7 +116,7 @@ params: markmap: enable: true mermaid: - version: latest + version: 9.3.0 theme: default flowchart: diagramPadding: 20