feat: update mermaid shortcode
This commit is contained in:
parent
f7867376fb
commit
b7eda85593
|
@ -3,8 +3,6 @@ var config = {
|
||||||
fontFamily: '"Jost", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";',
|
fontFamily: '"Jost", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";',
|
||||||
};
|
};
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
mermaid.initialize(config);
|
||||||
mermaid.initialize(config);
|
});
|
||||||
|
|
||||||
/* eslint-enable no-undef */
|
|
||||||
|
|
|
@ -92,6 +92,3 @@ rel = "sitemap"
|
||||||
[[module.mounts]]
|
[[module.mounts]]
|
||||||
source = "node_modules/mermaid"
|
source = "node_modules/mermaid"
|
||||||
target = "assets/js/vendor/mermaid"
|
target = "assets/js/vendor/mermaid"
|
||||||
[[module.mounts]]
|
|
||||||
source = "node_modules/mermaid"
|
|
||||||
target = "static/js/vendor/mermaid"
|
|
||||||
|
|
|
@ -15,6 +15,16 @@ toc: true
|
||||||
|
|
||||||
## Flow
|
## Flow
|
||||||
|
|
||||||
|
```md
|
||||||
|
{{</* mermaid class="bg-light text-center" */>}}
|
||||||
|
graph TD
|
||||||
|
A[Hard] -->|Text| B(Round)
|
||||||
|
B --> C{Decision}
|
||||||
|
C -->|One| D[Result 1]
|
||||||
|
C -->|Two| E[Result 2]
|
||||||
|
{{</* /mermaid */>}}
|
||||||
|
```
|
||||||
|
|
||||||
{{< mermaid class="bg-light text-center">}}
|
{{< mermaid class="bg-light text-center">}}
|
||||||
graph TD
|
graph TD
|
||||||
A[Hard] -->|Text| B(Round)
|
A[Hard] -->|Text| B(Round)
|
||||||
|
@ -54,14 +64,21 @@ gantt
|
||||||
|
|
||||||
{{< mermaid >}}
|
{{< mermaid >}}
|
||||||
classDiagram
|
classDiagram
|
||||||
classA --|> classB : Inheritance
|
Class01 <|-- AveryLongClass : Cool
|
||||||
classC --* classD : Composition
|
<<interface>> Class01
|
||||||
classE --o classF : Aggregation
|
Class09 --> C2 : Where am i?
|
||||||
classG --> classH : Association
|
Class09 --* C3
|
||||||
classI -- classJ : Link(Solid)
|
Class09 --|> Class07
|
||||||
classK ..> classL : Dependency
|
Class07 : equals()
|
||||||
classM ..|> classN : Realization
|
Class07 : Object[] elementData
|
||||||
classO .. classP : Link(Dashed)
|
Class01 : size()
|
||||||
|
Class01 : int chimp
|
||||||
|
Class01 : int gorilla
|
||||||
|
class Class10 {
|
||||||
|
<<service>>
|
||||||
|
int id
|
||||||
|
size()
|
||||||
|
}
|
||||||
{{< /mermaid >}}
|
{{< /mermaid >}}
|
||||||
|
|
||||||
## State
|
## State
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
<div class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
|
{{ if .Site.Params.options.mermaid -}}
|
||||||
{{- .Inner -}}
|
<div class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||||
</div>
|
{{ $data := replaceRE "(^\\s+```)" "" .Inner -}}
|
||||||
|
{{ replaceRE "(```\\s+$)" "" $data -}}
|
||||||
|
</div>
|
||||||
|
{{ else }}
|
||||||
|
{{ errorf "Set `mermaid = true` in `./config/_default/params.toml`"}}
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue