跳转至

Extra

Overview

Python Markdown 具有Extra扩展名,可提供类似于 PHP Markdown Extra 的功能。
PyMdown 扩展旨在不仅提供新功能,还要提供 Python Markdown 现有功能集中的行为。 Some of these things can be at odds. Python Markdown's smartstrong and fenced_code are not compatible with PyMdown Extensions' betterem and superfences. smartstrong should never be loaded at the same time as betterem, and superfences should not be loaded at the same time as fenced_code. For these reasons, it is not possible to use Python Markdown's extra and PyMdown Extensions' superfences and betterem at the same time. To make this less frustrating, PyMdown Extensions provides it's own implementation of extra.

PyMdown Extensions' extra is just like Python Markdown's extra except smartstrong is replaced by betterem and fenced_code is replaced by superfences. All other features and extensions should be identical because we are using the same ones.

This extension is a convenience extension, and it currently provides no other additional features. But remember don't use pymdownx.extra while also using markdown.extensions.extra!

Reminder

Remember to read the Usage Notes for information that may be relevant when using this extension!

Extensions:

Extension Name
BetterEm pymdownx.betterem
SuperFences pymdownx.superfences
Footnotes markdown.extensions.footnotes
Attribute Lists markdown.extensions.attr_list
Definition Lists markdown.extensions.def_list
Tables markdown.extensions.tables
Abbreviations markdown.extensions.abbr
Markdown in HTML markdown.extensions.md_in_html

The Extra extension can be included in Python Markdown by using the following:

import markdown
md = markdown.Markdown(extensions=['pymdownx.extra'])

Options

If you wish to configure the individual extensions included via this extensions, you can configure them by placing that sub extension's settings under a setting value that equals the sub extensions name.

extension_configs = {
    'pymdownx.extra': {
        'markdown.extensions.footnotes': {
            'BACKLINK_TEXT': 'link'
        }
    }
}

最后更新: January 1, 2023