在 Github 上使用 markdown 来加强部分单词

Use markdown to embolden partial words on Github

我正在尝试使用 Github markdown 将蛇形单词的一部分加粗。

my\_great**\_word**

我希望它呈现如下:

my_great_word

Github,然而,呈现如下:

my_great**_word**

我也试过了

my_great**_word**

无果。

根据GitHub的规范,强调文本的第一个字符不能是标点符号。因此,您需要这样做:

my\_great\_**word**

如果强调文本中必须包含下划线,那么您需要退回到原始 HTML:

my\_great<b>\_word</b>

提醒一下,GitHub 使用自己的规范,这是一个扩展的 CommonMark 规范。有关详细信息,请参阅 Emphasis and Strong Emphasis 部分。简而言之,强调(和强烈强调)必须以 "left-flanking delimiter run" 开头并以 "right-flanking delimiter run" 结束。

你的问题是你没有“左翼定界符运行”,它是defined(强调):

A left-flanking delimiter run is a delimiter run that is (a) not followed by Unicode whitespace, and (b) not followed by a punctuation character, or preceded by Unicode whitespace or a punctuation character. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.

请注意,左翼定界符 运行 可以 "not be followed by a punctuation character." 当然,在您的示例中,下划线是标点符号,这导致它之前的两个星号不被视为左翼- 侧翼定界符 运行。由于您没有左侧定界符 运行,因此没有强调。

为了解决这个问题,您需要将两个星号移到下划线之后,这样它们就会被视为左翼定界符 运行,给您带来强烈的强调。

顺便说一句,基于星号和下划线的强调规则略有不同,因此单词中的下划线不会导致误报。在这种情况下,您实际上不需要转义下划线。这些在 GitHub:

上工作得很好
my_great_**word**
my_great<b>_word</b>