Skip to content

Improve the handling of inline-code containing | in the table #9252

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
88250 opened this issue Sep 22, 2023 · 5 comments
Closed

Improve the handling of inline-code containing | in the table #9252

88250 opened this issue Sep 22, 2023 · 5 comments
Assignees
Milestone

Comments

@88250
Copy link
Member

88250 commented Sep 22, 2023

思源目前针对表格中的行内代码中 |\ 的解析也有问题, 无法在表格中行内代码中分别输入 \|, \\|, \\\|, \\\\|, 在刷新后显示内容会发生更改

下面是在思源中导入如下内容的结果

| |
|-|
|`0|0`|
|`1\|1`|
|`2\\|2`|
|`3\\\|3`|
|`4\\\\|4`|
`0
1|1
2\|2
3\\|3
4\\\|4

image

Originally posted by @Zuoqiu-Yingyi in #9227 (comment)

@Zuoqiu-Yingyi
Copy link
Contributor

目前还有一些问题

  1. 表格中不使用行内代码时无法输入多个连续的 | 符号 (必须输入 \|)
  2. 表格中仅包含一个 | 的行内代码也应该转义为 \|
  3. 其他导出导入前后不一致的测试用例

🚫 导出导入前后不一致

🚫 测试 1

模板:

|     |      <span data-type="code">&#124;</span>      |     |
| --- | :--------------------------------------------: | --- |
|     |     <span data-type="code">\&#124;\</span>     |     |
|     |    <span data-type="code">\\&#124;\\</span>    |     |
|     |   <span data-type="code">\\\&#124;\\\</span>   |     |
|     |  <span data-type="code">\\\\&#124;\\\\</span>  |     |
|     | <span data-type="code">\\\\\&#124;\\\\\</span> |     |

渲染样式:
image

导出内容:

|     |       `|`      |     |
| --- | :------------: | --- |
|     |     `\\|\`     |     |
|     |    `\\\|\\`    |     |
|     |   `\\\\|\\\`   |     |
|     |  `\\\\\|\\\\`  |     |
|     | `\\\\\\|\\\\\` |     |

导入后渲染结果:
image

🚫 测试 2

模板:

|     |                <span data-type="code">&#124;</span>                |     |
| --- | :----------------------------------------------------------------: | --- |
|     |             <span data-type="code">&#124;&#124;</span>             |     |
|     |          <span data-type="code">&#124;&#124;&#124;</span>          |     |
|     |       <span data-type="code">&#124;&#124;&#124;&#124;</span>       |     |
|     |    <span data-type="code">&#124;&#124;&#124;&#124;&#124;</span>    |     |
|     | <span data-type="code">&#124;&#124;&#124;&#124;&#124;&#124;</span> |     |

渲染样式:
image

导出内容:

|     |    `|`   |     |
| --- |  :-----: | --- |
|     |   `||`   |     |
|     |   `|||`  |     |
|     |  `||||`  |     |
|     |  `|||||` |     |
|     | `||||||` |     |

导入后渲染结果:
image

🚫 测试 3

模板:

|     |           <span data-type="code">&#124;\</span>           |     |
| --- | :-------------------------------------------------------: | --- |
|     |        <span data-type="code">&#124;\&#124;</span>        |     |
|     |       <span data-type="code">&#124;\&#124;\</span>        |     |
|     |    <span data-type="code">&#124;\&#124;\&#124;</span>     |     |
|     |    <span data-type="code">&#124;\&#124;\&#124;\</span>    |     |
|     | <span data-type="code">&#124;\&#124;\&#124;\&#124;</span> |     |

渲染样式:
image

导出内容:

|     |    `|\\`   |     |
| --- | :--------: | --- |
|     |   `|\\|`   |     |
|     |   `|\\|\`  |     |
|     |  `|\\|\|`  |     |
|     |  `|\\|\|\` |     |
|     | `|\\|\|\|` |     |

导入后渲染结果:
image

🚫 测试 4

模板:

|     |        <span data-type="code">\&#124;</span>         |     |
| --- | :--------------------------------------------------: | --- |
|     |        <span data-type="code">\&#124;\</span>        |     |
|     |     <span data-type="code">\&#124;\&#124;</span>     |     |
|     |    <span data-type="code">\&#124;\&#124;\</span>     |     |
|     | <span data-type="code">\&#124;\&#124;\&#124;</span>  |     |
|     | <span data-type="code">\&#124;\&#124;\&#124;\</span> |     |

渲染样式:
image

导出内容:

|     |   `\\|`   |     |
| --- | :-------: | --- |
|     |  `\\|\`   |     |
|     |  `\\|\|`  |     |
|     | `\\|\|\`  |     |
|     | `\\|\|\|` |     |
|     |`\\|\|\|\` |     |

导入后渲染结果:
image

🚫 测试 5

模板:

|     |                 <span data-type="code">\&#124;</span>                 |     |
| --- | :-------------------------------------------------------------------: | --- |
|     |              <span data-type="code">\&#124;&#124;</span>              |     |
|     |          <span data-type="code">\&#124;&#124;\&#124;</span>           |     |
|     |       <span data-type="code">\&#124;&#124;\&#124;&#124;</span>        |     |
|     |    <span data-type="code">\&#124;&#124;\&#124;&#124;\&#124;</span>    |     |
|     | <span data-type="code">\&#124;&#124;\&#124;&#124;\&#124;&#124;</span> |     |

渲染样式:
image

导出内容:

|     |      `\\|`   |     |
| --- | :----------: | --- |
|     |     `\\||`   |     |
|     |    `\\||\|`  |     |
|     |   `\\||\||`  |     |
|     |  `\\||\||\|` |     |
|     | `\\||\||\||` |     |

导入后渲染结果:
image

🚫 测试 6

模板:

|     |                 <span data-type="code">&#124;</span>                  |     |
| --- | :-------------------------------------------------------------------: | --- |
|     |              <span data-type="code">&#124;\&#124;</span>              |     |
|     |           <span data-type="code">&#124;\&#124;&#124;</span>           |     |
|     |       <span data-type="code">&#124;\&#124;&#124;\&#124;</span>        |     |
|     |    <span data-type="code">&#124;\&#124;&#124;\&#124;&#124;</span>     |     |
|     | <span data-type="code">&#124;\&#124;&#124;\&#124;&#124;\&#124;</span> |     |

渲染样式:
image

导出内容:

|     |      `|`     |     |
| --- | :----------: | --- |
|     |     `|\\|`   |     |
|     |    `|\\||`   |     |
|     |   `|\\||\|`  |     |
|     |  `|\\||\||`  |     |
|     | `|\\||\||\|` |     |

导入后渲染结果:
image

@88250
Copy link
Member Author

88250 commented Sep 23, 2023

感谢测试,我再努力努力,感觉应该差不多了。

@Zuoqiu-Yingyi
Copy link
Contributor

目前看没啥问题了🎉

@Zuoqiu-Yingyi
Copy link
Contributor

貌似这里又出问题了

模板:

|     |        <span data-type="code">\&#124;</span>         |     |
| --- | :--------------------------------------------------: | --- |
|     |        <span data-type="code">\&#124;\</span>        |     |
|     |     <span data-type="code">\&#124;\&#124;</span>     |     |
|     |    <span data-type="code">\&#124;\&#124;\</span>     |     |
|     | <span data-type="code">\&#124;\&#124;\&#124;</span>  |     |
|     | <span data-type="code">\&#124;\&#124;\&#124;\</span> |     |

渲染结果:
image

期望导出内容:

|     |    `\\|`     |     |
| --- | :----------: | --- |
|     |    `\\|\`    |     |
|     |   `\\|\\|`   |     |
|     |  `\\|\\|\`   |     |
|     | `\\|\\|\\|`  |     |
|     | `\\|\\|\\|\` |     |

实际导出内容:

|     |   `\|`    |     |
| --- | :-------: | --- |
|     |   `\|\`   |     |
|     |  `\|\|`   |     |
|     |  `\|\|\`  |     |
|     | `\|\|\|`  |     |
|     | `\|\|\|\` |     |

@88250
Copy link
Member Author

88250 commented Sep 26, 2023

收到,稍后继续修改。

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