Skip to content

Commit

Permalink
dev: perform nullish checking on creating labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Mar 31, 2024
1 parent 6e28da8 commit d157130
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions contrib/typst/gh-pages.typ
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,20 @@
show heading : it => {
block({
if is-web-target {
let title = plain-text(it.body).trim();
update-ld(title)
context ({
let loc = here();
let dest = get-ld(loc, title);
let h = measure(it.body).height;
place(left, dx: - 20pt, [
#set text(fill: dash-color)
#link(loc)[\#] #dest
])
});
let title = plain-text(it.body);
if title != none {
let title = title.trim();
update-ld(title)
context ({
let loc = here();
let dest = get-ld(loc, title);
let h = measure(it.body).height;
place(left, dx: - 20pt, [
#set text(fill: dash-color)
#link(loc)[\#] #dest
])
});
}
}
it
})
Expand Down

0 comments on commit d157130

Please sign in to comment.