.. _plugins: Built-in Plugins ================ .. meta:: :description: List of Mistune built-in plugins, their syntax and how to enable them. Mistune offers many built-in plugins, including all the popular markups. .. _strikethrough: strikethrough ------------- .. code-block:: text ~~here is the content~~ ``mistune.html()`` has enabled strikethrough plugin by default. To create a markdown instance your own:: markdown = mistune.create_markdown(plugins=['strikethrough']) Another way to create your own Markdown instance:: from mistune.plugins.formatting import strikethrough renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[strikethrough]) footnotes --------- .. code-block:: text content in paragraph with footnote[^1] markup. [^1]: footnote explain ``mistune.html()`` has enabled footnote plugin by default. To create a markdown instance your own:: markdown = mistune.create_markdown(plugins=['footnotes']) Another way to create your own Markdown instance:: from mistune.plugins.footnotes import footnotes renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[footnotes]) table ----- Simple formatted table: .. code-block:: text First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell Complex formatted table: .. code-block:: text | First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell | Align formatted table: .. code-block:: text Left Header | Center Header | Right Header :----------- | :-------------: | ------------: Conent Cell | Content Cell | Content Cell | Left Header | Center Header | Right Header | | :---------- | :-------------: | ------------: | | Conent Cell | Content Cell | Content Cell | ``mistune.html()`` has enabled table plugin by default. To create a markdown instance your own:: markdown = mistune.create_markdown(plugins=['table']) Another way to create your own Markdown instance:: from mistune.plugins.table import table renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[table]) url --- URL plugin enables creating link with raw URL by default: .. code-block:: text For instance, https://typlog.com/ Will be converted into: .. code-block:: html

For instance, item 1

  • item 2
  • This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **task_lists** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['task_lists']) Another way to create your own Markdown instance:: from mistune.plugins.task_lists import task_lists renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[task_lists]) def_list -------- def_list plugin enables creating html definition lists: .. code-block:: text First term : First definition : Second definition Second term : Third definition Will be converted into: .. code-block:: html
    First term
    First definition
    Second definition
    Second term
    Third definition
    This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **def_list** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['def_list']) Another way to create your own Markdown instance:: from mistune.plugins.def_list import def_list renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[def_list]) abbr ---- abbr plugin enables creating abbreviations: .. code-block:: text The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Will be converted into: .. code-block:: html The HTML specification is maintained by the W3C. This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **abbr** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['abbr']) Another way to create your own Markdown instance:: from mistune.plugins.abbr import abbr renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[abbr]) mark ---- mark plugin adds the ability to insert ```` tags. To mark some text, simply surround the text with ``==``: .. code-block:: text ==mark me== ==mark with\=\=equal== Will be converted into: .. code-block:: html mark me mark with==equal This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **mark** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['mark']) Another way to create your own Markdown instance:: from mistune.plugins.formatting import mark renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[mark]) insert ------ insert plugin adds the ability to insert ```` tags. To insert some text, simply surround the text with ``^^``: .. code-block:: text ^^insert me^^ ^^insert\^\^me^^ Will be converted into: .. code-block:: html insert me insert^^me This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **insert** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['insert']) Another way to create your own Markdown instance:: from mistune.plugins.formatting import insert renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[insert]) superscript ----------- superscript plugin adds the ability to insert ```` tags. The syntax looks like: .. code-block:: text Hello^superscript^ Will be converted into: .. code-block:: html

    Hellosuperscript

    This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **superscript** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['superscript']) Another way to create your own Markdown instance:: from mistune.plugins.formatting import superscript renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[superscript]) subscript --------- subscript plugin adds the ability to insert ```` tags. The syntax looks like: .. code-block:: text Hello~subscript~ CH~3~CH~2~OH Will be converted into: .. code-block:: html

    Hellosubscript

    CH3CH2OH

    This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **subscript** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['subscript']) Another way to create your own Markdown instance:: from mistune.plugins.formatting import subscript renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[subscript]) math ---- Math plugin wraps ``
    `` for block level math syntax, and ```` for inline level math syntax. A block math is surrounded with ``$$``: .. code-block:: text $$ \operatorname{ker} f=\{g\in G:f(g)=e_{H}\}{\mbox{.}} $$ Will be converted into: .. code-block:: html
    $$ \operatorname{ker} f=\{g\in G:f(g)=e_{H}\}{\mbox{.}} $$
    An inline math is surrounded with ``$`` inline: .. code-block:: text function $f$ Will be converted into: .. code-block:: html

    function $f$

    This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **math** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['math']) Another way to create your own Markdown instance:: from mistune.plugins.math import math renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[math]) ruby ---- insert plugin adds the ability to insert ```` tags. Here are some examples for ruby syntax: .. code-block:: text [漢字(ㄏㄢˋㄗˋ)] [link]: /url [漢字(ㄏㄢˋㄗˋ)][link] [漢字(ㄏㄢˋㄗˋ)](/url) [漢(ㄏㄢˋ)字(ㄗˋ)] Will be converted into: .. code-block:: html

    漢字ㄏㄢˋㄗˋ

    漢字ㄏㄢˋㄗˋ

    漢字ㄏㄢˋㄗˋ

    ㄏㄢˋㄗˋ

    This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **ruby** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['ruby']) Another way to create your own Markdown instance:: from mistune.plugins.ruby import ruby renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[ruby]) Blog post: https://lepture.com/en/2022/markdown-ruby-markup spoiler ------- Spoiler plugin wraps ``
    `` for block level syntax, and ```` for inline level syntax. A block level spoiler looks like block quote, but the marker is ``>!``: .. code-block:: text >! here is the spoiler content >! >! it will be hidden Will be converted into: .. code-block:: html

    here is the spoiler content

    it will be hidden

    An inline spoiler is surrounded with ``>!`` and ``!<``: .. code-block:: text this is the >! hidden text !< Will be converted into: .. code-block:: html

    this is the hidden text

    This plugin is **NOT ENABLED** by default in ``mistune.html()``. To enable **spoiler** plugin with your own markdown instance:: markdown = mistune.create_markdown(plugins=['spoiler']) Another way to create your own Markdown instance:: from mistune.plugins.spoiler import spoiler renderer = mistune.HTMLRenderer() markdown = mistune.Markdown(renderer, plugins=[spoiler])