|
| 1 | +--- |
| 2 | +title: Markdown format - question answering |
| 3 | +description: Following is the list of markdown formats that you can use your answer text. |
| 4 | +ms.service: cognitive-services |
| 5 | +ms.subservice: language-service |
| 6 | +ms.author: mbullwin |
| 7 | +author: mrbullwinkle |
| 8 | +ms.topic: reference |
| 9 | +ms.date: 01/21/2022 |
| 10 | +--- |
| 11 | + |
| 12 | +# Markdown format supported in answer text |
| 13 | + |
| 14 | +Question answering stores answer text as markdown. There are many flavors of markdown. In order to make sure the answer text is returned and displayed correctly, use this reference. |
| 15 | + |
| 16 | +Use the **[CommonMark](https://commonmark.org/help/tutorial/index.html)** tutorial to validate your markdown. The tutorial has a **Try it** feature for quick copy/paste validation. |
| 17 | + |
| 18 | +## When to use rich-text editing versus markdown |
| 19 | + |
| 20 | +Rich-text editing of answers allows you, as the author, to use a formatting toolbar to quickly select and format text. |
| 21 | + |
| 22 | +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. |
| 23 | + |
| 24 | +## Supported markdown format |
| 25 | + |
| 26 | +Following is the list of markdown formats that you can use in your answer text. |
| 27 | + |
| 28 | +|Purpose|Format|Example markdown| |
| 29 | +|--|--|--| |
| 30 | +A new line between 2 sentences.|`\n\n`|`How can I create a bot with \n\n question answering?`| |
| 31 | +|Headers from h1 to h6, the number of `#` denotes which header. 1 `#` is the 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...`<br><br>`\n# my h1 \n## my h2\n### my h3 \n#### my h4 \n##### my h5`| |
| 32 | +|Italics |`*text*`|`How do I create a bot with *question answering*?`| |
| 33 | +|Strong (bold)|`**text**`|`How do I create a bot with **question answering***?`| |
| 34 | +|URL for link|`[text](https://www.my.com)`|`How do I create a bot with [question answering](https://language.cognitive.azure.com/)?`| |
| 35 | +|*URL for public image|``|`How can I create a bot with `| |
| 36 | +|Strikethrough|`~~text~~`|`some ~~questions~~ questions need to be asked`| |
| 37 | +|Bold and italics|`***text***`|`How can I create a ***question answering**** bot?`| |
| 38 | +|Bold URL for link|`[**text**](https://www.my.com)`|`How do I create a bot with [**question answering**](https://language.cognitive.azure.com/)?`| |
| 39 | +|Italics URL for link|`[*text*](https://www.my.com)`|`How do I create a bot with [*question answering*](https://language.cognitive.azure.com/)?`| |
| 40 | +|Escape markdown symbols|`\*text\*`|`How do I create a bot with \*question answering*\*?`| |
| 41 | +|Ordered list|`\n 1. item1 \n 1. item2`|`This is an ordered list: \n 1. List item 1 \n 1. List item 2`<br>The preceding example uses automatic numbering built into markdown.<br>`This is an ordered list: \n 1. List item 1 \n 2. List item 2`<br>The preceding example uses explicit numbering.| |
| 42 | +|Unordered list|`\n * item1 \n * item2`<br>or<br>`\n - item1 \n - item2`|`This is an unordered list: \n * List item 1 \n * List item 2`| |
| 43 | +|Nested lists|`\n * Parent1 \n\t * Child1 \n\t * Child2 \n * Parent2`<br><br>`\n * Parent1 \n\t 1. Child1 \n\t * Child2 \n 1. Parent2`<br><br>You can nest ordered and unordered lists together. The tab, `\t`, indicates the indentation level of the child element.|`This is an unordered list: \n * List item 1 \n\t * Child1 \n\t * Child2 \n * List item 2`<br><br>`This is an ordered nested list: \n 1. Parent1 \n\t 1. Child1 \n\t 1. Child2 \n 1. Parent2`| |
| 44 | + |
| 45 | +* Question answering doesn't process the image in any way. It is the client application's role to render the image. |
| 46 | + |
| 47 | +If you want to add content using update/replace knowledge base APIs and the content/file contains html tags, you can preserve the HTML in your file by ensuring that opening and closing of the tags are converted in the encoded format. |
| 48 | + |
| 49 | +| Preserve HTML | Representation in the API request | Representation in KB | |
| 50 | +|-----------|---------|-------------------------| |
| 51 | +| Yes | \<br\> | <br> | |
| 52 | +| Yes | \<h3\>header\</h3\> | <h3>header</h3> | |
| 53 | + |
| 54 | +Additionally, `CR LF(\r\n)` are converted to `\n` in the KB. `LF(\n)` is kept as is. If you want to escape any escape sequence like a \t or \n you can use backslash, for example: '\\\\r\\\\n' and '\\\\t' |
| 55 | + |
| 56 | +## Next steps |
| 57 | + |
| 58 | +* [Import a knowledge base](../how-to/migrate-knowledge-base.md) |
0 commit comments