I have a very long document and would like to export only specific sections. Ideally, I would specify chapter titles or numbers when exporting without modifying the content.
Impossible. You have to modify something. Also, content is probably too vague here.
2 very basic things come to mind:
Opt-in export with extra file:
#let export(body) = body + [#metadata(body)<export>]
#lorem(500)
#lorem(500)
#export[
#lorem(50) // export
#lorem(20) // export
]
#lorem(500)
#export[
#lorem(10) // export
]
#lorem(500)
#place(hide(include "main.typ"))
#context query(<export>).map(it => it.value).join(parbreak())
Opt-out export or opt-in hide/unexport with any kind of switch:
#let do-show = true
#let do-show = false
#let shows(body) = if do-show { body }
#shows[
#lorem(500)
#lorem(500)
]
#lorem(50) // export
#lorem(20) // export
#shows[
#lorem(500)
]
#lorem(10) // export
#shows[
#lorem(500)
]
Well, there are too many internal links in my document, making it difficult to split up
It’s far less automatic but would cutting up the whole PDF work for you?
It sounds like the size of your document might have outgrown its structure, making it difficult to compile anything less than the entire document.
If you mean references, you probably can use let shows(body) = if do-show { body } else { place(hide(body)) }. Though the jumps will obviously be useless. Or you can strip link from the ref with a show rule.
Typst compile supports a page range, so then all you need is the corresponding pages. I think a typst query can get this information. For typst query, you might need some setup in the document, for the coming typst eval, that’s not necessary.