update readme

This commit is contained in:
relikd
2022-04-07 13:22:18 +02:00
parent 3c2231f588
commit dcf60b59ac
2 changed files with 47 additions and 9 deletions

View File

@@ -1,14 +1,52 @@
# lektor plugin: inlinetags
### Default config file
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](https://github.com/relikd/lektor-groupby-plugin) 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:
```ini
root = /
template = inlinetag.html
regex = {{([^}]{1,32})}}
link = tags/{tag}/
replace = <a href="{link}">{title}</a>
[block]
name = Text Element
button_label = [[paragraph]]
[slugs]
[fields.content]
label = Text
type = markdown
inlinetags = True
```
In your plugin config (`configs/inlinetags.ini`):
```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
```
```

View File

@@ -6,7 +6,7 @@ with open('README.md') as fp:
setup(
name='lektor-inlinetags',
py_modules=['lektor_inlinetags'],
install_requires=['lektor-groupby>=0.9.4'],
install_requires=['lektor-groupby>=0.9.5'],
entry_points={
'lektor.plugins': [
'inlinetags = lektor_inlinetags:InlineTagsPlugin',