HUGOでやってみた(PartII)
目次
結論的なもの
HUGOで以下の点が気になったのでやってみたという記事です。
- デフォルトのhugo new するときのタグ設定はどこでやればいいの?
- HUGOでシーケンス図を手軽に埋め込めないの?
ほかにやっている人はおるようなので、やってみましょうという記事です。
作業内容的なもの
上記のサイトとほぼ同一ですが、作業内容を記載
hugo newするときの設定を変更する
プロジェクト直下のarchetypes/default.mdを編集した。
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
categories: ["", ""]
description: ""
image: ""
tags: ["", ""]
---
marmaid.js(シーケンス図を埋め込むためのjs)を配置
自分が使用しているhugoテンプレートから<head></head>で囲まれている箇所を確認。
私の使用しているテンプレート「hugo-theme-bootstrap4-blog」では、以下2点をコピー&書き換えとのこと。
- layouts/partials/head-custom.html
- layouts/_default/single.html
<link rel="stylesheet" href="https://unpkg.com/mermaid@7.0.4/dist/mermaid.forest.min.css">
<script src="https://unpkg.com/mermaid@7.0.4/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
<article class="blog-post">
あー。。。なんかQiitaみたいな表示に切り替えたいな。
さておき、これで表示されるか確認してみよう。
フローチャート
{{/*<mermaid align="center">*/}}
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
{{/*< /mermaid >*/}}
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
シーケンス図
{{/*<mermaid align="center">*/}}
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!
{{/* < /mermaid >*/}}
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
prevail... John-->Alice: Great! John->Bob: How about you? Bob-->John: Jolly good!
prevail... John-->Alice: Great! John->Bob: How about you? Bob-->John: Jolly good!
ガントチャート
{{/* <mermaid align="center">/*}}
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality 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
section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to mermaid :1d
{{/*< /mermaid >/*}}
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality 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
section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to mermaid :1d
すげーきれいにかけて結構驚きです。
最後に
構築方法をブログ、Qiitaで書いてくれた人々へ感謝。