| 1 |
title: Extensions |
| 2 |
|
| 3 |
# Extensions |
| 4 |
|
| 5 |
Python Markdown offers a flexible extension mechanism, which makes it possible |
| 6 |
to change and/or extend the behavior of the parser without having to edit the |
| 7 |
actual source files. |
| 8 |
|
| 9 |
To use an extension, pass it to markdown with the `extensions` keyword. |
| 10 |
|
| 11 |
```python |
| 12 |
markdown.markdown(some_text, extensions=[MyExtClass(), 'myext', 'path.to.my.ext:MyExtClass']) |
| 13 |
``` |
| 14 |
|
| 15 |
See the [Library Reference](../reference.md#extensions) for more details. |
| 16 |
|
| 17 |
From the command line, specify an extension with the `-x` option. |
| 18 |
|
| 19 |
```bash |
| 20 |
python -m markdown -x myext -x path.to.module:MyExtClass input.txt > output.html |
| 21 |
``` |
| 22 |
|
| 23 |
See the [Command Line docs](../cli.md) or use the `--help` option for more details. |
| 24 |
|
| 25 |
!!! seealso "See Also" |
| 26 |
If you would like to write your own extensions, see the |
| 27 |
[Extension API](api.md) for details. |
| 28 |
|
| 29 |
Officially Supported Extensions |
| 30 |
------------------------------- |
| 31 |
|
| 32 |
The extensions listed below are included with (at least) the most recent release |
| 33 |
and are officially supported by Python-Markdown. Any documentation is |
| 34 |
maintained here and all bug reports should be made to the project. If you |
| 35 |
have a typical install of Python-Markdown, these extensions are already |
| 36 |
available to you using the "Entry Point" name listed in the second column below. |
| 37 |
|
| 38 |
Extension | Entry Point | Dot Notation |
| 39 |
---------------------------------- | -------------- | ------------ |
| 40 |
[Extra] | `extra` | `markdown.extensions.extra` |
| 41 |
[Abbreviations] | `abbr` | `markdown.extensions.abbr` |
| 42 |
[Attribute Lists] | `attr_list` | `markdown.extensions.attr_list` |
| 43 |
[Definition Lists] | `def_list` | `markdown.extensions.def_list` |
| 44 |
[Fenced Code Blocks] | `fenced_code` | `markdown.extensions.fenced_code` |
| 45 |
[Footnotes] | `footnotes` | `markdown.extensions.footnotes` |
| 46 |
[Markdown in HTML] | `md_in_html` | `markdown.extensions.md_in_html` |
| 47 |
[Tables] | `tables` | `markdown.extensions.tables` |
| 48 |
[Admonition] | `admonition` | `markdown.extensions.admonition` |
| 49 |
[CodeHilite] | `codehilite` | `markdown.extensions.codehilite` |
| 50 |
[Legacy Attributes] | `legacy_attrs` | `markdown.extensions.legacy_attrs` |
| 51 |
[Legacy Emphasis] | `legacy_em` | `markdown.extensions.legacy_em` |
| 52 |
[Meta-Data] | `meta` | `markdown.extensions.meta` |
| 53 |
[New Line to Break] | `nl2br` | `markdown.extensions.nl2br` |
| 54 |
[Sane Lists] | `sane_lists` | `markdown.extensions.sane_lists` |
| 55 |
[SmartyPants] | `smarty` | `markdown.extensions.smarty` |
| 56 |
[Table of Contents] | `toc` | `markdown.extensions.toc` |
| 57 |
[WikiLinks] | `wikilinks` | `markdown.extensions.wikilinks` |
| 58 |
|
| 59 |
[Extra]: extra.md |
| 60 |
[Abbreviations]: abbreviations.md |
| 61 |
[Attribute Lists]: attr_list.md |
| 62 |
[Definition Lists]: definition_lists.md |
| 63 |
[Fenced Code Blocks]: fenced_code_blocks.md |
| 64 |
[Footnotes]: footnotes.md |
| 65 |
[Tables]: tables.md |
| 66 |
[Admonition]: admonition.md |
| 67 |
[CodeHilite]: code_hilite.md |
| 68 |
[Legacy Attributes]: legacy_attrs.md |
| 69 |
[Legacy Emphasis]: legacy_em.md |
| 70 |
[Meta-Data]: meta_data.md |
| 71 |
[New Line to Break]: nl2br.md |
| 72 |
[Markdown in HTML]: md_in_html.md |
| 73 |
[Sane Lists]: sane_lists.md |
| 74 |
[SmartyPants]: smarty.md |
| 75 |
[Table of Contents]: toc.md |
| 76 |
[WikiLinks]: wikilinks.md |
| 77 |
|
| 78 |
Third Party Extensions |
| 79 |
---------------------- |
| 80 |
|
| 81 |
Various individuals and/or organizations have developed extensions which they |
| 82 |
have made available to the public. A [list of third party extensions][list] |
| 83 |
is maintained on the wiki for your convenience. The Python-Markdown team |
| 84 |
offers no official support for these extensions. Please see the developer of |
| 85 |
each extension for support. |
| 86 |
|
| 87 |
[list]: https://github.com/Python-Markdown/markdown/wiki/Third-Party-Extensions |