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

個人的「質はともかく継続する」29日目です

mdbookで日本語検索できるようにする

mdbookには標準で検索機能が付いていますが、
日本語には対応していません。

Pasted image 20240706230908.png

日本語で検索できるようになると、tips集をつくったりするのに
便利になるので、日本語検索ができるようにしていきます。

スクリプトをダウンロードして配置

bookやsrcがあるフォルダと同じ階層に、
assets というフォルダを作成しておきます。

Pasted image 20240706231448.png

次にここから日本語検索機能を追加してくれるJSファイルを
ダウンロードして、先ほど作ったassetsフォルダに入れます。

Pasted image 20240706231618.png

book.tomlを編集する

つづいて、このダウンロードしたJSファイルを有効にするために、
book.tomlファイルを編集します。
このbook.tomlファイルは、mdbookの各種設定をコントロールするファイルです。
ここに、assetsにいれたJSファイルを参照するように追加します。

[output.html]
additional-js = ["assets/fzf.umd.js", "assets/elasticlunr.js"]

ビルドして確認してみる

ビルドして確認します。

mdbook build --open

うまくいきました。

Pasted image 20240706232754.png

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