Extensions

October 29, 2019 · View on GitHub

title: Extensions

Extensions

Python Markdown offers a flexible extension mechanism, which makes it possible to change and/or extend the behavior of the parser without having to edit the actual source files.

To use an extension, pass it to markdown with the extensions keyword.

markdown.markdown(some_text, extensions=[MyExtClass(), 'myext', 'path.to.my.ext:MyExtClass'])

See the Library Reference for more details.

From the command line, specify an extension with the -x option.

python -m markdown -x myext -x path.to.module:MyExtClass input.txt > output.html

See the Command Line docs or use the --help option for more details.

!!! seealso "See Also" If you would like to write your own extensions, see the Extension API for details.

Officially Supported Extensions

The extensions listed below are included with (at least) the most recent release and are officially supported by Python-Markdown. Any documentation is maintained here and all bug reports should be made to the project. If you have a typical install of Python-Markdown, these extensions are already available to you using the "Entry Point" name listed in the second column below.

ExtensionEntry PointDot Notation
Extraextramarkdown.extensions.extra
    Abbreviationsabbrmarkdown.extensions.abbr
    Attribute Listsattr_listmarkdown.extensions.attr_list
    Definition Listsdef_listmarkdown.extensions.def_list
    Fenced Code Blocksfenced_codemarkdown.extensions.fenced_code
    Footnotesfootnotesmarkdown.extensions.footnotes
    Markdown in HTMLmd_in_htmlmarkdown.extensions.md_in_html
    Tablestablesmarkdown.extensions.tables
Admonitionadmonitionmarkdown.extensions.admonition
CodeHilitecodehilitemarkdown.extensions.codehilite
Legacy Attributeslegacy_attrsmarkdown.extensions.legacy_attrs
Legacy Emphasislegacy_emmarkdown.extensions.legacy_em
Meta-Datametamarkdown.extensions.meta
New Line to Breaknl2brmarkdown.extensions.nl2br
Sane Listssane_listsmarkdown.extensions.sane_lists
SmartyPantssmartymarkdown.extensions.smarty
Table of Contentstocmarkdown.extensions.toc
WikiLinkswikilinksmarkdown.extensions.wikilinks

Third Party Extensions

Various individuals and/or organizations have developed extensions which they have made available to the public. A list of third party extensions is maintained on the wiki for your convenience. The Python-Markdown team offers no official support for these extensions. Please see the developer of each extension for support.