Hmm, this looks like a bug of Typst… I’ll inspect it later.
For now, you can skip the number for unnumbered sections by changing the relevant code in #show outline.entry: it => { … } as follows.
// For sections:
link(el.location(), it.indented(
// 👇 This `if … != (0,)` is new.
if counter(heading).at(el.location()) != (0,) {
counter(heading).display(at: el.location())
},
it.inner(),
))
You are in the right direction. This should work:
#show outline.entry.where(level: 4): it => link(
it.element.location(),
it.indented(
it.prefix(),
[_#it.body()_ #box(width: 1fr, outline.entry.fill) #it.page()],
),
)
Perhaps someone will improve the documentation about this. Before that, we can let x = it.inner() and hover x to view the default implementation.

