Whitespace is incorrectly preserved when `xmlWhitespaceSensitivity` is set to `ignore`
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- tooling
调研方向
在 XML 插件实现中搜索 xmlWhitespaceSensitivity,以及当前基于 String#trim 或 \s 的处理方式。使用包含制表符、换行符、空格和所列非 XML 空白字符的 XML 文本重现该行为。当 sensitivity 设置为 ignore 时,仅修剪制表符、换行符、回车符和空格,即表示完成。
由索引模型根据 Issue 内容生成。
描述
According to the XML specification, only \t, \n, \r, and (space character) are considered whitespace and are affected by the xml:space attribute. As it has been already raised in #768, the plugin used String#trim() to remove whitespace characters, affecting also other non-XML whitespace characters:
- U+00A0 No-Break Space
- U+1680 Ogham Space Mark
- U+2000 En Quad
- U+2001 Em Quad
- U+2002 En Space
- U+2003 Em Space
- U+2004 Three-Per-Em Space
- U+2005 Four-Per-Em Space
- U+2006 Six-Per-Em Space
- U+2007 Figure Space
- U+2008 Punctuation Space
- U+2009 Thin Space
- U+200A Hair Space
- U+2028 Line Separator
- U+2029 Paragraph Separator
- U+202F Narrow No-Break Space
- U+205F Medium Mathematical Space
- U+3000 Ideographic Space
- U+FEFF Zero Width No-Break Space
This issue has been fixed in 6170e95. However, the fix still affects most of the characters mentioned above due to the usage of the \s character class and the issue described originally in #768 still persists.
Probably the easiest way to fix the issue is to replace the \s character class with the (space character):
const content = chardata.TEXT.replaceAll(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");
- 主要语言
- JavaScript
- 星标
- 278
- 派生
- 46
- 平均合并
- 1 分钟
- 30 天内合并 PR
- 15
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
prettier/plugin-xml 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 58/100
prettier/plugin-xml#996 ·
-
难度 3/5 1-2 天 新手友好度 58/100
prettier/plugin-xml#995 ·
-
难度 3/5 1-2 天 新手友好度 45/100
prettier/plugin-xml#986 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 55/100
prettier/plugin-xml#981 ·
-
难度 5/5 一周以上 新手友好度 35/100
prettier/plugin-xml#937 · 1 个 reaction ·
查看 prettier/plugin-xml 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
curriculum documentation quality
难度 2/5 1-3 小时 新手友好度 78/100
githubnext/gh-aw-workshop#3897 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
难度 2/5 1-3 小时 新手友好度 91/100
维护者通常 1 天内回复