Github vs npm markdown,转义竖线

Github vs npm markdown, escaping vertical bar

对于 Github markdown 中的 table 单元格,您必须使用 \ 转义 | 以避免将其解释为下一个单元格。一旦你逃脱它,一切都很好,例如https://github.com/russellw/clause-normal-form Nor 和 Or 的条目。

对于 npm markdown 中的 table 单元格,这不起作用; \ 出现在显示屏上,例如https://www.npmjs.com/package/clause-normal-form Nor 和 Or 的条目。

如何在自述文件的 table 中转义 |,以便 Github 和 npm 都能正确显示它?

<code>&vert; &verbar; &VerticalLine; &#x0007C; &#124;</code>

以上渲染为:| | | | |

您应该能够在 Markdown 中使用 HTML 实体,并且 <code></code> 而不是反引号将避免在内部将 & 自动转义为 &amp;。当然,根据您的特定示例,您可能还有一些其他字符需要转义。

有关更多实体,请参阅:https://dev.w3.org/html5/html-author/charref

请记住,您可以在 Markdown 中使用 HTML(包括 HTML 个实体):

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

参见:https://daringfireball.net/projects/markdown/syntax#html