commit 0f54d58ba8ad65d8c4d8ac5a4001ee3d857a3a1e
parent f0aef3221064627fde6a014b128c06177accab7a
Author: corndog <cauchyn@firemail.cc>
Date: Mon, 26 Nov 2018 12:04:16 -0800
Add local anchor to post headings (minus title)
Diffstat:
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/anchor.lua b/anchor.lua
@@ -0,0 +1,10 @@
+function anchor(header)
+ if header.level >= 2 then
+ anchor_attr = pandoc.Attr("", {}, {{"class", "local-anchor"}})
+ anchor = pandoc.Link("🔗", "#" .. header.identifier, nil, anchor_attr)
+ header.content:extend({pandoc.Space(), anchor})
+ end
+ return header
+end
+
+return {{Header = anchor}}
diff --git a/config b/config
@@ -7,7 +7,7 @@ URL = https://grgr.me/
*.md:
config
inner-template
- external pandoc --to html --lua-filter wordcount.lua
+ external pandoc --to html --lua-filter wordcount.lua --lua-filter anchor.lua
external python3 youtube-embed.py
template page
ext .html
diff --git a/in/static/style.css b/in/static/style.css
@@ -94,6 +94,11 @@ button:hover > img.embed {
font-weight: 700;
}
+.local-anchor {
+ font-size: 0.9em;
+ text-decoration: none;
+}
+
.tab {
margin-left: 4px;
}