Basic style for markdown-generated Table of Contents
This styles a Table of Content (ToC) generated by the markdown toc extension: https://python-markdown.github.io/extensions/toc/
This commit is contained in:
parent
9d6d2685e6
commit
a70dd82eb3
4 changed files with 57 additions and 2 deletions
33
docs/toc.md
Normal file
33
docs/toc.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Table of contents documentation
|
||||
|
||||
## Markdown
|
||||
|
||||
Markdown has a [toc extension](https://python-markdown.github.io/extensions/toc/) that can be enabled and used directly.
|
||||
Once enabled just add `[TOC]` in the markdown document where you want the table of contents to appear.
|
||||
|
||||
Configure the `toc` extension through `MARKDOWN` setting in `pelicanconf.py`:
|
||||
|
||||
``` python
|
||||
MARKDOWN = {
|
||||
"extension_configs": {
|
||||
"markdown.extensions.toc": {
|
||||
"title": "Table of Contents"
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Refer to [Markdown's toc extension documentation](https://python-markdown.github.io/extensions/toc/) for full settings.
|
||||
|
||||
If you use the [i18n_subsites plugin](https://github.com/getpelican/pelican-plugins/tree/master/i18n_subsites) you can override the table of contents" title:
|
||||
|
||||
``` python
|
||||
import copy
|
||||
|
||||
I18N_SUBSITES = {
|
||||
"es": {
|
||||
"MARKDOWN": copy.deepcopy(MARKDOWN), # copy to override later
|
||||
}
|
||||
}
|
||||
I18N_SUBSITES["es"]["MARKDOWN"]["extension_configs"]["markdown.extensions.toc"]["title"] = "Índice de contenidos"
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue