I don't know if this is possible and if there is demand but:
Current line breaking behavior
| source |
compiled |
| \n |
[ ] |
| \ |
linebreak() |
| >1 times \n |
parbreak() |
Want to be able to customize it to
| source |
compiled |
| \n |
linebreak() |
| > 1 times \n |
parbreak() |
| \\n |
continue line |
or maybe even
| source |
compiled |
| \n |
[ ] |
| \n\n |
linebreak() |
| >2 times \n |
parbreak() |
| \ |
linebreak() |
Bonus if this behavior can be changed depending on the context (e.g. in a paragraph vs table cell) and if rules for trimming line breaks in certain contexts can be defined.
Doing this in Typst code right now is almost impossible, mostly because
- show rules like
#show regex("\\s"): white_char => ... never capture line breaks in the source
- \n gets compiled to [ ] (making it indistinguishable from many other things that generate [ ])
- the content tree is currently not well traverseable and mutable.
I don't know if this is possible and if there is demand but:
Current line breaking behavior
Want to be able to customize it to
or maybe even
Bonus if this behavior can be changed depending on the context (e.g. in a paragraph vs table cell) and if rules for trimming line breaks in certain contexts can be defined.
Doing this in Typst code right now is almost impossible, mostly because
#show regex("\\s"): white_char => ...never capture line breaks in the source