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

包含转义符的文本无法替换 #14173

Closed
TCOTC opened this issue Feb 21, 2025 · 2 comments
Closed

包含转义符的文本无法替换 #14173

TCOTC opened this issue Feb 21, 2025 · 2 comments

Comments

@TCOTC
Copy link
Contributor

TCOTC commented Feb 21, 2025

https://ld246.com/article/1740150873393

<span data-type="virtual-block-ref">

复制,粘贴纯文本:

video.webm
@88250
Copy link
Member

88250 commented Feb 22, 2025

这个问题无法解决了,因为粘贴纯文本后 = 会被转义为 \=,而搜索是在 content 字段上的,这个字段没有转义符,所以可以命中原文本 <span data-type="virtual-block-ref">,但是替换的时候是在语法树上执行的,语法树节点:

  • <span data-type 文本节点
  • \= 转义节点
  • "virtual-block-ref"> 文本节点

遍历语法树节点的时候无法完整匹配到原文本,所以无法替换。

@88250 88250 closed this as completed Feb 22, 2025
@88250 88250 changed the title 文本无法替换 包含转义符的文本无法替换 Feb 22, 2025
@TCOTC
Copy link
Contributor Author

TCOTC commented Feb 22, 2025

粘贴纯文本后 = 会被转义为 \=

这个是为什么?= 应该没有必要转义吧?

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

No branches or pull requests

2 participants