Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

mermaid-js/mermaid packaged as a Hugo Module.

License

Notifications You must be signed in to change notification settings

peaceiris/hugo-mod-mermaidjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hugo-mod-mermaidjs

mermaid-js/mermaid packaged as a Hugo Module (Hugo Modules).

Usage

To enable this module you must add the following parameters to your config/_default/config.yaml:

module:
  imports:
    - path: github.com/peaceiris/hugo-mod-mermaidjs

If this is the first time you are using Hugo modules you need to prepare your setup by installing Go, initializing your modules and more. Please refer to the official Hugo Documentation to complete these steps.

In a Hugo template file.

{{ $js := resources.Get "mod/mermaidjs/mermaid.min.js" }}
{{ $secureJS := $js | resources.Fingerprint "sha512" }}
<script src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
<script>
  var config = {
    startOnLoad: true,
    flowchart: {
      useMaxWidth: true,
      htmlLabels: true,
      curve: "cardinal",
    },
    theme: "neutral",
    securityLevel: "strict",
  };

  mermaid.initialize(config);
</script>