diff options
Diffstat (limited to 'filters/headers.lua')
-rw-r--r-- | filters/headers.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/filters/headers.lua b/filters/headers.lua new file mode 100644 index 0000000..4e3a689 --- /dev/null +++ b/filters/headers.lua | |||
@@ -0,0 +1,16 @@ | |||
1 | function Header(el) | ||
2 | if el.level == 1 then | ||
3 | local newchildren = pandoc.List() | ||
4 | newchildren:insert(pandoc.Span(el.content, { class = 's-headlines__title-inner' })) | ||
5 | el.content = newchildren | ||
6 | end | ||
7 | |||
8 | if el.level <= 3 and el.identifier ~= '' then | ||
9 | el.content:insert(pandoc.Space()) | ||
10 | el.content:insert(pandoc.Link(pandoc.RawInline('html', | ||
11 | '<svg class="o-icon" width="1em" height="1em"><use href="/symbols.svg#icon-link"></use></svg>'), | ||
12 | '#' .. el.identifier, nil, { class = 's-headlines__link' })) | ||
13 | end | ||
14 | |||
15 | return el | ||
16 | end | ||