mirror of
https://github.com/dillonzq/LoveIt.git
synced 2025-03-26 00:17:00 +01:00
feat(hook): code block mermaid (#954)
This commit is contained in:
parent
561bf5c7db
commit
859f574511
5 changed files with 31 additions and 3 deletions
exampleSite/content/posts/theme-documentation-content
layouts
|
@ -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/).
|
||||
|
|
|
@ -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/) 中介绍.
|
||||
|
|
1
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
1
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{- dict "Content" .Inner "Page" .Page | partial "plugin/mermaid.html" -}}
|
3
layouts/partials/plugin/mermaid.html
Normal file
3
layouts/partials/plugin/mermaid.html
Normal 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 -}}
|
|
@ -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" -}}
|
||||
|
|
Loading…
Add table
Reference in a new issue