jgm/typst-hs

Pandoc error on multline string

Closed this issue · 5 comments

#let a = "
This is a
multiline string
"

This is a valid typst document but results in the following pandoc error:

".\tmp.typ" (line 1, column 11):
unexpected "\n"
expecting "\"" or "\\"
jgm commented

Can you point to any typst documentation on multiline strings?

Just looked quickly through docs, issues, and typst codebase tests. I can't seem to find any references to this behavior.

@laurmaedje Is this public behavior, or is it not guaranteed that future version of typst preserve and allow newlines in a string expression? If it's public, it might be good to add a comment in the docs

There is no guarantee in the sense that breaking changes might occur, but it's public and intended behaviour.

jgm commented

Is there any special syntax? Can you just put line breaks inside any string, or does the initial " need to be followed by a newline and the final " preceded by one?

You can just put linebreaks anywhere.