Skip to content

Improve the handling of inline-math containing | in the table #9227

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

Closed
3 tasks done
Zuoqiu-Yingyi opened this issue Sep 19, 2023 · 39 comments
Closed
3 tasks done

Improve the handling of inline-math containing | in the table #9227

Zuoqiu-Yingyi opened this issue Sep 19, 2023 · 39 comments
Assignees
Milestone

Comments

@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Sep 19, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

无法在表格输入含有 \| 符号的公式

输入后 \| 后刷新一次会变成 |
示例: 在表格内公式中输入 333 \| bar \| 444 后再刷新文档, 该公式会变成 333 | bar | 444

思源笔记-bug反馈-53

该问题产生的原因: Lute 无法正确解析表格中的行内公式

含有符号 | 的行内公式在表格中 应按照如下方案进行转义

$111 | foo | 222$

|                     |
| ------------------- |
| $111 \| foo \| 222$ |

---

$333 \| bar \| 444$

|                       |
| --------------------- |
| $333 \\| bar \\| 444$ |

当前使用的方案

$111 | foo | 222$

|      |
| ---- |
| $111 | foo | 222$ |

---

$333 \| bar \| 444$

|      |
| ---- |
| $333 | bar | 444$ |

受影响的方法

  • Markdown import
  • Markdown export
  • database markdown field
  • kernel API /api/export/exportMdContent
  • kernel API /api/block/getBlockKramdown
  • lute.BlockDOM2StdMd
  • lute.BlockDOM2Md

Expected result

$111 | foo | 222$ 在表格中表示为

|                     |
| ------------------- |
| $111 \| foo \| 222$ |

$333 \| bar \| 444$ 在表格中表示为

|                       |
| --------------------- |
| $333 \\| bar \\| 444$ |

Screenshot or screen recording presentation

No response

Version environment

- Version: 2.10.6
- Operating System: 
- Browser (if used):

Log file

无有效信息输出

More information

No response

@88250
Copy link
Member

88250 commented Sep 20, 2023

能够解决这个情况:

image

但是对于这个情况无法解决(因为解析器解析块级表格 | 优先级高于行级):

image

@88250 88250 changed the title Can't correct handle inline formula in table Improve the handling of inline-level formulas containing escape char \ in the table Sep 20, 2023
@88250 88250 self-assigned this Sep 20, 2023
@88250 88250 added this to the 2.10.7 milestone Sep 20, 2023
88250 added a commit to 88250/lute that referenced this issue Sep 20, 2023

Verified

This commit was signed with the committer’s verified signature.
…cape char \ in the table siyuan-note/siyuan#9227
88250 added a commit to 88250/lute that referenced this issue Sep 20, 2023

Verified

This commit was signed with the committer’s verified signature.
…cape char \ in the table siyuan-note/siyuan#9227
88250 added a commit that referenced this issue Sep 20, 2023

Verified

This commit was signed with the committer’s verified signature.
…r `\` in the table #9227
@88250 88250 closed this as completed Sep 20, 2023
@Zuoqiu-Yingyi
Copy link
Contributor Author

但是对于这个情况无法解决(因为解析器解析块级表格 | 优先级高于行级):

image

保证表格内行内公式与表格外行内公式相同的内容渲染一致即可

@88250
Copy link
Member

88250 commented Sep 20, 2023 via email

@Zuoqiu-Yingyi
Copy link
Contributor Author

嗯,等发版看看。

我拉取后试了一下, 发现导出预览模式下依旧未正确渲染

该问题同时影响导出的内容

  • 导出 *.png
  • 导出 *.pdf
  • 导出 *.docx
  • 导出 *.html

image

@88250
Copy link
Member

88250 commented Sep 20, 2023

多谢测试,稍后再改改。

88250 added a commit to 88250/lute that referenced this issue Sep 20, 2023

Verified

This commit was signed with the committer’s verified signature.
…cape char \ in the table siyuan-note/siyuan#9227
@Zuoqiu-Yingyi
Copy link
Contributor Author

现在貌似引入了更多问题...

1. 表格中行内公式中的 | 在刷新后均被替换为 \|

思源笔记-bug反馈-54

2. 表格中行内公式中的 \\| 在刷新后无法正确解析

思源笔记-bug反馈-55

  • 奇数个 \ + \ 可以正确解析
  • 偶数个 \ + | 无法正确解析

@88250
Copy link
Member

88250 commented Sep 20, 2023 via email

@Zuoqiu-Yingyi
Copy link
Contributor Author

需要转义应该是合乎逻辑的。

转义应对用户透明,现在语义都发生变化了

@88250
Copy link
Member

88250 commented Sep 20, 2023 via email

@Zuoqiu-Yingyi
Copy link
Contributor Author

在公式编辑框中的内容应没有转义符
这里还有个严重的问题,katex 中 |\| 的语义是不同的,不能混淆

@88250
Copy link
Member

88250 commented Sep 21, 2023 via email

@Zuoqiu-Yingyi
Copy link
Contributor Author

将行内公式的 $ 符号视为另一种行内代码符号 ` 可以吗👀

@Zuoqiu-Yingyi
Copy link
Contributor Author

https://katex.org/docs/support_table#symbols

katex 有许多符号与其转义的语义不同,但标志符号 $ 仅有 \$ 这一种有效的语义,可以从这里入手,切无需考虑行内元素嵌套,属于行内元素的叶子节点

@88250 88250 reopened this Sep 21, 2023
@88250
Copy link
Member

88250 commented Sep 21, 2023

将行内公式的 $ 符号视为另一种行内代码符号 ` 可以吗👀

应该是可以的,等会改了看看。

@88250
Copy link
Member

88250 commented Sep 21, 2023

这问题可能涉及到之前的一些修改,这里做个复盘备注:

分别确认了下:

@88250 88250 changed the title Improve the handling of inline-level formulas containing escape char \ in the table Improve the handling of inline-level formulas containing | in the table Sep 21, 2023
88250 added a commit to 88250/lute that referenced this issue Sep 21, 2023

Verified

This commit was signed with the committer’s verified signature.
…` in the table siyuan-note/siyuan#9227
88250 added a commit to 88250/lute that referenced this issue Sep 21, 2023

Verified

This commit was signed with the committer’s verified signature.
…` in the table siyuan-note/siyuan#9227
88250 added a commit that referenced this issue Sep 21, 2023

Verified

This commit was signed with the committer’s verified signature.
… table #9227
@88250
Copy link
Member

88250 commented Sep 21, 2023

找到个方案,解析过程中使用 | 对应的 HTML 实体 | 以避免 | 参与表格解析,代码已经提交,请再测试看看。

88250 added a commit to 88250/lute that referenced this issue Sep 22, 2023

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit that referenced this issue Sep 22, 2023

Verified

This commit was signed with the committer’s verified signature.
@88250 88250 closed this as completed Sep 22, 2023
@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented Sep 22, 2023

@88250 Markdown 导出还是有一些问题

复现步骤

  1. 使用模板创建一个表格块, 如下所示
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;000&amp;#124;" contenteditable="false" class="render-node"></span>               |     |
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;111\&amp;#124;" contenteditable="false" class="render-node"></span>             |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\\&amp;#124;222\\&amp;#124;" contenteditable="false" class="render-node"></span>           |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\\\&amp;#124;333\\\&amp;#124;" contenteditable="false" class="render-node"></span>         |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\\\\&amp;#124;444\\\\&amp;#124;" contenteditable="false" class="render-node"></span>       |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\\\\\&amp;#124;555\\\\\&amp;#124;" contenteditable="false" class="render-node"></span>     |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\\\\\\&amp;#124;666\\\\\\&amp;#124;" contenteditable="false" class="render-node"></span>   |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\\\\\\\&amp;#124;777\\\\\\\&amp;#124;" contenteditable="false" class="render-node"></span> |     |

image

该表中每一行的公式为

$|000|$

$\|111\|$

$\\|222\\|$

$\\\|333\\\|$

$\\\\|444\\\\|$

$\\\\\|555\\\\\|$

$\\\\\\|666\\\\\\|$

$\\\\\\\|777\\\\\\\|$
  1. 将其导出为 Markdown, 导出的内容如下所示
|     | $\|000\|$                           |     |
| --- | ----------------------------------- | --- |
|     | $\\|111\\|$                         |     |
|     | $\\\\|222\\\\|$                     |     |
|     | $\\\\\\|333\\\\\\|$                 |     |
|     | $\\\\\\\\|444\\\\\\\\|$             |     |
|     | $\\\\\\\\\\|555\\\\\\\\\\|$         |     |
|     | $\\\\\\\\\\\\|666\\\\\\\\\\\\|$     |     |
|     | $\\\\\\\\\\\\\\|777\\\\\\\\\\\\\\|$ |     |
  1. 再使用导入 Markdown 文档功能导入刚刚导出的文件, 导入结果出现异常, 如下所示

image

该表中每一行的公式为

$|000|$

$\|111\|$

$\\\|222\\\|$

$\\\\\|333\\\\\|$

$\\\\\\\|444\\\\\\\|$

$\\\\\\\\\|555\\\\\\\\\|$

$\\\\\\\\\\\|666\\\\\\\\\\\|$

$\\\\\\\\\\\\\|777\\\\\\\\\\\\\|$

问题分析

经过测试, 如下的内容可以正确导入

|     | $\|000\|$               |     |
| --- | ----------------------- | --- |
|     | $\\|111\\|$             |     |
|     | $\\\|222\\\|$           |     |
|     | $\\\\|333\\\\|$         |     |
|     | $\\\\\|444\\\\\|$       |     |
|     | $\\\\\\|555\\\\\\|$     |     |
|     | $\\\\\\\|666\\\\\\\|$   |     |
|     | $\\\\\\\\|777\\\\\\\\|$ |     |

💡容易看出, 问题出现的原因是在导出时表格中公式内部的 \ 也被转义为 \\
导入过程不变, 在导出时

  • 不对 \ 进行转义
  • 仅将 | 转义为 \|

那么导出的内容再导入可以与导出前保持一致

@Zuoqiu-Yingyi
Copy link
Contributor Author

补充几个测试用例

✅ 导出导入一致

✅ 多个连续的 |

模板:

|     | <span data-type="inline-math" data-subtype="math" data-content="000" contenteditable="false" class="render-node"></span>                                                                                                     |     |
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;111&amp;#124;" contenteditable="false" class="render-node"></span>                                                                                 |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;222&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                                                             |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;&amp;#124;333&amp;#124;&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                                         |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;&amp;#124;&amp;#124;444&amp;#124;&amp;#124;&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                     |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;&amp;#124;&amp;#124;&amp;#124;555&amp;#124;&amp;#124;&amp;#124;&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span> |     |

表中每一行的公式:

$000$

$|111|$

$||222||$

$|||333|||$

$||||444||||$

$|||||555|||||$

导出内容:

|     | $000$                     |     |
| --- | ------------------------- | --- |
|     | $\|111\|$                 |     |
|     | $\|\|222\|\|$             |     |
|     | $\|\|\|333\|\|\|$         |     |
|     | $\|\|\|\|444\|\|\|\|$     |     |
|     | $\|\|\|\|\|555\|\|\|\|\|$ |     |

导入后渲染结果:
image

✅ 多个连续的 \|

模板:

|     | <span data-type="inline-math" data-subtype="math" data-content="000" contenteditable="false" class="render-node"></span>                                                                                                               |     |
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;111\&amp;#124;" contenteditable="false" class="render-node"></span>                                                                                         |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;222\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                                                                   |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;\&amp;#124;333\&amp;#124;\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                                             |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;444\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                       |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;555\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span> |     |

表中每一行的公式:

$000$

$\|111\|$

$\|\|222\|\|$

$\|\|\|333\|\|\|$

$\|\|\|\|444\|\|\|$

$\|\|\|\|\|555\|\|\|\|\|$

导出内容:

|     | $000$                               |     |
| --- | ----------------------------------- | --- |
|     | $\\|111\\|$                         |     |
|     | $\\|\\|222\\|\\|$                   |     |
|     | $\\|\\|\\|333\\|\\|\\|$             |     |
|     | $\\|\\|\\|\\|444\\|\\|\\|\\|$       |     |
|     | $\\|\\|\\|\\|\\|555\\|\\|\\|\\|\\|$ |     |

渲染结果:
image

❌ 导入导出不一致

❌ 重复的 |\|

模板:

|     | <span data-type="inline-math" data-subtype="math" data-content="000" contenteditable="false" class="render-node"></span>                                                                                                         |     |
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;111&amp;#124;" contenteditable="false" class="render-node"></span>                                                                                     |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;\&amp;#124;222\&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                                                               |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;\&amp;#124;&amp;#124;333&amp;#124;\&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                                           |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;\&amp;#124;&amp;#124;\&amp;#124;444\&amp;#124;&amp;#124;\&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                     |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;\&amp;#124;&amp;#124;\&amp;#124;&amp;#124;555&amp;#124;\&amp;#124;&amp;#124;\&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span> |     |

表中每一行的公式:

$000$

$|111|$

$|\|222\||$

$|\||333|\||$

$|\||\|444\||\||$

$|\||\||555|\||\||$

导出内容:

|     | $000$                   |     |
| --- | ----------------------- | --- |
|     | $\|111\|$               |     |
|     | $|\\|222\\||$           |     |
|     | $|\\||333|\\||$         |     |
|     | $|\\||\\|444\\||\\||$   |     |
|     | $|\\||\\||555|\\||\\||$ |     |

导入后渲染结果:
image

❌ 重复的 \||

模板:

|     | <span data-type="inline-math" data-subtype="math" data-content="000" contenteditable="false" class="render-node"></span>                                                                                                           |     |
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;111\&amp;#124;" contenteditable="false" class="render-node"></span>                                                                                     |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;&amp;#124;222&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                                                                 |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;&amp;#124;\&amp;#124;333\&amp;#124;&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                                           |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;&amp;#124;\&amp;#124;&amp;#124;444\&amp;#124;&amp;#124;\&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                       |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;&amp;#124;\&amp;#124;&amp;#124;\&amp;#124;555\&amp;#124;&amp;#124;\&amp;#124;&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span> |     |

表中每一行的公式:

$000$

$\|111\|$

$\||222|\|$

$\||\|333\||\|$

$\||\||444\||\||$

$\||\||\|555\||\||\|$

导出内容:

|     | $000$                       |     |
| --- | --------------------------- | --- |
|     | $\\|111\\|$                 |     |
|     | $\\||222|\\|$               |     |
|     | $\\||\\|333\\||\\|$         |     |
|     | $\\||\\||444\\||\\||$       |     |
|     | $\\||\\||\\|555\\||\\||\\|$ |     |

导入后渲染结果:
image

88250 added a commit that referenced this issue Sep 23, 2023

Verified

This commit was signed with the committer’s verified signature.
@88250
Copy link
Member

88250 commented Sep 23, 2023

又改了下,但是导出导入情况还是无能为力,比如按照上面的模板 data-content 中包含了没有转义的 |,这种情况为了保证导出 的表格符合 Markdown 语法,只能在导出时添加转义符,所以会导致原始语义就不一致。归根结底,还是公式中 \| 和表格的转义有语义冲突导致,暂时就这样吧。

88250 added a commit to 88250/lute that referenced this issue Sep 23, 2023

Verified

This commit was signed with the committer’s verified signature.
@Zuoqiu-Yingyi
Copy link
Contributor Author

又改了下,但是导出导入情况还是无能为力,比如按照上面的模板 data-content 中包含了没有转义的 |,这种情况为了保证导出 的表格符合 Markdown 语法,只能在导出时添加转义符,所以会导致原始语义就不一致。归根结底,还是公式中 \| 和表格的转义有语义冲突导致,暂时就这样吧。

与行内代码一样,公式中的 \ 可以不进行转义啊
与行内代码一样,无论 | 前方有无 \,仅将所有 | 转义为 \| 即可

@88250
Copy link
Member

88250 commented Sep 23, 2023 via email

@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented Sep 23, 2023

@88250 导出目前还有一些问题, 表格内公式中的 \| 在导出时未被转换为 \\|

即表格内公式的 | 符号无论前方有无 \, 均需要转换为 \|
例如 $|$ 转换为 $\|$, $\|$ 转换为 $\\|$, $\\|$ 转换为 $\\\|$

测试案例如下

模板

|     | <span data-type="inline-math" data-subtype="math" data-content="000" contenteditable="false" class="render-node"></span>                                                                                                               |     |
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;111\&amp;#124;" contenteditable="false" class="render-node"></span>                                                                                         |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;222\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                                                                   |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;\&amp;#124;333\&amp;#124;\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                                             |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;444\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span>                       |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;555\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;\&amp;#124;" contenteditable="false" class="render-node"></span> |     |

渲染结果:

期待的导出内容:

|     | $000$                               |     |
| --- | ----------------------------------- | --- |
|     | $\\|111\\|$                         |     |
|     | $\\|\\|222\\|\\|$                   |     |
|     | $\\|\\|\\|333\\|\\|\\|$             |     |
|     | $\\|\\|\\|\\|444\\|\\|\\|\\|$       |     |
|     | $\\|\\|\\|\\|\\|555\\|\\|\\|\\|\\|$ |     |

实际导出内容:

|     | $000$                     |     |
| --- | ------------------------- | --- |
|     | $\|111\|$                 |     |
|     | $\|\|222\|\|$             |     |
|     | $\|\|\|333\|\|\|$         |     |
|     | $\|\|\|\|444\|\|\|\|$     |     |
|     | $\|\|\|\|\|555\|\|\|\|\|$ |     |

@Zuoqiu-Yingyi
Copy link
Contributor Author

附注: 使用 导入 Markdown 文档 菜单项导入如下内容时可以正常解析, 但是使用 /api/block/updateBlock 等 API 插入如下内容无法正常解析

|     | $000$                               |     |
| --- | ----------------------------------- | --- |
|     | $\\|111\\|$                         |     |
|     | $\\|\\|222\\|\\|$                   |     |
|     | $\\|\\|\\|333\\|\\|\\|$             |     |
|     | $\\|\\|\\|\\|444\\|\\|\\|\\|$       |     |
|     | $\\|\\|\\|\\|\\|555\\|\\|\\|\\|\\|$ |     |

API 插入/更新块的渲染结果, 可以看出这里 \\| 中的 \| 未被反转义为 |:
image

88250 added a commit to 88250/lute that referenced this issue Sep 24, 2023

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit to 88250/lute that referenced this issue Sep 24, 2023

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit to 88250/lute that referenced this issue Sep 24, 2023

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit that referenced this issue Sep 24, 2023

Verified

This commit was signed with the committer’s verified signature.
@88250
Copy link
Member

88250 commented Sep 24, 2023

感谢测试,已经修改提交,这次应该差不多了。

@Zuoqiu-Yingyi
Copy link
Contributor Author

感谢测试,已经修改提交,这次应该差不多了。

之前已经修复的问题再次出现了...

模板

|     |                                                   <span data-type="inline-math" data-subtype="math" data-content="000" contenteditable="false" class="render-node"></span>                                                   |     |
| --- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | --- |
|     |                                         <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;111&amp;#124;" contenteditable="false" class="render-node"></span>                                         |     |
|     |                               <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;222&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                               |     |
|     |                     <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;&amp;#124;333&amp;#124;&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>                     |     |
|     |           <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;&amp;#124;&amp;#124;444&amp;#124;&amp;#124;&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span>           |     |
|     | <span data-type="inline-math" data-subtype="math" data-content="&amp;#124;&amp;#124;&amp;#124;&amp;#124;&amp;#124;555&amp;#124;&amp;#124;&amp;#124;&amp;#124;&amp;#124;" contenteditable="false" class="render-node"></span> |     |

渲染结果:
image

期待的导出内容:

|     |           $000$           |     |
| --- | :-----------------------: | --- |
|     |         $\|111\|$         |     |
|     |       $\|\|222\|\|$       |     |
|     |     $\|\|\|333\|\|\|$     |     |
|     |   $\|\|\|\|444\|\|\|\|$   |     |
|     | $\|\|\|\|\|555\|\|\|\|\|$ |     |

实际导出内容:

|     |                $000$                |     |
| --- | :---------------------------------: | --- |
|     |             $\\|111\\|$             |     |
|     |          $\\|\\|222\\|\\|$          |     |
|     |       $\\|\\|\\|333\\|\\|\\|$       |     |
|     |    $\\|\\|\\|\\|444\\|\\|\\|\\|$    |     |
|     | $\\|\\|\\|\\|\\|555\\|\\|\\|\\|\\|$ |     |

@88250
Copy link
Member

88250 commented Sep 25, 2023

我看你上面回复的是这个期待哦:

image

@Zuoqiu-Yingyi
Copy link
Contributor Author

我看你上面回复的是这个期待哦:

image

图中里面转换前的内容是指非表格内的公式导出的内容,转换后的内容是指表格内公式导出的内容

@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented Sep 25, 2023

再详细描述一下导出需求

需求 1

image
希望导出为

|     |           |     |
| --- | --------- | --- |
|     | $\|111\|$ |     |

需求 2

image
希望导出为

|     |             |     |
| --- | ----------- | --- |
|     | $\\|111\\|$ |     |

需求 3

image
希望导出为

|     |               |     |
| --- | ------------- | --- |
|     | $\\\|111\\\|$ |     |

88250 added a commit to 88250/lute that referenced this issue Sep 25, 2023

Verified

This commit was signed with the committer’s verified signature.
@88250
Copy link
Member

88250 commented Sep 25, 2023

@Zuoqiu-Yingyi 好的,叒改了改,麻烦测试。

88250 added a commit that referenced this issue Sep 25, 2023

Verified

This commit was signed with the committer’s verified signature.
@Zuoqiu-Yingyi
Copy link
Contributor Author

@Zuoqiu-Yingyi 好的,叒改了改,麻烦测试。

还是不行啊, 满足 需求 2需求 3, 但仍不满足 需求 1:

image

期望导出为

|     |           |     |
| --- | --------- | --- |
|     | $\|111\|$ |     |

实际导出为

|     |             |     |
| --- | ----------- | --- |
|     | $\\|000\\|$ |     |

88250 added a commit to 88250/lute that referenced this issue Sep 25, 2023

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit to 88250/lute that referenced this issue Sep 25, 2023

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit to 88250/lute that referenced this issue Sep 25, 2023

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit that referenced this issue Sep 25, 2023

Verified

This commit was signed with the committer’s verified signature.
@88250
Copy link
Member

88250 commented Sep 25, 2023

感谢测试,这次应该都解决了,相关测试用例已经在 Lute 中添加。

08906F92D0577EBECC559754B1916462

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