13

Markdown 表使用竖线作为字段分隔符,但我需要在某些单元格中写一个竖线。这可能吗?我正在使用 GFM(GitHub 风味的 Markdown)。

我可以以某种方式逃脱垂直条吗?

这不在 GitHub 上,而是通过 Docusaurus。我不知道 Docusaurus 使用哪个解析器,但以下都不起作用:

  • |-|只是被显示(&被转义)
  • <code>- 显示任何 html(<被转义)
  • \|-|仍然充当表格单元格分隔符

更新

&#124;如果我在反引号中没有它,则可以使用。所以,至少现在,我只是取消了竖线的反引号。例如,a | b变成a|b

4

3 回答 3

17

Docusaurus maintainer here! Docusaurus uses Remarkable for parsing Markdown.

As you pointed out in your question, you can write this in your table - &#124; and it will render as |.

If you want it to appear with monospaced styling, wrap it in <code>&#124;</code> instead of using backticks. You will have to write HTML and not markdown to get it to work.

Refer to line 30 of Reason Cheatsheet. I recently fixed a similar issue in the Reason docs.

## Boolean

| JavaScript                                            | Reason                                         |
| ----------------------------------------------------- | ---------------------------------------------- |
| `true`, `false`                                       | `true`, `false` \*                             |
| `!true`                                               | Same                                           |
| <code>&#124;&#124;</code>, `&&`, `<=`, `>=`, `<`, `>` | Same                                           |
| `a === b`, `a !== b`                                  | Same                                           |
| No deep equality (recursive compare)                  | `a == b`, `a != b`                             |
| `a == b`                                              | No equality with implicit casting (thankfully) |

becomes:

Reason Table

于 2018-04-14T17:20:34.667 回答
3
于 2018-04-14T15:50:54.330 回答
2

If you are typing math and $p(x|y)$ breaks the formula, use \vert instead of |.

于 2020-03-31T04:58:58.080 回答