rescript-lang / rescript-lang/rescript-react
Transform HTML entities to unicode
Nobody has claimed this yet.
- Dominant language
- ReScript
- Stars
- 517
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the React PPX JSX transformation and compare its behavior with Babel's linked JSX entity map. Use the Babel and ReScript examples in the issue as cases to check; done means supported HTML entities produce the corresponding Unicode characters as Babel does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, react
- Domain
- frontend, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100