rescript-lang / rescript-lang/rescript-react

Transform HTML entities to unicode

未关闭
#15 9 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
ReScript
星标
517
派生
45
PR 合并指标
30 天内没有已合并 PR

描述

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>&nbsp;</div>;
output
let f = () => /*#__PURE__*/React.createElement("div", null, "\xA0");

ReScript example

Input

let f = () => <div> {React.string("&nbsp;")} </div>

Output

function f(param) {
  return React.createElement("div", undefined, "&nbsp;");
}

Note that "&nbsp; will render as-is, not as an actual nonbreaking space character.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 React PPX JSX 转换开始,并将其行为与 Babel 链接的 JSX 实体映射进行比较。使用 issue 中的 Babel 和 ReScript 示例作为检查用例;当受支持的 HTML 实体像 Babel 一样生成对应的 Unicode 字符时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
babel, react
领域
frontend, tooling
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。