mirror of https://github.com/luizdepra/hugo-coder.git

Luke Wassink
yesterday 16325b3cd3f13bcbd29f252100b789dc1ac43213
Mermaid (#1012)

### Prerequisites

Put an `x` into the box(es) that apply:

- [x] This pull request fixes a bug.
- [x] This pull request adds a feature.
- [ ] This pull request introduces breaking change.

### Description

This pull request updates Mermaid and fixes a bug:
1. Update Mermaid to version 11.17.12. This adds support for xychart
with multiple, labelled lines. See
https://mermaid.ai/open-source/syntax/xyChart.html#legend-v11-17-0
(though by 11.17.12 it's no longer necessary to use -beta).
2. Prevent Mermaid charts from being minified. Minifying interferes with
setting custom colors via `plotColorPalette`. See
https://mermaid.ai/open-source/syntax/xyChart.html#setting-colors-for-lines-and-bars.

### Issues Resolved

Mermaid custom `plotColorPalette` has no effect.

### Checklist

Put an `x` into the box(es) that apply:

#### General

- [x] Describe what changes are being made
- [x] Explain why and how the changes were necessary and implemented
respectively
- [ ] Reference issue with `#<ISSUE_NO>` if applicable

#### Resources

- [ ] If you have changed any SCSS code, run `make release` to
regenerate all CSS files

#### Contributors

- [x] Add yourself to `CONTRIBUTORS.md` if you aren't on it already

---------

Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
3 files modified
8 ■■■■■ changed files
CONTRIBUTORS.md 1 ●●●●● patch | view | raw | blame | history
layouts/_shortcodes/mermaid.html 2 ●●●●● patch | view | raw | blame | history
layouts/baseof.html 5 ●●●●● patch | view | raw | blame | history
CONTRIBUTORS.md
@@ -154,3 +154,4 @@
-   [Ábel Nagy](https://github.com/abel-nagy)
-   [William Floyd](https://w-floyd.com)
-   [Tiago Carrondo](https://carrondo.pt)
    [Luke Wassink](https://github.com/lukewassink)
layouts/_shortcodes/mermaid.html
@@ -1,3 +1,5 @@
<pre style="white-space: pre;">
<div class="mermaid">
  {{- .Inner | safeHTML }}
</div>
</pre>
layouts/baseof.html
@@ -27,8 +27,9 @@
  </main>
  {{ if .HasShortcode "mermaid" }}
  <script src="https://cdn.jsdelivr.net/npm/mermaid@11.13.0/dist/mermaid.min.js"
    integrity="sha256-PiACvzM5B/rnwdaGC7x49dpBe8cLZPPSJoWBuguouWo=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/mermaid@11.17.2/dist/mermaid.min.js"
          integrity="sha256-WB7X10vZBI0OOpE2OSfXLvIpQtdyJUayf3zCnjU5Drg="
          crossorigin="anonymous"></script>
  <script>
    mermaid.initialize({startOnLoad: true});
  </script>