Lektor plugin that adds anchors and table of contents to markdown headers.
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 anchortitle: the title of the headline as HTMLchildren: a list of headers below that header
Example rendering:
<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 %}</li>
{% 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lektor_markdown_header_anchors-0.4.0.tar.gz.
File metadata
- Download URL: lektor_markdown_header_anchors-0.4.0.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74663067bca240ef8c3e325982712f30e94fa3c7b91a8a19bffa9bb143b17d8e
|
|
| MD5 |
020b74a3e6a26a96cbd735b67ddf8916
|
|
| BLAKE2b-256 |
0614d20638c0cfe011afa46a0861634aa0f886a75dfd60ef9a4327950749bd31
|
File details
Details for the file lektor_markdown_header_anchors-0.4.0-py3-none-any.whl.
File metadata
- Download URL: lektor_markdown_header_anchors-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b5ec3f7dcc28ae7887a028400d518b50bd3bb926fe23d2935dd080a4122fb54
|
|
| MD5 |
c4799f2deb55fe59df79e9fb4a93c2fa
|
|
| BLAKE2b-256 |
a326e8d896b7003e9aac1eed4a68c11dfa6c65990b8a69b33fdd828841420e66
|