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

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.

About this issue

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

Most upvoted comments

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.

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

@MrEfrem That has been fixed in master and should be available in the next release!

@oscar-b can you open a separate issue for that?