title: Extra Extension # Python-Markdown Extra ## Summary A compilation of various Python-Markdown extensions that (mostly) imitates [PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/). The supported extensions include: * [Abbreviations](abbreviations.md) * [Attribute Lists](attr_list.md) * [Definition Lists](definition_lists.md) * [Fenced Code Blocks](fenced_code_blocks.md) * [Footnotes](footnotes.md) * [Tables](tables.md) * [Smart Strong](smart_strong.md) See each individual extension for syntax documentation. Extra and all its supported extensions are included in the standard Markdown library. ## Usage From the Python interpreter: ```pycon >>> import markdown >>> html = markdown.markdown(text, ['markdown.extensions.extra']) ``` There may be [additional extensions](index.md) that are distributed with Python-Markdown that are not included here in Extra. The features of those extensions are not part of PHP Markdown Extra, and therefore, not part of Python-Markdown Extra. If you really would like Extra to include additional extensions, we suggest creating your own clone of Extra under a different name (see the [Extension API](api.md)). ### Markdown Inside HTML Blocks Unlike the other Extra features, this feature is built into the markdown core and is turned on when `markdown.extensions.extra` is enabled. The content of any raw HTML block element can be Markdown-formatted simply by adding a `markdown` attribute to the opening tag. The markdown attribute will be stripped from the output, but all other attributes will be preserved. If the markdown value is set to `1` (recommended) or any value other than `span` or `block`, the default behavior will be executed: `p`,`h[1-6]`,`li`,`dd`,`dt`, `td`,`th`,`legend`, and `address` elements skip block parsing while others do not. If the default is overridden by a value of `span`, *block parsing will be skipped* regardless of tag. If the default is overridden by a value of `block`, *block parsing will occur* regardless of tag. #### Simple Example: ```md This is *true* markdown text.
This is *true* markdown text.
``` #### Result: ```html

This is true markdown text.

This is true markdown text.

``` ### Nested Markdown Inside HTML Blocks Nested elements are more sensitive and must be used cautiously. To avoid unexpected results: * Only nest elements within block mode elements. * Follow the closing tag of inner elements with a blank line. * Only have one level of nesting. #### Complex Example: ```md
The text of the `Example` element.
This text gets wrapped in `p` tags.
The tail of the `DefaultBlockMode` subelement.

This text *is not* wrapped in additional `p` tags.

The tail of the `DefaultSpanMode` subelement.
This `div` block is not wrapped in paragraph tags. Note: Subelements are not required to have tail text.

This `p` block *is* foolishly wrapped in further paragraph tags.

The tail of the `BlockModeOverride` subelement.
Raw HTML blocks may also be nested.
This text is after the markdown in HTML. ``` #### Complex Result: ```html

The text of the Example element.

This text gets wrapped in p tags.

The tail of the DefaultBlockMode subelement.

This text is not wrapped in additional p tags.

The tail of the DefaultSpanMode subelement.

This div block is not wrapped in paragraph tags. Note: Subelements are not required to have tail text.

This p block is foolishly wrapped in further paragraph tags.

The tail of the BlockModeOverride subelement.

Raw HTML blocks may also be nested.

This text is after the markdown in HTML.

```