格式化¶
¥Formatting¶
Material for MkDocs 支持多种 HTML 元素,可用于突出显示文档的某些部分或应用特定格式。此外,还支持Critic Markup ,增加了显示文档修改建议的功能。
¥Material for MkDocs provides support for several HTML elements that can be used to highlight sections of a document or apply specific formatting. Additionally, Critic Markup is supported, adding the ability to display suggested changes for a document.
配置¶
¥Configuration¶
此配置启用了键盘按键支持、文档更改跟踪、上下标定义以及文本高亮显示。将以下几行添加到mkdocs.yml中:
¥This configuration enables support for keyboard keys, tracking changes in documents, defining sub- and superscript and highlighting text. Add the following lines to mkdocs.yml:
markdown_extensions:
- pymdownx.critic
- pymdownx.caret
- pymdownx.keys
- pymdownx.mark
- pymdownx.tilde
查看其他配置选项:
¥See additional configuration options:
用法¶
¥Usage¶
突出显示更改¶
¥Highlighting changes¶
启用Critic后,可以使用Critic Markup ,它增加了突出显示建议的更改以及向文档添加内联注释的功能:
¥When Critic is enabled, Critic Markup can be used, which adds the ability to highlight suggested changes, as well as add inline comments to a document:
Text can be {--deleted--} and replacement text {++added++}. This can also be
combined into {~~one~>a single~~} operation. {==Highlighting==} is also
possible {>>and comments can be added inline<<}.
{==
Formatting can also be applied to blocks by putting the opening and closing
tags on separate lines and adding new lines between the tags and the content.
==}
可以删除文本并添加替换文本。这两项操作也可以合并为一个操作。此外,还可以高亮显示文本,并可在行内添加注释。
¥Text can be deleted and replacement text added. This can also be combined into onea single operation. Highlighting is also possible and comments can be added inline.
通过将开始和结束标记放在不同的行上并在标记和内容之间添加新行,也可以将格式化应用于块。
¥ Formatting can also be applied to blocks by putting the opening and closing tags on separate lines and adding new lines between the tags and the content.
突出显示文本¶
¥Highlighting text¶
当启用Caret、Mark 和 Tilde时,可以使用简单的语法突出显示文本,这比直接使用相应的mark 、 ins和del HTML 标签更方便:
¥When Caret, Mark & Tilde are enabled, text can be highlighted with a simple syntax, which is more convenient that directly using the corresponding mark, ins and del HTML tags:
- ==This was marked (highlight)==
- ^^This was inserted (underline)^^
- ~~This was deleted (strikethrough)~~
这已标记(突出显示)
¥This was marked (highlight)
- 这是插入的(下划线)
此项已删除(删除线)
下标和上标¶
¥Sub- and superscripts¶
当启用插入符号和波浪号时,可以使用简单的语法为文本添加下标和上标,这比直接使用相应的sub和sup HTML 标签更方便:
¥When Caret & Tilde are enabled, text can be sub- and superscripted with a simple syntax, which is more convenient than directly using the corresponding sub and sup HTML tags:
水
¥H
ATA
¥A
添加键盘键¶
¥Adding keyboard keys¶
启用Keys后,键盘按键可以用简单的语法呈现。请参阅Python Markdown 扩展文档,了解所有可用的短代码:
¥When Keys is enabled, keyboard keys can be rendered with a simple syntax. Consult the Python Markdown Extensions documentation to learn about all available shortcodes:
Ctrl+Alt+Del
¥Ctrl+Alt+Del