PyMdown 扩展插件

用法

Arithmatex MathJax

Arithmatex将Material与MathJax 集成在一起,MathJax解析用TeX标记编写的块样式和内联方程,并以数学符号输出。有关如何使用TeX语法编写方程式的简短介绍和快速参考,请参阅this thread

除了激活mkdocs.yml中的扩展名外,还需要包含MathJax JavaScript运行时。必须使用其他JavaScript完成此操作: additional JavaScript:

1
2
extra_javascript:
  - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'

如果要覆盖默认的MathJax配置,可以通过在包含MathJax配置的extra_javascript中的MathJax运行时之前添加另一个JavaScript文件来实现,例如:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
window.MathJax = {
  tex2jax: {
    inlineMath: [ ["\\(","\\)"] ],
    displayMath: [ ["\\[","\\]"] ]
  },
  TeX: {
    TagSide: "right",
    TagIndent: ".8em",
    MultLineWidth: "85%",
    equationNumbers: {
      autoNumber: "AMS",
    },
    unicode: {
      fonts: "STIXGeneral,'Arial Unicode MS'"
    }
  },
  displayAlign: "left",
  showProcessingMessages: false,
  messageStyle: "none"
};

In your mkdocs.yml, include it with:

1
2
3
extra_javascript:
  - 'javascripts/extra.js'
  - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'

Blocks

块包含在$$ ... $$中,它们放在不同的行上。

Example:

1
2
3
$$
\frac{n!}{k!(n-k)!} = \binom{n}{k}
$$

Result:

\frac{n!}{k!(n-k)!} = \binom{n}{k}

Inline

内联方程需要包含在$ ... $中:

Example:

1
Lorem ipsum dolor sit amet: $p(x|y) = \frac{p(y|x)p(x)}{p(y)}$

Result:

Lorem ipsum dolor sit amet: p(x|y) = \frac{p(y|x)p(x)}{p(y)}

BetterEm

BetterEm 通过提供更复杂的解析器来更好地检测开始和结束令牌,从而改进了Markdown中强调标记(粗体和斜体)的处理。 阅读文档 usage notes.

Caret

Caret Caret可以突出显示插入的文本。应标记为已添加的文本部分必须用两个插入符号^^...^^括起来。

Critic

Critic implements Critic Markup, a Markdown extension that enables the tracking of changes (additions, deletions and comments) on documents. During compilation of the Markdown document, changes can be rendered (default), accepted or rejected.

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.

Details

Details adds collapsible Admonition-style blocks which can contain arbitrary content using the HTML5 details and summary tags. Additionally, all Admonition qualifiers can be used, e.g. note, question, warning etc.:

How many Prolog programmers does it take to change a lightbulb?

Yes.

InlineHilite

InlineHilite adds support for inline code highlighting. It's useful for short snippets included within body copy, e.g. var test = 0; and can be achived by prefixing inline code with a shebang and language identifier, e.g. #!js.

Mark

Mark adds the ability to highlight text like it was marked with a text marker. The portion of text that should be highlighted must be enclosed in two equal signs ==...==.

SmartSymbols

SmartSymbols converts markup for special characters into their corresponding symbols, e.g. arrows (←, →, ↔), trademark and copyright symbols (©, ™, ®) and fractions (½, ¼, ...).

SuperFences

SuperFences provides the ability to nest code blocks under blockquotes, lists and other block elements, which the Fenced Code Blocks extension from the standard Markdown library doesn't parse correctly.

SuperFences does also allow grouping code blocks with tabs.

Tasklist

Tasklist adds support for styled checkbox lists. This is useful for keeping track of tasks and showing what has been done and has yet to be done. Checkbox lists are like regular lists, but prefixed with [ ] for empty or [x] for filled checkboxes.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
* [x] Lorem ipsum dolor sit amet, consectetur adipiscing elit
* [x] Nulla lobortis egestas semper
* [x] Curabitur elit nibh, euismod et ullamcorper at, iaculis feugiat est
* [ ] Vestibulum convallis sit amet nisi a tincidunt
    * [x] In hac habitasse platea dictumst
    * [x] In scelerisque nibh non dolor mollis congue sed et metus
    * [x] Sed egestas felis quis elit dapibus, ac aliquet turpis mattis
    * [ ] Praesent sed risus massa
* [ ] Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
* [ ] Nulla vel eros venenatis, imperdiet enim id, faucibus nisi

Result:

  • Lorem ipsum dolor sit amet, consectetur adipiscing elit
  • Nulla lobortis egestas semper
  • Curabitur elit nibh, euismod et ullamcorper at, iaculis feugiat est
  • Vestibulum convallis sit amet nisi a tincidunt
    • In hac habitasse platea dictumst
    • In scelerisque nibh non dolor mollis congue sed et metus
    • Sed egestas felis quis elit dapibus, ac aliquet turpis mattis
    • Praesent sed risus massa
  • Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
  • Nulla vel eros venenatis, imperdiet enim id, faucibus nisi

Tilde

Tilde provides an easy way to strike through cross out text. The portion of text that should be erased must be enclosed in two tildes ~~...~~ and the extension will take care of the rest.