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

Lute 实例提供 BlockDOM2Md 函数 #5922

Closed
Zuoqiu-Yingyi opened this issue Sep 22, 2022 · 2 comments
Closed

Lute 实例提供 BlockDOM2Md 函数 #5922

Zuoqiu-Yingyi opened this issue Sep 22, 2022 · 2 comments
Assignees
Milestone

Comments

@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Sep 22, 2022

在什么情况下你需要该特性?In what scenarios do you need this feature?

v2.1.14 版本中使用 API /api/history/getDocHistoryContent + Lute 的 BlockDOM2Md 接口与 API /api/block/getBlockKramdown 实现了文档历史的差异对比功能, 但是 v2.2.0 版本中移除了 Lute 的 BlockDOM2Md 接口, 导致该功能夭折了

希望提供一种可以获得指定历史文档 kramdown 源码的 API

描述可能的最优解决方案 Describe the optimal solution

内核/Lute 提供 *.sy(文件或文本) => kramdown 文本接口

描述候选的解决方案 Describe the candidate solution

内核/Lute 提供 BlockDOM 文本 => kramdown 文本接口

其他信息 Other information

希望该接口输出的 kramdown 的 IAL 与 API /api/block/getBlockKramdown 获得的 kramdown 源码 IAL 属性名顺序一致, 或者说按照同一个规范排序, 以保证相同 IAL 转换而来的 IAL 字符串是完全一致的

该功能同样用于文档历史的差异对比分析

@88250 88250 self-assigned this Sep 22, 2022
@88250 88250 added this to the 2.2.1 milestone Sep 22, 2022
@88250 88250 changed the title 提供解析指定历史文档 kramdown 源码的 API Lute 实例提供 BlockDOM2Md 函数 Sep 22, 2022
@Zuoqiu-Yingyi
Copy link
Contributor Author

还发现了一个问题, 当 BlockDOM 中 contenteditable="false" 时, lute.BlockDOM2StdMd 也无法正常解析, 如下所示

<div data-node-id="20220922163433-mhzu1yl" data-type="NodeParagraph" class="p" custom-quote-time="2022-09-22 16:34:33" custom-quote-type="comment" updated="20220922163433" custom-quote-id="20220922163433-0iemj98">
    <div contenteditable="false" spellcheck="false">测试</div>
    <div class="protyle-attr" contenteditable="false"></div>
</div>

解析为: <div contenteditable="false" spellcheck="false">测试</div>


<div data-node-id="20220922163433-mhzu1yl" data-type="NodeParagraph" class="p" custom-quote-time="2022-09-22 16:34:33" custom-quote-type="comment" updated="20220922163433" custom-quote-id="20220922163433-0iemj98">
    <div contenteditable="true" spellcheck="false">测试</div>
    <div class="protyle-attr" contenteditable="false"></div>
</div>

解析为: 测试

88250 added a commit to 88250/lute that referenced this issue Sep 23, 2022
@88250 88250 closed this as completed Sep 23, 2022
@88250
Copy link
Member

88250 commented Sep 23, 2022

contenteditable="false" 时不会解析节点

https://github.com/88250/lute/blob/a1a21c8c750148dc055576a7c5112bd67b55afd9/protyle.go#L728

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