1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-03-26 00:17:00 +01:00

feat(hook): code block mermaid ()

This commit is contained in:
Dillon 2025-03-18 08:35:05 +08:00 committed by GitHub
parent 561bf5c7db
commit 859f574511
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 3 deletions
exampleSite/content/posts/theme-documentation-content
layouts
_default/_markup
partials/plugin
shortcodes

View file

@ -239,6 +239,19 @@ This part is shown in the [basic markdown syntax page](../basic-markdown-syntax/
**LoveIt** theme has some extended syntax elements for you to write articles.
### Mermaid Diagrams
```mermaid
graph TD
A[Enter Chart Definition] --> B(Preview)
B --> C{decide}
C --> D[Keep]
C --> E[Edit Definition]
E --> B
D --> F[Save Image and Code]
F --> B
```
### Emoji Support
This part is shown in the [emoji support page](../emoji-support/).

View file

@ -238,6 +238,19 @@ resources:
**LoveIt** 主题提供了一些扩展的语法便于你撰写文章.
### Mermaid 图表
```mermaid
graph TD
A[输入图表定义] --> B(预览)
B --> C{决定}
C --> D[保持]
C --> E[编辑定义]
E --> B
D --> F[保存图片和代码]
F --> B
```
### Emoji 支持
这部分内容在 [Emoji 支持页面](../emoji-support/) 中介绍.

View file

@ -0,0 +1 @@
{{- dict "Content" .Inner "Page" .Page | partial "plugin/mermaid.html" -}}

View file

@ -0,0 +1,3 @@
{{- $id := dict "Content" .Content "Scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mermaid" id="{{ $id }}"></div>
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}

View file

@ -1,3 +1 @@
{{- $id := dict "Content" (trim .Inner "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mermaid" id="{{ $id }}"></div>
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}
{{- dict "Content" (trim .Inner "\n") "Page" .Page | partial "plugin/mermaid.html" -}}