add: article link prepend
This commit is contained in:
parent
9f4d18863e
commit
a757f69e82
3 changed files with 59 additions and 8 deletions
20
prepends/article_link.typ
Normal file
20
prepends/article_link.typ
Normal 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]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue