Update: I figured it out myself. It’s it.prefix().children.at(2)
.
The final code thus becomes:
// Make the Lists of Figures/Tables/... more concise and easier to read, like in the LaTeX templates
show outline.entry: it => context {
if it.element.has("kind") {
let loc = it.element.location()
if counter(figure.where(kind: it.element.kind)).at(loc).first() == 1 {
v(1em)
}
show link: set text(rgb("000000"))
block(
link(loc,
box(it.prefix().children.at(2), width: 2.6em) // figure number
+ it.body() // figure caption
+ box(it.fill, width: 1fr)
+ it.page()
)
)
} else {
it
}
}