MD 里的 **-**1 为什么不是加粗?

huangsijun17 · 2024-4-16 13:31:28 · 50 次点击
1.`**-**`

2.`**1**`

3.`**1**-`

4.`**-**-`

5.`**1**1`

6.`**-**1`

以上六句 Markdown ,仅有第六句里的星号没被视作加粗,其他的都是加粗。为什么 V2EX 、github 等在内的部分解析器在解析类似的星号内以符号结尾,星号后以字符开头的文本时,不将其解释为加粗?

---

示例:[markdown-it demo]( https://markdown-it.github.io/#md3=%7B%22source%22%3A%221%3A%5Cn%2A%2A-%2A%2A%5Cn%5Cn2%3A%5Cn%2A%2A1%2A%2A%5Cn%5Cn3%3A%5Cn%2A%2A1%2A%2A-%5Cn%5Cn4%3A%5Cn%2A%2A-%2A%2A-%5Cn%5Cn5%3A%5Cn%2A%2A1%2A%2A1%5Cn%5Cn6%3A%5Cn%2A%2A-%2A%2A1%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Afalse%2C%22_view%22%3A%22html%22%7D%7D)

---

示例:V2EX

```
1:
**-**

2:
**1**

3:
**1**-

4:
**-**-

5:
**1**1

6:
**-**1
```


1:
**-**

2:
**1**

3:
**1**-

4:
**-**-

5:
**1**1

6:
**-**1
举报· 50 次点击
登录 注册 站外分享
2 条回复  
zackzergzeng 初学 2024-4-16 16:12:39
markdown 的规则,右侧的定界符的左侧是符号的情况下,右侧必须跟符号或者空格
https://spec.commonmark.org/0.30/#right-flanking-delimiter-run
MaxChow 小成 2024-4-29 12:37:01
这应该是跟你的编辑器有关,试过在 Typora 中是正常的~
返回顶部