Adds support for anchors and table of contents to Markdown.
Project description
# lektor-markdown-header-anchors
This plugin extends the markdown support in Lektor in a way that headlines
are given anchors and a table of contents is collected.
## Enabling the Plugin
To enable the plugin run this command:
```
$ lektor plugins add markdown-header-anchors
```
## In Templates
Within templates it becomes possible to access the `.toc` property of
markdown data. It's a list where each item has the following attributes:
* `anchor`: the name of the anchor
* `title`: the title of the headline as HTML
* `children`: a list of headers below that header
Example rendering:
```jinja
<h4>Table Of Contents</h4>
<ul class="toc">
{% for item in this.body.toc recursive %}
<li><a href="#{{ item.anchor }}">{{ item.title }}</a>{%
if item.children %}<ul>{{ loop(item.children) }}</ul>{% endif %}
{% endfor %}
</ul>
```
This plugin extends the markdown support in Lektor in a way that headlines
are given anchors and a table of contents is collected.
## Enabling the Plugin
To enable the plugin run this command:
```
$ lektor plugins add markdown-header-anchors
```
## In Templates
Within templates it becomes possible to access the `.toc` property of
markdown data. It's a list where each item has the following attributes:
* `anchor`: the name of the anchor
* `title`: the title of the headline as HTML
* `children`: a list of headers below that header
Example rendering:
```jinja
<h4>Table Of Contents</h4>
<ul class="toc">
{% for item in this.body.toc recursive %}
<li><a href="#{{ item.anchor }}">{{ item.title }}</a>{%
if item.children %}<ul>{{ loop(item.children) }}</ul>{% endif %}
{% endfor %}
</ul>
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for lektor-markdown-header-anchors-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f32f972cf84cf08f583cd211eb9928954e235a825530f972aa6160ef320751ca |
|
MD5 | fadf8b4ba6ddab77ebfe65c9ac9a4785 |
|
BLAKE2b-256 | 8baa1a9a3546cc4e6db7a08616900d7bea16080f3c256a129689416ed4e7f0cb |
Close
Hashes for lektor_markdown_header_anchors-0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 245acbbc709261e7f0fa86cabb2a3dd04d08ec9e8b66040e70f226911b6a1c0a |
|
MD5 | 4152a9efefb4874bb856f81d0c1dfdaf |
|
BLAKE2b-256 | d29099661e3987331e5cf58ccb79f62ff093f0f0ea0170dbc8becc67f2bdd6da |