編輯

共用方式為


Formatting bot messages

Important

This article is based on the v3 Bot Framework SDK. If you are looking for current documentation version 4.6 or later of the SDK, see the conversational bots section.

You can set the optional TextFormat property to control how your message's text content is rendered.

Microsoft Teams supports the following formatting options:

TextFormat value Description
plain The text should be treated as raw text with no formatting applied at all.
markdown The text should be treated as Markdown formatting and rendered on the channel as appropriate; see Formatting text content for supported styles.
xml The text is simple XML markup; see Formatting text content for supported styles.

Formatting text content

Teams supports a subset of Markdown and XML (HTML) formatting tags.

The following limitations apply:

  • Text-only messages do not support table formatting.

For information on formatting in cards, see Teams Card Reference.

Cross-platform support

To ensure that your formatting works across all platforms supported by Teams, be aware that some styles aren't supported across all platforms.

Style Text-only messages Cards (XML only)
bold
italic
header (levels 1–3)
strikethrough
horizontal rule
unordered list
ordered list
preformatted text
blockquote
hyperlink
image link

Support by individual platform

Support for text formatting varies by type of message and by platform.

Text-only messages

Style Desktop iOS Android
bold
italic
header (levels 1–3)
strikethrough
horizontal rule
unordered list
ordered list
preformatted text
blockquote
hyperlink
image link

Examples of text formatting

Style Example Markdown XML (HTML)
bold text **text** <strong>text</strong>
italic text *text* <em>text</em>
header (levels 1–3) Text ### Text <h3>Text</h3>
strikethrough text ~~text~~ <strike>text</strike>
unordered list
  • text
  • text
* text
* text
<ul><li>text</li><li>text</li></ul>
ordered list
  1. text
  2. text
1. text
2. text
<ol><li>text</li><li>text</li></ol>
preformatted text text `text` <pre>text</pre>
blockquote
text
>text <blockquote>text</blockquote>
hyperlink Bing [Bing](https://www.bing.com/) <a href="https://www.bing.com/">Bing</a>
image link Duck on a rock ![Duck on a rock](http://aka.ms/Fo983c) <img src="https://aka.ms/Fo983c" alt="Duck on a rock"></img>