add: article link prepend

This commit is contained in:
andrew 2026-06-11 14:56:56 -04:00
parent 9f4d18863e
commit a757f69e82
3 changed files with 59 additions and 8 deletions

20
prepends/article_link.typ Normal file
View file

@ -0,0 +1,20 @@
#let article_link(path) = {
let file-path = path + "index.typ"
let content = read(file-path)
let title = none
for line in content.split("\n") {
let trimmed = line.trim()
if trimmed.starts-with("= ") {
title = trimmed.slice(2).trim()
break
}
}
if title == none {
panic("No level-1 heading found in " + file-path)
}
link(path)[#title]
}