Skip to content

Improve inline elements parsing #13420

Closed
Closed
@TCOTC

Description

@TCOTC
Contributor

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

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

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

video.webm

Activity

self-assigned this
on Dec 10, 2024
88250

88250 commented on Dec 11, 2024

@88250
Member

严格来说是有 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 是否正确匹配。

changed the title [-]编辑器解析疑问[/-] [+]Improve inline elements parsing[/+] on Dec 11, 2024
added a commit that references this issue on Dec 11, 2024
added this to the 3.1.16 milestone on Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @88250@TCOTC

      Issue actions

        Improve inline elements parsing · Issue #13420 · siyuan-note/siyuan