feat: mermaid shortcode support code block inside

This commit is contained in:
st1020 2023-10-22 22:15:53 +08:00
parent aa98b6e5e2
commit 64580f4df0
2 changed files with 42 additions and 11 deletions

View file

@ -134,17 +134,48 @@ Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and ot
## Mermaid ## Mermaid
{% mermaid() %} {% mermaid() %}
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
{% end %}
{% mermaid() %}
```
sequenceDiagram sequenceDiagram
participant Alice participant Alice
participant Bob participant Bob
Alice->>John: Hello John, how are you? Alice->>John: Hello John, how are you?
loop Healthcheck loop Healthcheck
John->>John: Fight against hypochondria John->>John: Fight against hypochondria
end end
Note right of John: Rational thoughts <br/>prevail! Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great! John-->>Alice: Great!
John->>Bob: How about you? John->>Bob: How about you?
Bob-->>John: Jolly good! Bob-->>John: Jolly good!
```
{% end %}
{% mermaid() %}
```mermaid
gitGraph
commit
commit
branch develop
commit
commit
commit
checkout main
commit
commit
```
{% end %} {% end %}
## Admonition ## Admonition

View file

@ -1,3 +1,3 @@
<pre class="mermaid bg-white"> <pre class="mermaid bg-white">
{{ body }} {{ body | trim_start_matches(pat="```mermaid") | trim_start_matches(pat="```") | trim_end_matches(pat="```") }}
</pre> </pre>