HexoのMermaidプラグイン hexo-filter-mermaid-diagramsのインストール hexo-filter-mermaid-diagrams のインストール。
1 npm install hexo-filter-mermaid-diagrams --save
Tranquilpeakの設定 themes/tranquilpeak/_config.yml
にmermaidの設定を追加。
1 2 3 4 5 6 # Mermaid mermaid: enable: true version: "7.1.2" # Available themes: default | dark | forest | neutral theme: default
Mermaidの読み込み themes/tranquilpeak/layout/_partial/script.ejs
に以下を追加。
1 2 3 4 5 6 7 8 <% if (theme.mermaid.enable) { %> <script src ='https://unpkg.com/mermaid@<%= theme.mermaid.version %>/dist/mermaid.min.js' > </script > <script > if (window .mermaid) { mermaid.initialize({theme : 'forest' }); } </script > <% } %>
ダイアグラムを描く 書き方 コードブロックでmermaidのコードであることを示して記述する。 コードブロックで書くことがサンプルで表現されていないので注意。
フローチャート 1 2 3 4 5 graph TD; A-->B; A-->C; B-->D; C-->D;
A
B
C
D
Sequence diagram 1 2 3 4 5 6 7 8 9 10 11 sequenceDiagram participant Alice participant Bob Alice->>John: Hello John, how are you? loop Healthcheck John->>John: Fight against hypochondria end Note right of John: Rational thoughts <br/>prevail... John-->>Alice: Great! John->>Bob: How about you? Bob-->>John: Jolly good!
Alice Bob John Hello John, how are you? Fight against hypochondria loop [ Healthcheck ] Rational thoughts prevail... Great! How about you? Jolly good! Alice Bob John
Gantt diagram 1 2 3 4 5 6 7 8 9 gantt dateFormat YYYY-MM-DD title Adding GANTT diagram to mermaid section A section Completed task :done, des1, 2014 -01 -06 ,2014 -01 -08 Active task :active, des2, 2014 -01 -09 , 3d Future task : des3, after des2, 5d Future task2 : des4, after des3, 5d
w. 01 w. 02 w. 03 Completed task Active task Future task Future task2 A section Adding GANTT diagram to mermaid
Class diagram 1 2 3 4 5 6 7 8 9 10 11 12 13 14 classDiagram Class01 <|-- AveryLongClass : Cool Class03 *-- Class04 Class05 o-- Class06 Class07 .. Class08 Class09 --> C2 : Where am i? Class09 --* C3 Class09 --|> Class07 Class07 : equals()Class07 : Object [] elementDataClass01 : size()Class01 : int chimpClass01 : int gorillaClass08 <--> C2: Cool label
Class01 int chimp int gorilla size() averylongclass Class09 C3 Class07 Object[] elementData equals() Class08 C2 cool class03 *-- class04 class05 o-- class06 class07 .. class08 class09 --> C2 : Where am i? Cool label<!------><!--|---->
Git graph 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 gitGraph: options { "nodeSpacing" : 150 , "nodeRadius" : 10 } end commit branch newbranch checkout newbranch commit commit checkout master commit commit merge newbranch
master, f9fbae5
edf51ec
a553861
b378780
newbranch, a45d3cf
ae7f610