Skip to content
New issue

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

fix: unexpected transform for tags within attribute #1872

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

PeachScript
Copy link
Member

🤔 这个变动的性质是?/ What is the nature of this change?

  • 新特性提交 / New feature
  • bug 修复 / Fix bug
  • 样式优化 / Style optimization
  • 代码风格优化 / Code style optimization
  • 性能优化 / Performance optimization
  • 构建优化 / Build optimization
  • 网站、文档、Demo 改进 / Website, documentation, demo improvements
  • 重构代码或样式 / Refactor code or style
  • 测试相关 / Test related
  • 其他 / Other

🔗 相关 Issue / Related Issue

Close #1836
Ref: #1861

💡 需求背景和解决方案 / Background or solution

修复 Markdown 组件属性上的标签被意外转换的 bug,解法有两个:

  1. 参考 refactor: matching jsx component logic in string fragments #1861 对正则做优化,仅 <Foo <Foo> 的匹配才被认定为是组件,这样可以直接过滤掉类似 Array<Function> 的类型声明
  2. 在正则匹配替换时,对匹配字符串的前后内容做识别,如果发现是 ="...{匹配值}..." 就认定是在属性内的值不做处理,这样可以覆盖类似 <CodeEditor value="<Foo bar></Foo>"></CodeEditor> 的场景

📝 更新日志 / Changelog

Language Changelog
🇺🇸 English Fix unexpected transform for tags within attribute
🇨🇳 Chinese 修复属性内的标签字符串被意外转换的问题

@vercel
Copy link

vercel bot commented Sep 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dumi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 7, 2023 2:06am

@PeachScript PeachScript merged commit 8d40a74 into master Sep 15, 2023
8 checks passed
@PeachScript PeachScript deleted the hotfix/md-component-attr-value branch September 15, 2023 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: 在自定义组件属性中填写TS类型字符串,被解析器识别为html标签。
2 participants