Bauke/cv
Bauke
/
cv
Archived
1
Fork 0
This repository has been archived on 2025-07-20. You can view files and clone it, but cannot push or open issues or pull requests.
cv/utilities/content-to-string.typ

16 lines
511 B
Plaintext

// Convert a `Content` type to a string by recursively going through it and
// collecting any text nodes, discarding everything else.
// Copied from GitHub:
// https://github.com/typst/typst/issues/2196#issuecomment-1728135476
#let content_to_string(content) = {
if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(content_to_string).join("")
} else if content.has("body") {
content_to_string(content.body)
} else if content == [ ] {
" "
}
}