Skip to content

Commit

Permalink
Pull in latest mermaid version by default
Browse files Browse the repository at this point in the history
  • Loading branch information
deining committed Mar 13, 2023
1 parent 4804ab5 commit 8e764f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions layouts/partials/scripts/mermaid.html
Original file line number Diff line number Diff line change
@@ -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 -}}
Expand All @@ -16,6 +14,6 @@
</script>
{{ end }}
{{ else -}}
<script src="{{- $cdnurl -}}" integrity="sha512-IX+bU+wShHqfqaMHLMrtwi4nK6W/Z+QdZoL4kPNtRxI2wCLyHPMAdl3a43Fv1Foqv4AP+aiW6hg1dcrTt3xc+Q==" crossorigin="anonymous"></script>
<script src="{{- $cdnurl -}}" integrity="sha512-ku2nmBrzAXY5YwohzTqLYH1/lvyMrpTVxgQKrvTabd/b/uesqltLORdmpVapYv6QhZVCLUX6wkvFaKOAY4xpUA==" crossorigin="anonymous"></script>
{{ warnf "Outdated Hugo version %s, consider upgrading to make full use of all theme features" hugo.Version -}}
{{ end -}}
2 changes: 1 addition & 1 deletion userguide/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ params:
markmap:
enable: true
mermaid:
version: latest
version: 9.3.0
theme: default
flowchart:
diagramPadding: 20
Expand Down

0 comments on commit 8e764f3

Please sign in to comment.