mkdocs¶
Setup¶
$ pip install mkdocs
$ mkdocs new sample-docs
INFO - Creating project directory: sample-docs
INFO - Writing config file: sample-docs/mkdocs.yml
INFO - Writing initial docs: sample-docs/docs/index.md
$ cd sample-docs
$ mkdocs build
INFO - Cleaning site directory
INFO - Building documentation to directory: /tmp/sample-docs/site
INFO - Documentation built in 0.07 seconds
ビルド後に出来た site
ディレクトリを、公開したいパスに移動すればよい。
開発中は mkdocs serve
を使う。localhost以外でLISTENしたい場合は mkdocs serve -a 0.0.0.0:8080
のように。
見た目と記法の拡張¶
- materialテーマの追加: https://squidfunk.github.io/mkdocs-material/getting-started/
pip install mkdocs-material
- imgタグの拡張: https://squidfunk.github.io/mkdocs-material/reference/images/
- チェックリスト: https://squidfunk.github.io/mkdocs-material/reference/lists/#using-tasklists
- 警告ブロック: https://squidfunk.github.io/mkdocs-material/reference/admonitions/
- コードハイライトの設定: https://squidfunk.github.io/mkdocs-material/reference/code-blocks/
- 自由にタイトルを変える: https://squidfunk.github.io/mkdocs-material/reference/meta-tags/
- 注釈: https://squidfunk.github.io/mkdocs-material/reference/footnotes/
- URLを貼るだけでリンクにする: https://facelessuser.github.io/pymdown-extensions/extensions/magiclink/
- 折り畳み: https://facelessuser.github.io/pymdown-extensions/extensions/details/
??? note "title"
のように書くと、最初は展開されていない折り畳みが作れる???+ note "title"
のように書くと、最初から展開されている折り畳みが作れる
- 更新時刻をページ下部に付与する: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin
pip install mkdocs-git-revision-date-localized-plugin
- 生成したHTMLをminimizeする: https://github.com/byrnereese/mkdocs-minify-plugin
pip install mkdocs-minify-plugin
- 末尾に半角スペース2個入れなくても改行する
mkdocs.yml
のmarkdown_extensions
にnl2br
を追加
Refs¶
- https://squidfunk.github.io/mkdocs-material/
- https://facelessuser.github.io/pymdown-extensions/extensions/
- https://dev.classmethod.jp/articles/mkdocs-and-material-for-mkdocs-tips-matome/
- https://qiita.com/mebiusbox2/items/a61d42878266af969e3c
- https://blogenist.jp/2020/07/05/10763/#i-7
- https://fereria.github.io/reincarnation_tech/10_Programming/99_Documentation/00_mkdocs_setting/
- https://roy-n-roy.github.io/mkdocs/gitRevisionDate/
最終更新日: 2021-05-22 13:37:13