2021-10-02 19:08:50 +02:00
|
|
|
|
# Python Markdown
|
|
|
|
|
|
|
|
|
|
Material for MkDocs supports a large number of [Python Markdown] extensions,
|
|
|
|
|
which is part of what makes it so attractive for technical writing. Following
|
|
|
|
|
is a list of all supported extensions, linking to the relevant sections of the
|
2021-10-04 23:36:31 +02:00
|
|
|
|
reference for which features they need to be enabled.
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
[Python Markdown]: https://python-markdown.github.io/
|
|
|
|
|
|
|
|
|
|
## Supported extensions
|
|
|
|
|
|
|
|
|
|
### Abbreviations
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 1.0.0 -->
|
|
|
|
|
<!-- md:extension [abbr][Abbreviations] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
The [Abbreviations] extension adds the ability to add a small tooltip to an
|
2021-10-03 14:54:22 +02:00
|
|
|
|
element, by wrapping it with an `abbr` tag. Only plain text (no markup) is
|
2021-10-02 19:08:50 +02:00
|
|
|
|
supported. Enable it via `mkdocs.yml`:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- abbr
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
No configuration options are available. See reference for usage:
|
|
|
|
|
|
|
|
|
|
- [Adding abbreviations]
|
|
|
|
|
- [Adding a glossary]
|
|
|
|
|
|
|
|
|
|
[Abbreviations]: https://python-markdown.github.io/extensions/abbreviations/
|
2022-05-08 17:53:16 +02:00
|
|
|
|
[Adding abbreviations]: ../../reference/tooltips.md#adding-abbreviations
|
|
|
|
|
[Adding a glossary]: ../../reference/tooltips.md#adding-a-glossary
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
### Admonition
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 0.1.0 -->
|
|
|
|
|
<!-- md:extension [admonition][Admonition] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
The [Admonition] extension adds support for admonitions, more commonly known as
|
2021-10-03 13:33:01 +02:00
|
|
|
|
_call-outs_, which can be defined in Markdown by using a simple syntax. Enable
|
|
|
|
|
it via `mkdocs.yml`:
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- admonition
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
No configuration options are available. See reference for usage:
|
|
|
|
|
|
2021-10-03 09:11:15 +02:00
|
|
|
|
- [Adding admonitions]
|
2021-10-02 19:08:50 +02:00
|
|
|
|
- [Changing the title]
|
|
|
|
|
- [Removing the title]
|
|
|
|
|
- [Supported types]
|
|
|
|
|
|
|
|
|
|
[Admonition]: https://python-markdown.github.io/extensions/admonition/
|
2021-10-03 09:11:15 +02:00
|
|
|
|
[Adding admonitions]: ../../reference/admonitions.md#usage
|
2021-10-02 19:08:50 +02:00
|
|
|
|
[Changing the title]: ../../reference/admonitions.md#changing-the-title
|
|
|
|
|
[Removing the title]: ../../reference/admonitions.md#removing-the-title
|
|
|
|
|
[Supported types]: ../../reference/admonitions.md#supported-types
|
|
|
|
|
|
|
|
|
|
### Attribute Lists
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 0.1.0 -->
|
|
|
|
|
<!-- md:extension [attr_list][Attribute Lists] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
The [Attribute Lists] extension allows to add HTML attributes and CSS classes
|
|
|
|
|
to [almost every][Attribute Lists limitations] Markdown inline- and block-level
|
|
|
|
|
element with a special syntax. Enable it via `mkdocs.yml`:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- attr_list
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
No configuration options are available. See reference for usage:
|
|
|
|
|
|
2022-01-30 18:49:02 +01:00
|
|
|
|
- [Using annotations]
|
2022-03-27 14:01:30 +02:00
|
|
|
|
- [Using grids]
|
2021-10-02 19:08:50 +02:00
|
|
|
|
- [Adding buttons]
|
2022-05-08 18:37:08 +02:00
|
|
|
|
- [Adding tooltips]
|
2022-04-04 12:02:44 +02:00
|
|
|
|
- [Using icons with colors]
|
|
|
|
|
- [Using icons with animations]
|
2021-10-02 19:08:50 +02:00
|
|
|
|
- [Image alignment]
|
|
|
|
|
- [Image lazy-loading]
|
|
|
|
|
|
|
|
|
|
[Attribute Lists]: https://python-markdown.github.io/extensions/attr_list/
|
|
|
|
|
[Attribute Lists limitations]: https://python-markdown.github.io/extensions/attr_list/#limitations
|
2022-03-27 14:01:30 +02:00
|
|
|
|
[Using grids]: ../../reference/grids.md#using-grids
|
2021-10-02 19:08:50 +02:00
|
|
|
|
[Adding buttons]: ../../reference/buttons.md#adding-buttons
|
2022-05-08 18:37:08 +02:00
|
|
|
|
[Adding tooltips]: ../../reference/tooltips.md#adding-tooltips
|
2022-04-04 12:02:44 +02:00
|
|
|
|
[Using icons with colors]: ../../reference/icons-emojis.md#with-colors
|
|
|
|
|
[Using icons with animations]: ../../reference/icons-emojis.md#with-animations
|
2021-10-02 19:08:50 +02:00
|
|
|
|
[Image alignment]: ../../reference/images.md#image-alignment
|
|
|
|
|
[Image lazy-loading]: ../../reference/images.md#image-lazy-loading
|
|
|
|
|
|
|
|
|
|
### Definition Lists
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 1.1.0 -->
|
|
|
|
|
<!-- md:extension [def_list][Definition Lists] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
The [Definition Lists] extension adds the ability to add definition lists (more
|
2021-10-03 13:33:01 +02:00
|
|
|
|
commonly known as [description lists] – `dl` in HTML) via Markdown to a
|
|
|
|
|
document. Enable it via `mkdocs.yml`:
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- def_list
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
No configuration options are available. See reference for usage:
|
|
|
|
|
|
|
|
|
|
- [Using definition lists]
|
|
|
|
|
|
|
|
|
|
[Definition Lists]: https://python-markdown.github.io/extensions/definition_lists/
|
|
|
|
|
[description lists]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl
|
|
|
|
|
[Using definition lists]: ../../reference/lists.md#using-definition-lists
|
|
|
|
|
|
|
|
|
|
### Footnotes
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 1.0.0 -->
|
|
|
|
|
<!-- md:extension [footnotes][Footnotes] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2021-10-10 12:19:14 +02:00
|
|
|
|
The [Footnotes] extension allows to define inline footnotes, which are then
|
|
|
|
|
rendered below all Markdown content of a document. Enable it via `mkdocs.yml`:
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- footnotes
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
No configuration options are supported. See reference for usage:
|
|
|
|
|
|
|
|
|
|
- [Adding footnote references]
|
|
|
|
|
- [Adding footnote content]
|
|
|
|
|
|
|
|
|
|
[Footnotes]: https://python-markdown.github.io/extensions/footnotes/
|
|
|
|
|
[Adding footnote references]: ../../reference/footnotes.md#adding-footnote-references
|
|
|
|
|
[Adding footnote content]: ../../reference/footnotes.md#adding-footnote-content
|
|
|
|
|
|
|
|
|
|
### Markdown in HTML
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 0.1.0 -->
|
|
|
|
|
<!-- md:extension [md_in_html][Markdown in HTML] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
|
The [Markdown in HTML] extension allows for writing Markdown inside of HTML,
|
|
|
|
|
which is useful for wrapping Markdown content with custom elements. Enable it
|
|
|
|
|
via `mkdocs.yml`:
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- md_in_html
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
> By default, Markdown ignores any content within a raw HTML block-level
|
|
|
|
|
> element. With the `md_in_html` extension enabled, the content of a raw HTML
|
2021-10-04 23:36:31 +02:00
|
|
|
|
> block-level element can be parsed as Markdown by including a `markdown`
|
|
|
|
|
> attribute on the opening tag. The `markdown` attribute will be stripped from
|
2021-10-02 19:08:50 +02:00
|
|
|
|
> the output, while all other attributes will be preserved.
|
|
|
|
|
|
|
|
|
|
No configuration options are available. See reference for usage:
|
|
|
|
|
|
2022-01-30 18:49:02 +01:00
|
|
|
|
- [Using annotations]
|
2022-03-27 14:01:30 +02:00
|
|
|
|
- [Using grids]
|
2021-10-02 19:08:50 +02:00
|
|
|
|
- [Image captions]
|
|
|
|
|
|
|
|
|
|
[Markdown in HTML]: https://python-markdown.github.io/extensions/md_in_html/
|
2022-01-30 18:49:02 +01:00
|
|
|
|
[Using annotations]: ../../reference/annotations.md#usage
|
2022-03-27 14:01:30 +02:00
|
|
|
|
[Using grids]: ../../reference/grids.md#usage
|
2021-10-02 19:08:50 +02:00
|
|
|
|
[Image captions]: ../../reference/images.md#image-captions
|
|
|
|
|
|
|
|
|
|
### Table of Contents
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 0.1.0 -->
|
|
|
|
|
<!-- md:extension [toc][Table of Contents] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2021-10-03 13:33:01 +02:00
|
|
|
|
The [Table of Contents] extension automatically generates a table of contents
|
2023-09-14 19:09:18 +02:00
|
|
|
|
from a document, which Material for MkDocs will render as part of the resulting
|
2021-10-03 13:33:01 +02:00
|
|
|
|
page. Enable it via `mkdocs.yml`:
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
|
|
|
|
permalink: true
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The following configuration options are supported:
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:option toc.title -->
|
2021-10-27 19:01:47 +02:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
: <!-- md:version 7.3.5 --> <!-- md:default computed --> –
|
|
|
|
|
This option sets the title of the table of contents in the right navigation
|
|
|
|
|
sidebar, which is normally automatically sourced from the translations for
|
|
|
|
|
the [site language] as set in `mkdocs.yml`:
|
2021-10-27 19:01:47 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
|
|
|
|
title: On this page
|
|
|
|
|
```
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:option toc.permalink -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
: <!-- md:default `false` --> This option adds an anchor link
|
2021-10-02 19:08:50 +02:00
|
|
|
|
containing the paragraph symbol `¶` or another custom symbol at the end of
|
|
|
|
|
each headline, exactly like on the page you're currently viewing, which
|
|
|
|
|
Material for MkDocs will make appear on hover:
|
|
|
|
|
|
|
|
|
|
=== "¶"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
|
|
|
|
permalink: true
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
=== "⚓︎"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
|
|
|
|
permalink: ⚓︎
|
|
|
|
|
```
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:option toc.permalink_title -->
|
2021-10-27 18:33:48 +02:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
: <!-- md:default `Permanent link` --> This option sets the
|
2021-10-27 18:33:48 +02:00
|
|
|
|
title of the anchor link which is shown on hover and read by screen readers.
|
2023-09-14 19:09:18 +02:00
|
|
|
|
For accessibility reasons, it might be beneficial to change it to a more
|
2021-10-27 18:33:48 +02:00
|
|
|
|
discernable name, stating that the anchor links to the section itself:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
|
|
|
|
permalink_title: Anchor link to this section for reference
|
|
|
|
|
```
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:option toc.slugify -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
: <!-- md:default `toc.slugify` --> This option allows for
|
2021-10-02 19:08:50 +02:00
|
|
|
|
customization of the slug function. For some languages, the default may not
|
|
|
|
|
produce good and readable identifiers – consider using another slug function
|
2021-10-03 18:02:59 +02:00
|
|
|
|
like for example those from [Python Markdown Extensions][Slugs]:
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
=== "Unicode"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
2022-10-02 16:36:47 +02:00
|
|
|
|
slugify: !!python/object/apply:pymdownx.slugs.slugify
|
|
|
|
|
kwds:
|
|
|
|
|
case: lower
|
2021-10-02 19:08:50 +02:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
=== "Unicode, case-sensitive"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
2024-03-29 09:54:53 +01:00
|
|
|
|
slugify: !!python/object/apply:pymdownx.slugs.slugify {}
|
2021-10-02 19:08:50 +02:00
|
|
|
|
```
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:option toc.toc_depth -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
: <!-- md:default `6` --> Define the range of levels to be
|
2021-10-02 19:08:50 +02:00
|
|
|
|
included in the table of contents. This may be useful for project
|
|
|
|
|
documentation with deeply structured headings to decrease the length of the
|
|
|
|
|
table of contents, or to remove the table of contents altogether:
|
|
|
|
|
|
|
|
|
|
=== "Hide levels 4-6"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
|
|
|
|
toc_depth: 3
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
=== "Hide table of contents"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- toc:
|
|
|
|
|
toc_depth: 0
|
|
|
|
|
```
|
|
|
|
|
|
2021-10-03 13:33:01 +02:00
|
|
|
|
The other configuration options of this extension are not officially supported
|
2021-10-27 22:18:34 +02:00
|
|
|
|
by Material for MkDocs, which is why they may yield unexpected results. Use
|
|
|
|
|
them at your own risk.
|
2021-10-03 13:33:01 +02:00
|
|
|
|
|
2021-10-02 19:08:50 +02:00
|
|
|
|
[Table of Contents]: https://python-markdown.github.io/extensions/toc/
|
2021-10-27 19:01:47 +02:00
|
|
|
|
[site language]: ../changing-the-language.md#site-language
|
2021-10-03 18:02:59 +02:00
|
|
|
|
[Slugs]: https://facelessuser.github.io/pymdown-extensions/extras/slugs/
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
### Tables
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 0.1.0 -->
|
|
|
|
|
<!-- md:extension [tables][Tables] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
The [Tables] extension adds the ability to create tables in Markdown by using a
|
2021-10-03 13:33:01 +02:00
|
|
|
|
simple syntax. Enable it via `mkdocs.yml` (albeit it should be enabled by
|
|
|
|
|
default):
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- tables
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
No configuration options are available. See reference for usage:
|
|
|
|
|
|
|
|
|
|
- [Using data tables]
|
|
|
|
|
- [Column alignment]
|
|
|
|
|
|
|
|
|
|
[Tables]: https://python-markdown.github.io/extensions/tables/
|
2021-10-30 13:16:05 +02:00
|
|
|
|
[Using data tables]: ../../reference/data-tables.md#usage
|
2021-10-02 19:08:50 +02:00
|
|
|
|
[Column alignment]: ../../reference/data-tables.md#column-alignment
|
|
|
|
|
|
|
|
|
|
## Superseded extensions
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
The following [Python Markdown] extensions are not (or might not be) supported
|
2021-10-02 19:08:50 +02:00
|
|
|
|
anymore, and are therefore not recommended for use. Instead, the alternatives
|
|
|
|
|
should be considered.
|
|
|
|
|
|
|
|
|
|
### Fenced Code Blocks
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 0.1.0 -->
|
|
|
|
|
<!-- md:extension [fenced_code_blocks][Fenced Code Blocks] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
Superseded by [SuperFences]. This extension might still work, but the
|
2023-09-14 19:09:18 +02:00
|
|
|
|
[SuperFences] extension is superior in many ways, as it allows for arbitrary
|
2021-10-10 12:19:14 +02:00
|
|
|
|
nesting, and is therefore recommended.
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
[Fenced Code Blocks]: https://python-markdown.github.io/extensions/fenced_code_blocks/
|
|
|
|
|
[SuperFences]: https://facelessuser.github.io/pymdown-extensions/extensions/superfences/
|
|
|
|
|
|
|
|
|
|
### CodeHilite
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 0.1.0 -->
|
|
|
|
|
<!-- md:extension [codehilite][CodeHilite] -->
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
|
Superseded by [Highlight]. Support for CodeHilite was dropped in
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 6.0.0 -->, as [Highlight] has a better integration with other
|
2021-10-04 23:36:31 +02:00
|
|
|
|
essential extensions like [SuperFences] and [InlineHilite].
|
2021-10-02 19:08:50 +02:00
|
|
|
|
|
|
|
|
|
[CodeHilite]: https://python-markdown.github.io/extensions/code_hilite/
|
2021-10-03 09:11:15 +02:00
|
|
|
|
[CodeHilite support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
|
2021-10-10 12:19:14 +02:00
|
|
|
|
[Highlight]: https://facelessuser.github.io/pymdown-extensions/extensions/highlight/
|
2021-10-02 19:08:50 +02:00
|
|
|
|
[InlineHilite]: https://facelessuser.github.io/pymdown-extensions/extensions/inlinehilite/
|