为什么是 '。' Telegram 的 Bot API 中 MarkdownV2 中的保留字符?

Ana*_*and 15 markdown escaping telegram telegram-bot

从 Telegram 的 Bot API 版本 4.5 开始,该 API 支持新的文本格式MarkdownV2. 这是之前 Markdown 支持的增强版本。

MarkdownV2 的“规范”说:

  • 在内(...)联链接定义的内部,所有 ')' 和 '\' 必须使用前面的 '\' 字符进行转义。
  • 在所有其他位置,字符 '_'、'*'、'['、']'、'('、')'、'~'、'`'、'>'、'#'、'+'、' -'、'='、'|'、'{'、'}'、'.'、'!' 必须使用前面的字符“\”进行转义。

为什么点字符.需要转义?据我所知,它没有在任何格式化语法中使用。Telegram 提供的语法示例当然不会.以这种方式使用:

要使用此模式,请在parse_mode字段中传递MarkdownV2。在消息中使用以下语法:

*bold \*text*
_italic \*text_
__underline__
~strikethrough~
*bold _italic bold ~italic bold strikethrough~ __underline italic bold___ bold*
[inline URL](http://www.example.com/)
[inline mention of a user](tg://user?id=123456789)
`inline fixed-width code`
```
pre-formatted fixed-width code block
```
```python
pre-formatted fixed-width code block written in the Python programming language
```
Run Code Online (Sandbox Code Playgroud)

Chr*_*ris 10

我具体不了解 Telegram,但 Markdown 用作.有序列表的一部分,例如:

1. One
1. Two
1. Three
Run Code Online (Sandbox Code Playgroud)

呈现为:

请注意,在原始规范中,使用的数字并不重要;Markdown 为你重新编号。

相比之下,

1\. One
1\. Two
1\. Three
Run Code Online (Sandbox Code Playgroud)

呈现为

1. 一 1. 二 1. 三