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

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

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

使用 CommonMark 教程验证 Markdown。 此教程具有用于快速复制/粘贴验证的试一试功能。

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

借助答案的富文本编辑,你(作者)可以使用格式设置工具栏快速选择文本并设置其格式。

当需要自动生成内容以创建要作为 CI/CD 管道的一部分导入或用于批量测试的知识库时,Markdown 是一种更好的工具。

支持的 Markdown 格式

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

用途 格式 示例 Markdown 渲染
在聊天机器人中显示
2 个句子之间的新行。 \n\n How can I create a bot with \n\n QnA Maker? format new line between two sentences
从 h1 到 h6 的标头,# 数指示是哪个标头。 1 # 为 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
format with markdown headers
format with markdown headers H1 to H5
斜体 *text* How do I create a bot with *QnA Maker*? format with italics
强调(粗体) **text** How do I create a bot with **QnA Maker**? format with strong marking for bold
链接的 URL [text](https://www.my.com) How do I create a bot with [QnA Maker](https://www.qnamaker.ai)? format for URL (hyperlink)
*公共图像的 URL ![text](https://www.my.com/image.png) How can I create a bot with ![QnAMaker](https://review.learn.microsoft.com/azure/ai-services/qnamaker/media/qnamaker-how-to-key-management/qnamaker-resource-list.png) format for public image URL
删除线 ~~text~~ some ~~questoins~~ questions need to be asked format for strikethrough
粗体和斜体 ***text*** How can I create a ***QnA Maker*** bot? format for bold and italics
链接的粗体 URL [**text**](https://www.my.com) How do I create a bot with [**QnA Maker**](https://www.qnamaker.ai)? format for bold URL
链接的斜体 URL [*text*](https://www.my.com) How do I create a bot with [*QnA Maker*](https://www.qnamaker.ai)? format for italics URL
转义 Markdown 符号 \*text\* How do I create a bot with \*QnA Maker\*? Format for escape markdown symbols.
有序列表 \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
前面的示例使用了显式编号。
format for ordered list
无序列表 \n * item1 \n * item2

\n - item1 \n - item2
This is an unordered list: \n * List item 1 \n * List item 2 format for unordered list
嵌套列表 \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
format for nested unordered list
format for nested ordered list

*QnA Maker 不会以任何方式处理图像。 由客户端应用程序负责呈现图像。

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

保留 HTML 在 API 请求中的表示形式 在 KB 中的表示形式
<br> <br>
<h3>header</h3> <h3>header</h3>

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

后续步骤

查看批量测试文件格式