Is there a canonical way to select direct children of a given element in typst?
For example, I already have a show rule putting every link into a box.
Now, I want all boxed links that are outline entries to have a different stroke color.
The full hierarchy would be: outline.entry → link → box.
How can I set box(stroke: (paint: green)), only if it is a direct descendant of link, only if that is a direct descendant of outline.entry?
I’m used to CSS which has a broad range of selectors, so knowing the Typst equivalent would be very helpful to me.
#show outline.entry: set block(stroke: green)
#show outline.entry: it => {
show block: it => {
set block(stroke: none)
it
}
it
}
#show outline.entry: set block(stroke: green)
#show outline.entry: it => {
show block: it => {
set block(stroke: none)
it
}
it
}
#set heading(numbering: "1.")
#outline()
= Heading
== Heading