We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mp-html 只内置了部分的实体字符配置,如果服务端下发的富文本包含其他类型的实体字符会导致这些实体字符无法正确显示。
例如:↑ 需要显示 ↑。
↑
<mp-html content="↑" />
我自己 fork 了一份源码,基于 html-entities 修改了实体字符解码的实现来应急修复项目问题,看下这块是否需要内置,还是以插件的形式交给外部定制。
https://github.com/jin-yufeng/mp-html/blob/8b4ff8f7c5/src/miniprogram/parser.js#L110
// ... let entity = config.entities[code] if (!entity) { const entityCode = '&' + code + ';' entity = decodeHTMLEntity(entityCode) if (entity === entityCode) { entity = undefined } } if (entity || (code === 'amp' && amp)) { str = str.substr(0, i) + (entity || '&') + str.substr(j + 1) } // ...
The text was updated successfully, but these errors were encountered:
把需要用到实体编码的添加到 这里 即可,全部实体所占空间比较大,因此只配置了一些常用的
Sorry, something went wrong.
除了箭头还用到哪些?不多且比较常用的话可以内置一下
增加支持一些常用实体编码 #418
376b720
标准里的有点多,我看 htm-entities 里实体字符的映射配置就有 70 多 KB 了,可能还是得交给外部定制吧。
https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
No branches or pull requests
使用环境
问题描述
mp-html 只内置了部分的实体字符配置,如果服务端下发的富文本包含其他类型的实体字符会导致这些实体字符无法正确显示。
例如:
↑
需要显示 ↑。复现方式
我自己 fork 了一份源码,基于 html-entities 修改了实体字符解码的实现来应急修复项目问题,看下这块是否需要内置,还是以插件的形式交给外部定制。
https://github.com/jin-yufeng/mp-html/blob/8b4ff8f7c5/src/miniprogram/parser.js#L110
The text was updated successfully, but these errors were encountered: