PyMdown Extensions

Usage

PyMdown Extensions is a collection of extensions for Python Markdown. Keep in mind, the PyMdown extensions were designed to work with the default extensions, so your mileage may vary in regards to compatibility when paired with other 3rd party extensions.

All extensions are found under pymdownx. Assuming we wanted to specify the use of the MagicLink extension, we would include it in Python Markdown like so:

import markdown
text = "A link https://google.com"
html = markdown.markdown(text, ['pymdownx.magiclink'])

Check out documentation on each extension to learn more about how to configure and use each one.

Reminder

Please read the Usage Notes for information on extension compatibility and general notes to be aware of when using these extensions.

Extensions

Arithmatex

Arithmatex is an extension that preserves LaTeX math equations (\(\frac{\sqrt x}{y^3}\)) during the Markdown conversion process so that they can be used with MathJax.

B64

B64 converts all local images in a document to base64 encoding and embeds them in the document.

BetterEm

BetterEm is a different approach to emphasis than Python Markdown's default. It works similar but handles certain corner cases differently.

Caret

Caret is an extension that is syntactically built around the ^ character. It adds support for inserting superscripts and adds an easy way to place text in an <ins> tag.

Critic

Critic adds handling and support of Critic Markup.

Details

Details creates collapsible elements with <details><summary> tags.

Click Me!

Thanks!

Emoji

Emoji makes adding emoji via Markdown easy 😄.

EscapeAll

EscapeAll allows the escaping of any character, some with additional effects. Check it out to learn more.

Extra

Extra is just like Python Markdown's Extra package except it uses PyMdown Extensions to substitute similar extensions.

ExtraRawHTML

ExtraRawHTML exposes Python Markdown's feature of parsing markdown in HTML blocks. No longer do you have to include all of Extra when all you want to do is parse Markdown in HTML blocks.

GitHub

GitHub uses extensions from Python Markdown and PyMdown Extensions to give a GitHub-ish feel.

Highlight

Highlight allows you to configure the syntax highlighting of SuperFences and InlineHilite. Also passes standard Markdown indented code blocks through the syntax highlighter.

Keys

Keys makes inserting key inputs into documents as easy as pressing CtrlAltDel.

MagicLink

MagicLink linkafies URL and email links without having to wrap them in Markdown syntax.

Mark

Mark allows you to mark words easily.

ProgressBar

ProgressBar creates progress bars quick and easy.

SmartSymbols

SmartSymbols inserts commonly used Unicode characters via simple ASCII representations: =/= → ≠.

Snippets

Snippets include other Markdown or HTML snippets into the current Markdown file being parsed.

SuperFences

SuperFences is like Python Markdown's fences, but better. Nest fences under lists, admonitions, and other syntaxes. Also create special custom fences for content like UML.

Title: Here is a title
A->B: Normal line
B-->C: Dashed line
C->>D: Open arrow
D-->>A: Dashed open arrow
Tasklist

Tasklist allows inserting lists with check boxes.

  • eggs
  • bread
  • milk
Tilde

Tilde is syntactically built around the ~ character. It adds support for inserting subscripts and adds an easy way to place text in a <del> tag.

InlineHilite

InlineHilite highlights inline code: from module import function as func.

PathConverter

PathConverter convert paths to absolute or relative to a base path.

PlainHTML

PlainHTML can strip out HTML comments and specific tag attributes.