-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Comments
\
in the table
…cape char \ in the table siyuan-note/siyuan#9227
…cape char \ in the table siyuan-note/siyuan#9227
嗯,等发版看看。
…---Original---
From: ***@***.***>
Date: Wed, Sep 20, 2023 13:26 PM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [siyuan-note/siyuan] Improve the handling of inline-levelformulas containing escape char `\` in the table (Issue #9227)
但是对于这个情况无法解决(因为解析器解析块级表格 | 优先级高于行级):
保证表格内行内公式与表格外行内公式相同的内容渲染一致即可
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
多谢测试,稍后再改改。 |
…cape char \ in the table siyuan-note/siyuan#9227
需要转义应该是合乎逻辑的。
…---Original---
From: ***@***.***>
Date: Thu, Sep 21, 2023 07:01 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [siyuan-note/siyuan] Improve the handling of inline-levelformulas containing escape char `\` in the table (Issue #9227)
现在貌似引入了更多问题...
1. 表格中行内公式中的 | 在刷新后均被替换为 \|
2. 表格中行内公式中的 \\| 在刷新后无法正确解析
奇数个 \ + \ 可以正确解析
偶数个 \ + | 无法正确解析
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
转义应对用户透明,现在语义都发生变化了 |
转义符透明不了吧。
…---Original---
From: ***@***.***>
Date: Thu, Sep 21, 2023 07:46 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [siyuan-note/siyuan] Improve the handling of inline-levelformulas containing escape char `\` in the table (Issue #9227)
需要转义应该是合乎逻辑的。
转义应对用户透明,现在语义都发生变化了
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
在公式编辑框中的内容应没有转义符 |
这就麻烦了,等会我先回滚代码吧。
…---Original---
From: ***@***.***>
Date: Thu, Sep 21, 2023 08:03 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [siyuan-note/siyuan] Improve the handling of inline-levelformulas containing escape char `\` in the table (Issue #9227)
在公式编辑框中的内容应没有转义符
这里还有个严重的问题,katex 中 | 与 \| 的语义是不同的,不能混淆
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
将行内公式的 $ 符号视为另一种行内代码符号 ` 可以吗👀 |
https://katex.org/docs/support_table#symbols katex 有许多符号与其转义的语义不同,但标志符号 $ 仅有 |
应该是可以的,等会改了看看。 |
这问题可能涉及到之前的一些修改,这里做个复盘备注: 分别确认了下:
|
\
in the table|
in the table
找到个方案,解析过程中使用 |
@88250 Markdown 导出还是有一些问题 复现步骤
| | <span data-type="inline-math" data-subtype="math" data-content="&#124;000&#124;" contenteditable="false" class="render-node"></span> | |
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
| | <span data-type="inline-math" data-subtype="math" data-content="\&#124;111\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\\&#124;222\\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\\\&#124;333\\\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\\\\&#124;444\\\\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\\\\\&#124;555\\\\\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\\\\\\&#124;666\\\\\\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\\\\\\\&#124;777\\\\\\\&#124;" contenteditable="false" class="render-node"></span> | |
该表中每一行的公式为 $|000|$
$\|111\|$
$\\|222\\|$
$\\\|333\\\|$
$\\\\|444\\\\|$
$\\\\\|555\\\\\|$
$\\\\\\|666\\\\\\|$
$\\\\\\\|777\\\\\\\|$
| | $\|000\|$ | |
| --- | ----------------------------------- | --- |
| | $\\|111\\|$ | |
| | $\\\\|222\\\\|$ | |
| | $\\\\\\|333\\\\\\|$ | |
| | $\\\\\\\\|444\\\\\\\\|$ | |
| | $\\\\\\\\\\|555\\\\\\\\\\|$ | |
| | $\\\\\\\\\\\\|666\\\\\\\\\\\\|$ | |
| | $\\\\\\\\\\\\\\|777\\\\\\\\\\\\\\|$ | |
该表中每一行的公式为 $|000|$
$\|111\|$
$\\\|222\\\|$
$\\\\\|333\\\\\|$
$\\\\\\\|444\\\\\\\|$
$\\\\\\\\\|555\\\\\\\\\|$
$\\\\\\\\\\\|666\\\\\\\\\\\|$
$\\\\\\\\\\\\\|777\\\\\\\\\\\\\|$ 问题分析经过测试, 如下的内容可以正确导入 | | $\|000\|$ | |
| --- | ----------------------- | --- |
| | $\\|111\\|$ | |
| | $\\\|222\\\|$ | |
| | $\\\\|333\\\\|$ | |
| | $\\\\\|444\\\\\|$ | |
| | $\\\\\\|555\\\\\\|$ | |
| | $\\\\\\\|666\\\\\\\|$ | |
| | $\\\\\\\\|777\\\\\\\\|$ | | 💡容易看出, 问题出现的原因是在导出时表格中公式内部的
那么导出的内容再导入可以与导出前保持一致 |
补充几个测试用例 ✅ 导出导入一致✅ 多个连续的
|
又改了下,但是导出导入情况还是无能为力,比如按照上面的模板 data-content 中包含了没有转义的 |,这种情况为了保证导出 的表格符合 Markdown 语法,只能在导出时添加转义符,所以会导致原始语义就不一致。归根结底,还是公式中 |
与行内代码一样,公式中的 |
等测试下看看。
…---Original---
From: ***@***.***>
Date: Sat, Sep 23, 2023 12:56 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [siyuan-note/siyuan] Improve the handling of inline-mathcontaining `|` in the table (Issue #9227)
又改了下,但是导出导入情况还是无能为力,比如按照上面的模板 data-content 中包含了没有转义的 |,这种情况为了保证导出 的表格符合 Markdown 语法,只能在导出时添加转义符,所以会导致原始语义就不一致。归根结底,还是公式中 \| 和表格的转义有语义冲突导致,暂时就这样吧。
与行内代码一样,公式中的 \ 可以不进行转义啊
与行内代码一样,无论 | 前方有无 \,仅将所有 | 转义为 \| 即可
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@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="\&#124;111\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\&#124;\&#124;222\&#124;\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\&#124;\&#124;\&#124;333\&#124;\&#124;\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\&#124;\&#124;\&#124;\&#124;444\&#124;\&#124;\&#124;\&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="\&#124;\&#124;\&#124;\&#124;\&#124;555\&#124;\&#124;\&#124;\&#124;\&#124;" contenteditable="false" class="render-node"></span> | |
期待的导出内容: | | $000$ | |
| --- | ----------------------------------- | --- |
| | $\\|111\\|$ | |
| | $\\|\\|222\\|\\|$ | |
| | $\\|\\|\\|333\\|\\|\\|$ | |
| | $\\|\\|\\|\\|444\\|\\|\\|\\|$ | |
| | $\\|\\|\\|\\|\\|555\\|\\|\\|\\|\\|$ | | 实际导出内容: | | $000$ | |
| --- | ------------------------- | --- |
| | $\|111\|$ | |
| | $\|\|222\|\|$ | |
| | $\|\|\|333\|\|\|$ | |
| | $\|\|\|\|444\|\|\|\|$ | |
| | $\|\|\|\|\|555\|\|\|\|\|$ | | |
附注: 使用 | | $000$ | |
| --- | ----------------------------------- | --- |
| | $\\|111\\|$ | |
| | $\\|\\|222\\|\\|$ | |
| | $\\|\\|\\|333\\|\\|\\|$ | |
| | $\\|\\|\\|\\|444\\|\\|\\|\\|$ | |
| | $\\|\\|\\|\\|\\|555\\|\\|\\|\\|\\|$ | | |
感谢测试,已经修改提交,这次应该差不多了。 |
之前已经修复的问题再次出现了... 模板 | | <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="&#124;111&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="&#124;&#124;222&#124;&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="&#124;&#124;&#124;333&#124;&#124;&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="&#124;&#124;&#124;&#124;444&#124;&#124;&#124;&#124;" contenteditable="false" class="render-node"></span> | |
| | <span data-type="inline-math" data-subtype="math" data-content="&#124;&#124;&#124;&#124;&#124;555&#124;&#124;&#124;&#124;&#124;" contenteditable="false" class="render-node"></span> | |
期待的导出内容: | | $000$ | |
| --- | :-----------------------: | --- |
| | $\|111\|$ | |
| | $\|\|222\|\|$ | |
| | $\|\|\|333\|\|\|$ | |
| | $\|\|\|\|444\|\|\|\|$ | |
| | $\|\|\|\|\|555\|\|\|\|\|$ | | 实际导出内容: | | $000$ | |
| --- | :---------------------------------: | --- |
| | $\\|111\\|$ | |
| | $\\|\\|222\\|\\|$ | |
| | $\\|\\|\\|333\\|\\|\\|$ | |
| | $\\|\\|\\|\\|444\\|\\|\\|\\|$ | |
| | $\\|\\|\\|\\|\\|555\\|\\|\\|\\|\\|$ | | |
@Zuoqiu-Yingyi 好的,叒改了改,麻烦测试。 |
还是不行啊, 满足 期望导出为 | | | |
| --- | --------- | --- |
| | $\|111\|$ | | 实际导出为 | | | |
| --- | ----------- | --- |
| | $\\|000\\|$ | | |
Is there an existing issue for this?
Can the issue be reproduced with the default theme (daylight/midnight)?
Could the issue be due to extensions?
Describe the problem
无法在表格输入含有
\|
符号的公式输入后
\|
后刷新一次会变成|
示例: 在表格内公式中输入
333 \| bar \| 444
后再刷新文档, 该公式会变成333 | bar | 444
该问题产生的原因: Lute 无法正确解析表格中的行内公式
含有符号
|
的行内公式在表格中 应按照如下方案进行转义当前使用的方案
受影响的方法
markdown
field/api/export/exportMdContent
/api/block/getBlockKramdown
lute.BlockDOM2StdMd
lute.BlockDOM2Md
Expected result
$111 | foo | 222$
在表格中表示为$333 \| bar \| 444$
在表格中表示为Screenshot or screen recording presentation
No response
Version environment
Log file
无有效信息输出
More information
No response
The text was updated successfully, but these errors were encountered: