`. Defaults to `None`.
* **`toc_class`**:
CSS class(es) used for the `
` containing the Table of Contents. Defaults to `toc`.
* **`anchorlink`**:
Set to `True` to cause all headers to link to themselves. Default is `False`.
* **`anchorlink_class`**:
CSS class(es) used for the link. Defaults to `toclink`.
* **`permalink`**:
Set to `True` or a string to generate permanent links at the end of each header.
Useful with Sphinx style sheets.
When set to `True` the paragraph symbol (¶ or "`¶`") is used as
the link text. When set to a string, the provided string is used as the link
text.
* **`permalink_class`**:
CSS class(es) used for the link. Defaults to `headerlink`.
* **`permalink_title`**:
Title attribute of the permanent link. Defaults to `Permanent link`.
* **`baselevel`**:
Base level for headers. Defaults to `1`.
The `baselevel` setting allows the header levels to be automatically
adjusted to fit within the hierarchy of your HTML templates. For example,
suppose the Markdown text for a page should not contain any headers higher
than level 3 (`
`). The following will accomplish that:
:::pycon
>>> text = '''
... #Some Header
... ## Next Level'''
>>> from markdown.extensions.toc import TocExtension
>>> html = markdown.markdown(text, extensions=[TocExtension(baselevel=3)])
>>> print html
Next Level
'
* **`slugify`**:
Callable to generate anchors.
Default: `markdown.extensions.toc.slugify`
In order to use a different algorithm to define the id attributes, define and
pass in a callable which takes the following two arguments:
* `value`: The string to slugify.
* `separator`: The Word Separator.
The callable must return a string appropriate for use in HTML `id` attributes.
An alternate version of the default callable supporting Unicode strings is also
provided as `markdown.extensions.toc.slugify_unicode`.
* **`separator`**:
Word separator. Character which replaces white space in id. Defaults to "`-`".
* **`toc_depth`**
Define the range of section levels to include in the Table of Contents.
A single integer (`b`) defines the bottom section level (`..`) only.
A string consisting of two digits separated by a hyphen in between (`"2-5"`),
define the top (`t`) and the bottom (`b`) (`..`). Defaults to `6` (bottom).
When used with conjunction with `baselevel`, this parameter will not
take the fitted hierarchy from `baselevel` into account. That is, if
both `toc_depth` and `baselevel` are `3`, then only the highest level
will be present in the table. If you set `baselevel` to `3` and
`toc_depth` to `"2-6"`, the *first* headline will be `` and so still
included in the Table of Contents. To exclude this first level, you
have to set `toc_depth` to `"4-6"`.
A trivial example:
```python
markdown.markdown(some_text, extensions=['toc'])
```