Skip to content

扩展

¥Extensions

Markdown 是一种非常小众的语言,它有一种参考实现,叫做John Gruber's Markdown 。Python MarkdownPython Markdown Extensions是两个增强 Markdown 写作体验的软件包,为技术写作添加了有用的语法扩展。

¥Markdown is a very small language with a kind-of reference implementation called John Gruber's Markdown. Python Markdown and Python Markdown Extensions are two packages that enhance the Markdown writing experience, adding useful syntax extensions for technical writing.

支持的扩展

¥Supported extensions

以下扩展均受 Material for MkDocs 支持,因此强烈推荐。点击每个扩展即可了解其用途和配置:

¥The following extensions are all supported by Material for MkDocs and therefore strongly recommended. Click on each extension to learn about its purpose and configuration:

配置

¥Configuration

扩展配置是mkdocs.yml (MkDocs 配置文件)的一部分。以下部分包含两个示例配置,用于引导您的文档项目。

¥Extensions are configured as part of mkdocs.yml – the MkDocs configuration file. The following sections contain two example configurations to bootstrap your documentation project.

最低配置

¥Minimal configuration

当您首次使用 Material for MkDocs 时,此配置是一个很好的起点。最好的方法是探索参考,并逐步添加您想要使用的内容:

¥This configuration is a good starting point for when you're using Material for MkDocs for the first time. The best idea is to explore the reference, and gradually add what you want to use:

markdown_extensions:

  # Python Markdown
  - toc:
      permalink: true

  # Python Markdown Extensions
  - pymdownx.highlight
  - pymdownx.superfences

¥Recommended configuration

此配置启用了 Material for MkDocs 的所有与 Markdown 相关的功能,非常适合有经验的用户引导新的文档项目:

¥This configuration enables all Markdown-related features of Material for MkDocs and is great for experienced users bootstrapping a new documentation project:

markdown_extensions:

  # Python Markdown
  - abbr
  - admonition
  - attr_list
  - def_list
  - footnotes
  - md_in_html
  - toc:
      permalink: true

  # Python Markdown Extensions
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.caret
  - pymdownx.details
  - pymdownx.emoji:
      emoji_index: !!python/name:material.extensions.emoji.twemoji
      emoji_generator: !!python/name:material.extensions.emoji.to_svg
  - pymdownx.highlight
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.mark
  - pymdownx.smartsymbols
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde