Auto-detect and reference tags inside written text.
Project description
lektor plugin: inlinetags
The inlinetags plugin allows you to use tags inside normal text / html / markdown elements.
For example, you can write This is my {{Lektor}} powered website
and it will automatically replace the tag with a link to the actual page: This is my <a href="/tag/lektor/">Lektor</a> powered website
.
Of course, you can configure a different matching pattern, e.g., instead of the default {{tag}}
use $tag$
(\$(.{1,20}?)\$
).
This plugin is based on the lektor-groupby plugin. All configuration options from groupby can be used (including multiple attribute names).
Known issues
In rare cases, clicking on "Save Changes" will not replace the tags of the current page. It happens because the page is built concurrently (race condition). This affects only the currently edited page and only the inline replacements (the tags page is updated just fine). If this occurs to you, simply edit and save the page again.
Example config file
Add a new inlinetags = True
attribute to your model, e.g., a flow block:
[block]
name = Text Element
button_label = [[paragraph]]
[fields.content]
label = Text
type = markdown
inlinetags = True
In your plugin config (configs/inlinetags.ini
):
[inlinetags]
root = /
slug = "tag/{}/index.html".format(this.key)
template = tag-page.html
[inlinetags.pattern]
match = {{([^}]{1,32})}}
replace = <a href="/tag/{key}/">{name}</a>
[inlinetags.fields]
title = "Tagged: " ~ this.group
[inlinetags.key_map]
C# = c-sharp
Project details
Release history Release notifications | RSS feed
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
Hashes for lektor_inlinetags-0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d33defec3e06a9db82e392c1dc6982cc2e7ba4cd5dbe48f18e5eae36f0a43491 |
|
MD5 | 6ca956f9e872db21bd5d7dd47da9b7d4 |
|
BLAKE2b-256 | 48d10966640bc6f41b3d9277b7b159d9caf55388b4bf19649ff52a189114a6c5 |