.. _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
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])