| 1 |
title: Extra Extension |
| 2 |
|
| 3 |
# Python-Markdown Extra |
| 4 |
|
| 5 |
## Summary |
| 6 |
|
| 7 |
A compilation of various Python-Markdown extensions that (mostly) imitates |
| 8 |
[PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/). |
| 9 |
|
| 10 |
The supported extensions include: |
| 11 |
|
| 12 |
* [Abbreviations](abbreviations.md) |
| 13 |
* [Attribute Lists](attr_list.md) |
| 14 |
* [Definition Lists](definition_lists.md) |
| 15 |
* [Fenced Code Blocks](fenced_code_blocks.md) |
| 16 |
* [Footnotes](footnotes.md) |
| 17 |
* [Tables](tables.md) |
| 18 |
* [Markdown in HTML](md_in_html.md) |
| 19 |
|
| 20 |
See each individual extension for syntax documentation. Extra and all its |
| 21 |
supported extensions are included in the standard Markdown library. |
| 22 |
|
| 23 |
## Usage |
| 24 |
|
| 25 |
From the Python interpreter: |
| 26 |
|
| 27 |
```pycon |
| 28 |
>>> import markdown |
| 29 |
>>> html = markdown.markdown(text, extensions=['extra']) |
| 30 |
``` |
| 31 |
|
| 32 |
To pass configuration options to the extensions included with Extra, they must be passed to Extra, with the |
| 33 |
underlying extension identified as well. In that way Extra will have access to the options and can pass them on to |
| 34 |
the appropriate underlying extension. |
| 35 |
|
| 36 |
```python |
| 37 |
config = { |
| 38 |
'extra': { |
| 39 |
'footnotes': { |
| 40 |
'UNIQUE_IDS': True |
| 41 |
}, |
| 42 |
'fenced_code': { |
| 43 |
'lang_prefix': 'lang-' |
| 44 |
} |
| 45 |
}, |
| 46 |
'toc': { |
| 47 |
'permalink': True |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
html = markdown.markdown(text, extensions=['extra', 'toc'], extension_configs=config) |
| 52 |
``` |
| 53 |
|
| 54 |
Note that in the above example, `footnotes` and `fenced_code` are both nested under the `extra` key as those |
| 55 |
extensions are included with Extra. However, the `toc` extension is not included with `extra` and therefore its |
| 56 |
configuration options are not nested under the `extra` key. |
| 57 |
|
| 58 |
See each individual extension for a list of supported configuration options. |
| 59 |
|
| 60 |
There are many other [extensions](index.md) which are distributed with Python-Markdown that are not included here in |
| 61 |
Extra. The features of those extensions are not part of PHP Markdown Extra, and therefore, not part of Python-Markdown |
| 62 |
Extra. |