Browse Source

permalinks and make non-h1 headers smaller

pull/4/head
Ben Harris 2 years ago
parent
commit
892f13da8e
  1. 16
      Makefile
  2. 6
      header-permalinks.lua
  3. 7
      increase-header-levels.lua

16
Makefile

@ -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

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

7
increase-header-levels.lua

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