♻️ Use .HasShortcode for mermaid script

pull/2/head
James Panther 2021-08-21 08:54:42 +10:00
parent f0c6306e6c
commit 46a7031a3a
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@
</footer> </footer>
{{/* Include mermaid.js only on pages that use the shortcode */}} {{/* Include mermaid.js only on pages that use the shortcode */}}
{{- if (in (string .Content) "class=\"mermaid\"") -}} {{- if .Page.HasShortcode "mermaid" -}}
<script src="https://unpkg.com/mermaid@8.11.4/dist/mermaid.min.js"></script> <script src="https://unpkg.com/mermaid@8.11.4/dist/mermaid.min.js"></script>
<script> <script>
mermaid.initialize({ theme: "default" }); mermaid.initialize({ theme: "default" });