你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

QnA Maker 答案文本中支持的 Markdown 格式

QnA Maker 以 Markdown 形式存储答案文本。 有很多不同形式的 Markdown。 为了确保返回并正确显示答案文本,请使用此参考。

Use the CommonMark tutorial to validate your Markdown. The tutorial has a Try it feature for quick copy/paste validation.

何时使用富文本编辑而不是 Markdown

Rich-text editing of answers allows you to use a formatting toolbar to quickly select and format text.

Markdown is a better tool when you need to autogenerate content to create knowledge bases to be imported as part of a CI/CD pipeline or for batch testing.

支持的 Markdown 格式

下面是可以在 QnA Maker 的答案文本中使用的 Markdown 格式的列表。

Purpose Format Example markdown Rendering
如聊天机器人中所示
两个句子之间的新行。 \n\n How can I create a bot with \n\n QnA Maker? 2 个句子之间的换行格式
从 h1 到 h6 的标头,# 数指示是哪个标头。 一 # 个是 h1。 \n# text \n## text \n### text \n####text \n#####text ## Creating a bot \n ...text.... \n### Important news\n ...text... \n### Related Information\n ....text...

\n# my h1 \n## my h2\n### my h3 \n#### my h4 \n##### my h5
Markdown 标头格式
Markdown 标头 H1 至 H5 的格式
Italics *text* How do I create a bot with *QnA Maker*? 斜体格式
Strong (bold) **text** How do I create a bot with **QnA Maker**? 强调标记(表示粗体)的格式
链接的 URL [text](https://www.my.com) How do I create a bot with QnA Maker? URL 格式(超链接)
*公共图像的 URL ![text](https://www.my.com/image.png) How can I create a bot with ![QnAMaker](https://review.free.blessedness.top/azure/ai-services/qnamaker/media/qnamaker-how-to-key-management/qnamaker-resource-list.png) 公共图像 URL 格式
Strikethrough ~~text~~ some ~~questoins~~ questions need to be asked 删除线格式
粗体和斜体 ***text*** How can I create a ***QnA Maker*** bot? 粗体和斜体格式
链接的粗体 URL [**text**](https://www.my.com) How do I create a bot with **QnA Maker**? 粗体 URL 格式
链接的斜体 URL [*text*](https://www.my.com) How do I create a bot with *QnA Maker*? 斜体 URL 格式
转义 Markdown 符号 \*text\* How do I create a bot with \*QnA Maker\*? 转义 Markdown 符号格式。
Ordered list \n 1. item1 \n 1. item2 This is an ordered list: \n 1. List item 1 \n 1. List item 2
前面的示例使用了 Markdown 中内置的自动编号。
This is an ordered list: \n 1. List item 1 \n 2. List item 2
前面的示例使用了显式编号。
已排序列表格式
Unordered list \n * item1 \n * item2
Or
\n - item1 \n - item2
This is an unordered list: \n * List item 1 \n * List item 2 无序列表格式
Nested lists \n * Parent1 \n\t * Child1 \n\t * Child2 \n * Parent2

\n * Parent1 \n\t 1. Child1 \n\t * Child2 \n 1. Parent2

可以将已排序列表和无序列表嵌套在一起。 制表符 \t 指示子元素的缩进级别。
This is an unordered list: \n * List item 1 \n\t * Child1 \n\t * Child2 \n * List item 2

This is an ordered nested list: \n 1. Parent1 \n\t 1. Child1 \n\t 1. Child2 \n 1. Parent2
嵌套无序列表格式
嵌套已排序列表格式

*QnA Maker 不会以任何方式处理图像。 这是客户端应用程序用于呈现图像的角色。

如果要使用更新/替换知识库 API 添加内容,并且内容/文件包含 html 标记,则可以通过确保以编码格式转换标记的左侧和右侧部分来保留文件中的 HTML。

Preserve HTML 在 API 请求中的表示形式 在 KB 中的表示形式
Yes <br> <br>
Yes <h3>header</h3> <h3>标头</h3>

此外, CR LF(\r\n)将转换为 KB 中的 \n。 LF(\n) 保持原样。 如果要对任何转义序列进行转义,如 \t 或 \n,可以使用反斜杠,例如:'\\r\\n' 和 '\\t'

Next steps

Review batch testing file formats.