Closed Snafuuz closed 11 months ago
Escaping of interpolation tags is the only situation where Mustache makes assumptions about the target language. Other than that, it's on you. If Mustache started inserting HTML tags, that would break the template language for many users.
Closing this, as this repository is only about the Mustache website, not about the template language.
What should I do if my content can contain line breaks? In general, content is HTML encoded while rendering, but that does not affect \n
What should I do if my content is a multi-line string?
pre-process the text, replacing newlines by
tags? => then I cannot use mustache's built-in HTML encoding for the content, as it would HTML-encode each
tag to <br>
post-process the rendered output, replacing newlines by
? => I might incorrectly encode newlines which were not part of any content
Do all the HTML encoding of my content myself, so I can convert newlines to
and then use a triple{{{}}} tag for my content => this seems to be the only working solution, but it seems a little cumbersome
Since content is HTML-encoded by default, wouldn't it make sense then, to also convert newlines in content to
tags?