question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[JSX] Do not convert html-escaped entities to their prettier forms

See original GitHub issue

Most HTML entity names & numbers are converted to their literal form. Seems   < > are the only exceptions? (  escaping was fixed in #557)

Is this expected?

<span>
  // not converted
  &nbsp; &#160;
  &lt; &#60;
  &gt; &#62;
  // converted
  &amp; &#38;
  &quot; &#34;
  &apos; &#39;
  &aacute; &#225;
</span>

turns into

<span>
  // not converted
  &nbsp; &nbsp;
  &lt; &lt;
  &gt; &gt;
  // converted
  & &
  " "
  ' '
  á á
</span>;

https://jlongster.github.io/prettier/#{"content"%3A"<span>\n %2F%2F not converted\n %26nbsp%3B %26%23160%3B\n %26lt%3B %26%2360%3B\n %26gt%3B %26%2362%3B\n %2F%2F converted\n %26amp%3B %26%2338%3B\n %26quot%3B %26%2334%3B\n %26apos%3B %26%2339%3B\n %26aacute%3B %26%23225%3B\n<%2Fspan>\n\n"%2C"options"%3A{"printWidth"%3A80%2C"tabWidth"%3A2%2C"singleQuote"%3Afalse%2C"trailingComma"%3Afalse%2C"bracketSpacing"%3Atrue%2C"doc"%3Afalse}}

Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
rattrayalexcommented, Mar 22, 2017

https://github.com/babel/babylon/pull/344 and https://github.com/babel/babel/pull/5256 have been approved – I am told they should be merged into Babel 7.0.

1reaction
yamafaktorycommented, May 9, 2017

@MrEfrem this should have been fixed by #1165 🤞.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix this violation of this 'react/no-unescaped-entitie' of ...
One way to fix the react/no-unescaped-entities error is by assigning the text with the escape character in it to a variable and then ......
Read more >
Replace Html Entities : r/reactjs - Reddit
I'm fetching data from "Open Trivia DB" for a quiz app. The json data that comes has i'm not sure about the name...
Read more >
JSX Gotchas | React
HTML Entities ​​ If you want to display an HTML entity within dynamic content, you will run into double escaping issues as React...
Read more >
Rationale - Prettier
JSX takes its roots from HTML, where the dominant use of quotes for attributes is double quotes. ... Prettier maintains the way your...
Read more >
Escaping Special Characters < JavaScript | The Art of Web
If you have a string to decode, use the buttons on the right instead. INPUT: The function you select will be applied to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found