How can I make Typst automatically line wrap long arbitrary words?

I have a document used for generating a PDF from some user input.

Something like:

Here is the user's message: #sys.inputs.at("message")

This works fine except when the user’s message contains a very long word such as 1000 A’s:

typst compile test.typ --input message="$(python -c 'print("A" * 1000)')"

Is there a way to get typst to automatically insert line breaks when a single word is longer than the current line?

The simplest way is probably to enable hyphenation for exactly the input. That will also allow breaking a word if it’s shorter than an entire line, though, just in case that’s a problem.

1 Like

I thought I already tried this without it working, but it works for me now. Thanks!

1 Like