跳转至
本文阅读量

1. 插件

1.1 mkdocs-autorefs

安装

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.

安装

pip install mkdocs-autolinks-plugin

1.3 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

安装

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

安装

pip install mkdocs_puml

配置

plugins:
  - plantuml:
      puml_url: https://www.plantuml.com/plantuml/

1.13 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

安装

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

安装

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

  • 简介:
  • 源码:

安装


配置