1
0

make headings link to themselves

This commit is contained in:
Simon Michael
2023-11-30 14:19:37 -10:00
parent 765ee49157
commit ed2b2fd2a1
4 changed files with 17 additions and 3 deletions

View File

@@ -15,10 +15,11 @@ html-cfp:
MD2HTML=$(PANDOC) \ MD2HTML=$(PANDOC) \
-f markdown-smart-tex_math_dollars+autolink_bare_uris+wikilinks_title_after_pipe \ -f markdown-smart-tex_math_dollars+autolink_bare_uris+wikilinks_title_after_pipe \
--lua-filter=wikilinks.lua --lua-filter=wikilinks.lua \
--lua-filter=headings.lua \
# generate html from a md file # generate html from a md file
out/%.html: src/%.md page.tmpl out/%.html: src/%.md #page.tmpl wikilinks.lua headings.lua
$(MD2HTML) --template page.tmpl "$<" -o "$@" $(MD2HTML) --template page.tmpl "$<" -o "$@"
# regenerate html whenever an md file changes # regenerate html whenever an md file changes

7
headings.lua Normal file
View File

@@ -0,0 +1,7 @@
-- Make all headings (except the page h1 added by page.tmpl)
-- clickable links to themselves, for easy bookmarking/linking.
function Header(el)
el.content = pandoc.Link(el.content, '#' .. el.identifier)
return el
end

View File

@@ -10,6 +10,12 @@ h1, h2, h3, h4, h5, h6 {
text-shadow: 1px 1px 2px white; text-shadow: 1px 1px 2px white;
} }
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a,
h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {
text-decoration:none;
color:inherit;
}
.tight p { .tight p {
margin:0; margin:0;
} }

View File

@@ -35,7 +35,7 @@
<div class="container"> <div class="container">
<p><a href="/">plaintextaccounting.org</a></p> <p><a href="/">plaintextaccounting.org</a></p>
<h1>$title$</h1> <h1><a href="">$title$</a></h1>
$body$ $body$