Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to globally allow \n characters, convert to <br /> #1738

Open
jpike88 opened this issue Feb 24, 2021 · 2 comments
Open

Be able to globally allow \n characters, convert to <br /> #1738

jpike88 opened this issue Feb 24, 2021 · 2 comments

Comments

@jpike88
Copy link

jpike88 commented Feb 24, 2021

I use handlebars with Mpdf, which reads html and converts to pdf.

I have a large set of values, SOME may have newlines in them \n, some may not. They currently do not carry through, meaning some values will not have their new lines represented properly.

I'm currently stuck with two choices, both are ugly workarounds:

  • Convert all newline characters in values to <br /> in advance, and then make ALL the Handlebars placeholders three brackets. This is undesirable as the template will be a pain to read, two brackets is plenty enough to deal with
  • Try to do use a global css rule that uses white-space:pre-line, which risks breaking other aspects of the template.

New line characters are a special case in HTML as they don't really correspond to HTML entities the same way other special characters do. An ability to passive convert values in two brackets placeholders to <br /> is the truest way to handle a situation like this. Even if it's just opt-in, I think it would be extremely useful.

@ErfanKamalian
Copy link

#1805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants