-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
The Babel JSX compiler converts HTML entities into the unicode characters they represent. In ReScript, we have to use the actual unicode directly. For some characters, like
this isn't always convenient.
Would it be possible for the React PPX to do the same transformation that Babel does? See their entity map for reference: https://github.com/babel/babel/blob/b3e2bcda73dea7d68b4c82bfabb92acb11b1ed90/packages/babel-parser/src/plugins/jsx/xhtml.js
Babel example
Input
let f = () => <div> </div>;
output
let f = () => /*#__PURE__*/React.createElement("div", null, "\xA0");
ReScript example
Input
let f = () => <div> {React.string(" ")} </div>
Output
function f(param) {
return React.createElement("div", undefined, " ");
}
Note that "
will render as-is, not as an actual nonbreaking space character.
fhammerschmidt
Metadata
Metadata
Assignees
Labels
No labels