LoginSignup
21

More than 5 years have passed since last update.

Gitbook 3でmermaid.jsを使う

Posted at

別プロジェクトに移ったのでローカルのGitbookを最新版のv3で作ったところ、今まで使っていた gitbook-plugin-mermaid-2動かなくなっていました。

GitHubのページにもissueで上がってますが、しばらく動きなさそう。

ということで、 Gitbook Plugins で探したところ、今までと一番使い勝手が似ていそうなので、 gitbook-plugin-mermaid-gb3 を試して見ました。

gitbook-plugin-mermaid-gb3

良いところ

gitbook-plugin-mermaid-2 と同じで、コードブロックで書けます。

スクリーンショット 2017-03-13 3.01.13.png
スクリーンショット 2017-03-13 3.02.11.png

また、mermaid.jsのバージョンが最新の6.0になっているので、その辺りが嬉しいです。

気に入ってないところ

gitbook-plugin-mermaid-2 と違い、テーマの指定が行えません。

book.json
{
    "plugins": [
       "mermaid-2"
    ],
    "pluginsConfig": {
      "mermaid-2": {
         "theme": "forest" 
      }
    }
}

こういうの。

この辺りは今後かなぁ。

その他

Gitbook-cliのグローバルバージョンに引っ張られて面倒&仕様書とか書くときによく同じプラグインをセットアップするので、Boilerplateを作ってみました。

mermaid.js の他に、PlantUmlやtocなどがセットアップされているので、ひとまず仕様書的なサムシングが書けると思います。

前提

  • macOS
  • node.js(v6でテスト済み。)
  • npm

使い方

git cloneで自分のディレクトリにおろしてきて、npmでインストールしてください。

your-book-name の部分を自分のbook名にして以下のコマンドをターミナルで実行すると作れます。

export PJNAME=your-book-name && git clone --depth 1 https://github.com/TakuroFukamizu/gitbook-specification-boilerplate.git ${PJNAME} && cd ${PJNAME} && npm install && rm -fr .git && npm run serve

以上。
ぜひ、Excel仕様書スレイヤーライフをお過ごしください。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21