permalinks and make non-h1 headers smaller

This commit is contained in:
Ben Harris 2019-09-23 11:41:02 -04:00
parent 8e95deabfa
commit 892f13da8e
3 changed files with 22 additions and 7 deletions

View File

@ -1,12 +1,12 @@
ISSUES != find issues -type d
DEST_PDF_FILES := $(ISSUES:issues/%=issue-%.pdf)
DEST_HTML_FILES := $(ISSUES:issues/%=issue-%.html)
DEST_PDF_FILES := $(ISSUES:issues/%=dist/issue-%.pdf)
DEST_HTML_FILES := $(ISSUES:issues/%=dist/issue-%.html)
PANDOC != command -v pandoc 2> /dev/null
all: $(DEST_PDF_FILES) $(DEST_HTML_FILES)
issue-%.pdf: issues/%
dist/issue-%.pdf: issues/%
$(PANDOC) \
--file-scope \
--from markdown \
@ -18,22 +18,24 @@ issue-%.pdf: issues/%
--output $@ \
$</*.md
issue-%.html: issues/%
dist/issue-%.html: issues/%
$(PANDOC) \
--file-scope \
--from markdown \
--to html \
--standalone \
--table-of-contents \
--lua-filter header-permalinks.lua \
--lua-filter increase-header-levels.lua \
--metadata title:"tildeverse zine $@" \
--metadata include-before:"<div class=\"container\">" \
--metadata include-after:"</div>" \
--variable include-before:"<div class=\"container\">" \
--variable include-after:"</div>" \
--css https://tilde.team/css/hacker.css \
--output $@ \
$</*.md
clean:
rm *.html *.pdf
rm dist/*.html dist/*.pdf
.PHONY: clean

6
header-permalinks.lua Normal file
View File

@ -0,0 +1,6 @@
function Header(elem)
table.insert(elem.content, pandoc.Space())
table.insert(elem.content, pandoc.Link("§", "#" .. elem.identifier))
return elem
end

View File

@ -0,0 +1,7 @@
function Header(elem)
if elem.level > 1 then
elem.level = elem.level + 1
end
return elem
end