1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Honkitで静的サイト生成してみました

Last updated at Posted at 2024-03-02

Honkitでホムペつくってみました

いままで、どこかで拾ってきたCSSファイルとタグのベタうちでホムペソースを
かいてました。

数年間ほったらかしてました。アップデートしてませんでした。

そのあいだ、GitHubつかうようになったり、文書もMarkdownで執筆する
ことがおおくなりました。

このたびホムペを全面改装することに

一念発起して、ぜんめんてきに改装することとしました。せっかくだからMarkdownで
かいて、静的サイト生成できればいいなぁ思いました。

GitBookに興味があったのですが、ふるいバージョンはDeprecatedだし、
どうもウェブサービスとなってるようなので、そこからフォークされた
HonKitにしてみました。

HonKitのドキュメントをみながら

ドキュメントのサイトがあるので、それをみながら、やってみました。

Node.jsのインストールなどおこないました。

いい感じ

いい感じのサイトができました。

追記させてください

MermaidのマインドマップってGitHubのUIだとレンダリングされるのだが、プラグインだと非対応
なのです。そこで追加しました↓

Pluginつかってみた

4種類ほどプラグインをつかってみました。ひとつはplugin-search-pro-kui
plugin-katex, honkit-plugin-mermaid, simple-mind-mapです。

前者が検索性能をあげるもの、あとのは、数式表示のためのものです。

plugin installの方法

npm i honkit-plugin-katex
npm i gitbook-plugin-search-pro-kui
npm i npm i honkit-plugin-mermaid
npm i gitbook-plugin-simple-mind-map

そのあと、book.jsonのなかにこれらを書き加える

  "plugins": [
      "-lunr", "-search", "search-pro-kui","katex","mermaid", "simple-mind-map"
    ]

そのあと通常どおりにつぎのコマンドを実行

npx honkit init
npx honkit serve

この段階で、 http://localhost:4000で生成した静的サイトを閲覧できるようになります

本ばんは ビルドです。

npx honkit build . ./docs

このように生成される静的サイトのPathを指定しておけば、GitHubPagesやVercelで公開するときに便利です。

mindmapのこと

{% simplemindmap %}

* simplemindmap
    * config book.json
        * plugins
            * others
            * simple-mind-map
        * pluginsConfig
            * others
            * simple-mind-map
                * type
                * preset
                * linkShape
                * autoFit
                * style
    * custom file.md
        * markdown
            * type
            * preset
            * linkShape
            * autoFit
            * style
        * txtmap
        * json
        * mindmup

{% endsimplemindmap %}

のようにしてください。この時点でGitHub上でのレンダリングは、あきらめましょう。

Hokitのドキュメント

1
0
0

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?