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

Reformatting breaks certain HTML entities #1283

Closed
jpike88 opened this issue Mar 15, 2021 · 10 comments · Fixed by #1284
Closed

Reformatting breaks certain HTML entities #1283

jpike88 opened this issue Mar 15, 2021 · 10 comments · Fixed by #1284

Comments

@jpike88
Copy link

jpike88 commented Mar 15, 2021

I use the VSCode extension handlebars-formatter (https://github.com/mfeckie/handlebars-formatter) which relies on prettier (https://github.com/prettier/prettier) which in turn relies on glimmer.

I tried to format this:

<span class="stampFont" style="font-family: 'stampfont'">&#xf000;</span>

That entity is valid HTML and shouldn't be stripped... but it gets changed to this:

<span class="stampFont" style="font-family: 'stampfont'">
  
</span>
@jpike88
Copy link
Author

jpike88 commented Mar 15, 2021

@jpike88
Copy link
Author

jpike88 commented Mar 15, 2021

@pzuraq what are your thoughts on this one? it's a big problem for me and I'd like to contribute if it's a non-trivial fix.

@pzuraq
Copy link
Member

pzuraq commented Mar 15, 2021

Definitely would be open to a fix, unsure exactly where this would be transforming in the system itself, likely when we first read the text node's content?

@rwjblue
Copy link
Member

rwjblue commented Mar 15, 2021

@jpike88 - We explicitly provide modes that disable entity parsing, seems like they should be leveraging that?

@rwjblue
Copy link
Member

rwjblue commented Mar 15, 2021

See #938

@thorn0
Copy link

thorn0 commented Mar 15, 2021

Prettier uses that setting. Named entities are preserved, numeric character reference aren't.

@jpike88
Copy link
Author

jpike88 commented Mar 16, 2021

This use case is because I have large custom font libraries consisting of symbols.

@rwjblue
Copy link
Member

rwjblue commented Mar 16, 2021

Thank you! I believe that #1284 will fix this (added your snippet as a test case to confirm).

@rwjblue
Copy link
Member

rwjblue commented Mar 16, 2021

@jpike88
Copy link
Author

jpike88 commented Mar 16, 2021

cheers!

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

Successfully merging a pull request may close this issue.

4 participants