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

Improve inline elements parsing #13420

Closed
TCOTC opened this issue Dec 10, 2024 · 1 comment
Closed

Improve inline elements parsing #13420

TCOTC opened this issue Dec 10, 2024 · 1 comment
Assignees
Milestone

Comments

@TCOTC
Copy link
Contributor

TCOTC commented Dec 10, 2024

方法来源于 https://ld246.com/article/1717657383372

<span data-type="text" style="text-emphasis-style: dot; text-emphasis-position: under;">着重符号<span> ((20241210194444-oqwwntf "*"))

我不理解这个是怎么解析的,为什么会有两种结果:

video.webm
@88250 88250 self-assigned this Dec 10, 2024
@88250
Copy link
Member

88250 commented Dec 11, 2024

严格来说是有 bug,但是目前没有太好的方案解决。

这个问题源自 着重符号<span> 这里的结束标记没有匹配,使用 </span> 才能匹配,解析过程中最后匹配到的是后面的引用 <span data-type="block-ref" data-subtype="s" data-id="20241210194444-oqwwntf">*</span></span>,然后 HTML 解析器在这种情况下可以正确解析出两个 span 节点,所以结果刚好正确。

image

image

而如果没有 </span> 结束标记的话无法正确解析 <span data-type> 为 lute ast 行级节点,所以返回了行级 HTML 节点(最终渲染为文本节点):

image

这个问题稍后会改进解析,判断 span 是否正确匹配。

88250 added a commit to 88250/lute that referenced this issue Dec 11, 2024
@88250 88250 changed the title 编辑器解析疑问 Improve inline elements parsing Dec 11, 2024
@88250 88250 closed this as completed Dec 11, 2024
@88250 88250 added this to the 3.1.16 milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants