Thank you both for the replies. This gave me enough to figure out how to extract the right pieces. Looks like the following works:
show outline.entry: it => link(
it.element.location(),
it.indented(it.prefix(), [
#to-string(it.element.caption.body.children.flatten().join()).split(".").first()
#box(width: 1fr, repeat(".", gap: 0.15em))
#it.page()
])
)
where
let to-string(content) = {
if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(to-string).join("")
} else if content.has("body") {
to-string(content.body)
} else if content == [ ] {
" "
}
}