本文阅读量 次
1. 插件¶
1.1 mkdocs-autorefs¶
- 简介: 自动跨页面引用 header
- 源码: https://github.com/mkdocstrings/autorefs ⧉
- 备注: 需要通过 attr_list ⧉ 对 header 进行 id 的设置
安装
pip install mkdocs-autorefs
配置文件中需要开启 attr_list
# mkdocs.yml
plugins:
- search
- autorefs
markdown_extensions:
- attr_list
使用如下方式设置 id
Somewhere in a document.
[](){#foobar-paragraph}
Paragraph about foobar.
1.2 mkdocs-autolinks-plugin¶
- 简介: 可以跨页面自动引用其它 markdown 页面,避免目录结构调整时,需要手动调整所有引用的地方;也支持图片等格式文件的自动 link
- 源码: https://github.com/zachhannum/mkdocs-autolinks-plugin ⧉
安装
pip install mkdocs-autolinks-plugin
1.3 mkdocs-glightbox¶
- 简介: A MkDocs plugin supports image lightbox with GLightbox.
- 源码: https://github.com/blueswen/mkdocs-glightbox ⧉
安装
pip install mkdocs-glightbox
配置
plugins:
- glightbox
1.4 mkdocs-minify-plugin¶
安装
pip install mkdocs-minify-plugin
配置
plugins:
- search
- minify:
minify_html: true
minify_js: true
minify_css: true
htmlmin_opts:
remove_comments: true
cache_safe: true
js_files:
- my/javascript/dir/file1.js
- my/javascript/dir/file2.js
css_files:
- my/css/dir/file1.css
- my/css/dir/file2.css
1.5 mkdocs-enumerate-headings-plugin¶
- 简介:
- 源码:
安装
pip install mkdocs-enumerate-headings-plugin
配置
plugins:
- search
- enumerate-headings
plugins:
- enumerate-headings:
toc_depth: 0
strict: true
increment_across_pages: true
include:
- "*"
exclude:
- index.md
- another_page.md
restart_increment_after:
- second_section.md
1.6 mkdocs-add-number-plugin¶
安装
pip install mkdocs-add-number-plugin
配置
plugins:
- search
- add-number:
strict_mode: False
order: 1
excludes:
- sql/
- command/rsync
includes:
- sql/MySQL
1.7 mkdocs-link-marker¶
安装
pip install mkdocs-link-marker
配置
plugins:
- search
- link-marker
1.8 mkdocs-categories-plugin¶
安装
pip install mkdocs-categories-plugin
配置
plugins:
- categories
1.9 mkdocs-toc-sidebar-plugin¶
安装
配置
1.10 mkdocs-with-pdf¶
安装
pip install mkdocs-with-pdf
配置
plugins:
- with-pdf:
#author: WHO
#copyright: ANY TEXT
#
#cover: false
#back_cover: true
#cover_title: TITLE TEXT
#cover_subtitle: SUBTITLE TEXT
#custom_template_path: TEMPLATES PATH
#
#toc_title: TOC TITLE TEXT
#heading_shift: false
#toc_level: 3
#ordered_chapter_level: 2
#excludes_children:
# - 'release-notes/:upgrading'
# - 'release-notes/:changelog'
#
#exclude_pages:
# - 'bugs/'
# - 'appendix/contribute/'
#convert_iframe:
# - src: IFRAME SRC
# img: POSTER IMAGE URL
# text: ALTERNATE TEXT
# - src: ...
#two_columns_level: 3
#
#render_js: true
#headless_chrome_path: headless-chromium
#
#output_path: any-place/document.pdf
#enabled_if_env: ENABLE_PDF_EXPORT
#
#debug_html: true
#show_anchors: true
#verbose: true
1.11 mkdocs-build-plantuml-plugin¶
安装
pip install mkdocs-build-plantuml-plugin
配置
plugins:
- search
- build_plantuml:
render: 'server' # or "local" for local rendering
bin_path: '/usr/local/bin/plantuml' # ignored when render: server
server: 'http://www.plantuml.com/plantuml' # official plantuml server
disable_ssl_certificate_validation: true # for self-signed and invalid certs
output_format: 'svg' # or "png"
allow_multiple_roots: false # in case your codebase contains more locations for diagrams (all ending in diagram_root)
diagram_root: 'docs/diagrams' # should reside under docs_dir
output_folder: 'out'
input_folder: 'src'
input_extensions: '' # comma separated list of extensions to parse, by default every file is parsed
注意
本插件的实现思路是执行 mkdocs serve
时扫描指定目录(input_folder
)下的特定文件,并在指定目录(output_folder
)生成 plantuml 的图片(svg 或 png),之后在 markdown 文档中通过普通图片的方式引用 plantuml 的结果文件。
不是 inline 的方式,这样在更新时或目录文件调整时,需要手动修改一大堆 markdown 文件中的路径
1.12 mkdocs_puml¶
- 简介: inline 嵌入 plantuml 图文
- 源码: https://github.com/MikhailKravets/mkdocs_puml ⧉
- 文档: https://mikhailkravets.github.io/mkdocs_puml/ ⧉
- 文章: https://medium.com/@michkravets/add-inline-plantuml-to-your-mkdocs-documentation-9a2acb7599a6s ⧉
安装
pip install mkdocs_puml
配置
plugins:
- plantuml:
puml_url: https://www.plantuml.com/plantuml/
1.13 mkdocs-gen-files¶
- 简介: 编译期间动态生成文件
- 源码: https://github.com/oprypin/mkdocs-gen-files ⧉
安装
pip install mkdocs-gen-files
配置
plugins:
- search
- gen-files:
scripts:
- gen_pages.py # or any other name or path
1.14 mkdocs-table-reader-plugin¶
- 简介: 支持直接从 csv 等文件读取内容
- 源码: https://github.com/timvink/mkdocs-table-reader-plugin ⧉
安装
pip install mkdocs-table-reader-plugin
配置
plugins:
- search
- table-reader
1.15 markdown_inline_graphviz_extension¶
安装
pip install markdown_inline_graphviz_extension
配置
markdown_extensions:
- markdown_inline_graphviz
```graphviz dot attack_plan.svg
digraph G {
rankdir=LR
Earth [peripheries=2]
Mars
Earth -> Mars
}
```
1.16 mkdocs-glightbox¶
- 简介: mkdocs-glightbox
- 源码: https://github.com/blueswen/mkdocs-glightbox ⧉
安装
pip install mkdocs-glightbox
配置
plugins:
- glightbox:
touchNavigation: true
loop: false
effect: zoom
slide_effect: slide
width: 100%
height: auto
zoomable: true
draggable: true
skip_classes:
- custom-skip-class-name
auto_caption: false
caption_position: bottom
background: white
shadow: true
1.17 markdown-checklist¶
安装
pip install markdown-checklist
配置
示例
* [ ] foo
* [x] bar
* [ ] baz
1.18¶
- 简介:
- 源码:
安装
配置
1.19¶
- 简介:
- 源码:
安装
配置
1.20¶
- 简介:
- 源码:
安装
配置