| 1 |
--- |
| 2 |
icon: lucide/boxes |
| 3 |
--- |
| 4 |
[:octicons-file-code-24:][_extra]{: .source-link } |
| 5 |
|
| 6 |
# Extra |
| 7 |
|
| 8 |
## Overview |
| 9 |
|
| 10 |
Python Markdown has an `extra` extension that provides features similar to PHP Markdown Extra. PyMdown Extensions aims |
| 11 |
to provide not only new features, but to improve behavior in Python Markdown's existing feature set. Some of these |
| 12 |
things can be at odds. Python Markdown's `smartstrong` and `fenced_code` are not compatible with PyMdown Extensions' |
| 13 |
`betterem` and `superfences`. `smartstrong` should never be loaded at the same time as `betterem`, and `superfences` |
| 14 |
should not be loaded at the same time as `fenced_code`. For these reasons, it is not possible to use Python Markdown's |
| 15 |
`extra` and PyMdown Extensions' `superfences` and `betterem` at the same time. To make this less frustrating, PyMdown |
| 16 |
Extensions provides it's own implementation of `extra`. |
| 17 |
|
| 18 |
PyMdown Extensions' `extra` is just like Python Markdown's extra except `smartstrong` is replaced by `betterem` and |
| 19 |
`fenced_code` is replaced by `superfences`. All other features and extensions should be identical because we are using |
| 20 |
the same ones. |
| 21 |
|
| 22 |
This extension is a convenience extension, and it currently provides no other additional features. But remember **don't |
| 23 |
use `pymdownx.extra` while also using `markdown.extensions.extra`**! |
| 24 |
|
| 25 |
/// danger | Reminder |
| 26 |
Remember to read the [Usage Notes](../usage_notes.md) for information that may be relevant when using this |
| 27 |
extension! |
| 28 |
/// |
| 29 |
|
| 30 |
Extensions: |
| 31 |
|
| 32 |
Extension | Name |
| 33 |
---------------------------------- |-------- |
| 34 |
[BetterEm](./betterem.md) | `pymdownx.betterem` |
| 35 |
[SuperFences](./superfences.md) | `pymdownx.superfences` |
| 36 |
[Footnotes][footnotes] | `markdown.extensions.footnotes` |
| 37 |
[Attribute Lists][attr-list] | `markdown.extensions.attr_list` |
| 38 |
[Definition Lists][def-list] | `markdown.extensions.def_list` |
| 39 |
[Tables][tables] | `markdown.extensions.tables` |
| 40 |
[Abbreviations][abbreviations] | `markdown.extensions.abbr` |
| 41 |
[Markdown in HTML][md-in-html] | `markdown.extensions.md_in_html` |
| 42 |
|
| 43 |
The Extra extension can be included in Python Markdown by using the following: |
| 44 |
|
| 45 |
```py3 |
| 46 |
import markdown |
| 47 |
md = markdown.Markdown(extensions=['pymdownx.extra']) |
| 48 |
``` |
| 49 |
|
| 50 |
## Options |
| 51 |
|
| 52 |
If you wish to configure the individual extensions included via this extensions, you can configure them by placing that |
| 53 |
sub extension's settings under a setting value that equals the sub extensions name. |
| 54 |
|
| 55 |
```py3 |
| 56 |
extension_configs = { |
| 57 |
'pymdownx.extra': { |
| 58 |
'markdown.extensions.footnotes': { |
| 59 |
'BACKLINK_TEXT': 'link' |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
``` |