Message Response Formatting
Agent message responses in the Agentforce Mobile SDK are formatted with Markdown. When the SDK renders a message, it interprets the response as Markdown and displays the styled result. The SDK does not render full HTML message responses—HTML markup in a standard message body isn’t parsed and is shown as literal text or stripped, not rendered.
Design your agent responses around Markdown for text formatting (headings, bold and italic text, lists, links, and code). Don’t rely on arbitrary HTML in message content.
Standard agent message responses support common Markdown, including:
- Headings
- Bold and italic text
- Ordered and unordered lists
- Links
- Inline code and code blocks
On Android, Markdown message content is rendered by the AgentforceMarkdownRichText component. For details, see the Rich Text Display components in Android UI Components in the Agentforce Mobile SDK reference.
Full HTML message responses aren’t supported, but the SDK does render HTML for the lightning__richText response component. When an agent action returns a lightning__richText component, the SDK renders its HTML content rather than treating it as Markdown.
HTML support in lightning__richText is limited, and the supported tag set isn’t identical on iOS and Android:
- On iOS, the SDK parses HTML with its own allowlist of tags, so rendering is consistent across every device.
- On Android, the SDK hands HTML off to the Android OS’s built-in HTML renderer, so exact rendering can vary slightly by Android version.
Keep the HTML you return in a lightning__richText component simple and within the tags supported on both platforms.
| Tag(s) | iOS | Android |
|---|---|---|
<b>, <strong> | Bold | Bold |
<em>, <i>, <cite> | Italic | Italic |
<u> | Underline | Underline |
<ins> | Underline | Not rendered |
<s>, <strike>, <del> | Strikethrough | Strikethrough |
<a> | Link | Link |
<img> | Image | Image |
<p> | Paragraph | Paragraph |
<br> | Line break | Line break |
<sup>, <sub> | Superscript, subscript | Superscript, subscript |
<small> | Smaller text | Smaller text |
<ul>, <li> | Bulleted list | Bulleted list |
<ol> | Numbered list | Bulleted list (no numbering) |
<h1>–<h6> | Heading | Heading |
<table>, <tr>, <td> | Table, with borders and styles | Not rendered (stripped to plain text) |
<blockquote> | Not rendered | Blockquote |
<code>, <pre> | Not rendered | Monospace-style text |
<q> | Not supported — rendering is inconsistent | Not rendered |
Tables are the biggest gap between platforms: if a response includes an HTML table, iOS renders it as a table, but Android shows only the inner text. If your agent responses can include tables, test the rendered result on both platforms before shipping.
- Custom Lightning Types on Mobile with the Agentforce Mobile SDK
- Android UI Components (includes Rich Text Display components)