Skip to content

vexy-python-markdown-steroids

vexy-python-markdown-steroids is a set of twelve extensions for Python-Markdown. You install the package from PyPI as vexy-python-markdown-steroids, and import the extensions from the mdx_steroids package.

Each extension is a separate module. You turn it on by adding its dotted name, such as mdx_steroids.keys, to the list of extensions in Python, in the python -m markdown command, or in the markdown_extensions list of an MkDocs site.

One extension, from input to output

The keys extension turns key combinations into <kbd> elements. This Markdown:

Press ++ctrl+s++.

becomes this HTML with extensions=["mdx_steroids.keys"]:

<p>Press <span class="keys"><kbd class="key-control">Ctrl</kbd><span>+</span><kbd class="key-s">S</kbd></span>.</p>

The extension recognised ctrl as an alias of the key control, printed it as Ctrl, and gave each key a CSS class you can style.

The extensions

Extension What it does Stage
absimgsrc Prepends a base URL to relative image paths Tree processor
comments Removes <!--- … --> comments, keeps <!-- … --> Preprocessor
figcap Turns titled images into <figure> with <figcaption> Inline pattern, tree processor
img_smart Reads image sizes, sets width and classes, adds lightbox links Block processor
interlink Adds a prefix and suffix to short internal link targets Preprocessor
keys (alias kbd) Renders ++ctrl+s++ as <kbd> elements Inline pattern
kill_tags Deletes HTML elements by CSS or XPath selector, and empty elements Postprocessor
md_mako Runs the Markdown through the Mako template engine Preprocessor
meta_yaml Reads a YAML front-matter block into md.Meta Preprocessor
replimgsrc Find-and-replace in image src attributes Tree processor
translate_no Adds translate="no" to code, keys and other elements Postprocessor
wikilink Turns [[Page Name]] into a Markdown link Preprocessor

The "Stage" column says where in the Python-Markdown pipeline the extension works. Architecture explains the stages and the order in which the extensions run.

Where to go next

License

BSD 3-Clause. Several extensions are based on code by other authors; see License and credits.