For the complete documentation index, see llms.txt. This page is also available as Markdown.

Markdown Rendering

Message content rendering in Web Chat: how Markdown headings, lists, tables, code blocks, and links appear in the chat window, the optimizations, and administrator settings.

This article introduces the message content rendering optimizations in the Web Chat window, which make Agent responses clearer and easier to read.

What Is Message Content Rendering?

Message content rendering refers to how Web Chat converts an Agent's text response into the visual presentation that users see. An Agent's response may include:

  • Plain text: General text descriptions

  • Markdown formatting: Headings, lists, bold, italics, and other formatting

  • Code blocks: Code examples or commands

  • Tables: Structured data presentation

  • Links: External links or reference materials

Good rendering makes this content easier to read and understand.

Optimization Items

1. Fully Upgraded Markdown Rendering Engine

Web Chat now uses an enhanced Markdown rendering engine that supports richer formatting and more precise rendering.

Supported Markdown Formats

Format Type
Syntax Example
Rendering Description

Headings

# Heading 1, ## Heading 2

Clear heading hierarchy for dividing content into sections

Bold

**bold text**

Emphasizes key content

Italic

*italic text*

Secondary emphasis or supplementary notes

Lists

- Item 1, 1. Item 1

Ordered or unordered lists

Inline code

`code`

Inline code or commands

Code blocks

```code```

Multi-line code with syntax highlighting support

Tables

| Column 1 | Column 2 |

Structured data display

Links

[link text](URL)

Clickable hyperlinks

Blockquotes

> quote content

Quotations or special notes

Images

![description](image URL), ![description](image URL){width=200px}

Displays an image; a {…} placed right after the URL sets the display size. See Adjusting Image Display Size

  • Links in responses always open in a new tab, so users don't leave the current conversation (the only exception is in-page anchors #…).

  • When a link points to a PDF or another file, the browser decides how it opens: Chrome, Edge, and Safari open PDFs in a new tab with the built-in viewer, and URLs with a page number such as https://example.com/manual.pdf#page=12 jump straight to that page; if the browser is set to download PDFs, the file is downloaded instead. Web Chat does not rewrite the URL or force a download.

  • To have the Agent reply with a "text link plus page number" instead of an attachment: put the document URL (including the page number) in the url metadata of the knowledge base document or in the FAQ answer, and instruct the Agent in its role instructions to reply with Markdown links. See Custom URL Mapping. Downloading cited documents from the sources is a separate mechanism, controlled by "Allow downloading cited documents" in Function Settings.

Adjusting Image Display Size

Markdown images in Agent responses are displayed at their original size by default, up to the width of the message column. Add {width=…} or {height=…} immediately after the closing parenthesis of the image URL to set the display size of that image. Both Web Chat and the back-office conversation view (for example, when you click Start Conversation from the Agent Marketplace) support this.

For example, a customer service manager at an e-commerce company noticed that when the Agent replied with product images, a single image filled the entire chat window and customers had to keep scrolling to see the text. She added an instruction to the Agent's role instructions to always output product images in the format ![product image](image URL){width=200px} (for where to enter this, see Add Role Instructions to an Agent). After that, product images shown to customers in Web Chat on the company website have a fixed width of 200px, and colleagues chatting with the same Agent in the back office see the same size.

Rule
Description

Available settings

Only width and height, always lowercase, each at most once, in any order

Units

px or %; the value must be greater than 0 and may include decimals (for example, 33.5%); % cannot exceed 100

Basis for percentages

% is calculated against the width of the message column

Setting both width and height

Separate the two settings with a space ({width=300px height=200px}), not a comma

Setting only one

The other dimension is adjusted automatically to keep the original aspect ratio

Position

{ must immediately follow the ) of the URL, with no space in between

Exceeding the message column width

The image is automatically scaled down to fit within the message column without distortion

In Web Chat, the Agent replies with two identical images; the first is displayed at its original size, and the second is labeled with a specified width of 200px and appears smaller
Web Chat: the same image without a specified size (top) and with {width=200px} (bottom)
In the back-office conversation view, the Agent replies with two identical images; the first is displayed at its original size, and the second is labeled with a specified width of 200px and appears smaller
Back-office conversation view: the same response, where the second image has a width of 200px

Size settings only take effect in Web Chat and the back-office conversation view. Messaging channels such as LINE, Messenger, Instagram, and WhatsApp do not apply them, and the {width=…} after an image remains in the message as text. If the same Agent also serves these channels, we recommend not asking for the size syntax in the role instructions.

2. Dark Mode Visual Optimization

When an end user's device uses a dark theme, Web Chat automatically adjusts the visual presentation of message content to ensure clarity and readability on dark backgrounds.

Dark Mode Adjustments

  1. Text and background contrast: Automatically adjusts text color for clear display on dark backgrounds

  2. Message feedback buttons: Adjusts button colors and borders so they remain clear in dark mode

  3. Table visuals: Adjusts table borders and background colors for improved readability

  4. Blockquote backgrounds: Adjusts blockquote background tones to set them apart from the main content

3. Streaming Rendering Performance Improvements

Web Chat displays Agent responses through real-time streaming, so users don't need to wait for the complete response to be generated. This update optimizes streaming rendering performance:

  • Faster rendering: Markdown formatting renders more quickly, reducing perceived latency

  • Improved smoothness: Text appears character by character more smoothly, with no noticeable lag

  • Format accuracy: Markdown formatting renders correctly even during streaming

Practical Use Cases

💻 Technical Documentation Assistant

Scenario: When developers ask for code examples, the Agent provides responses that include code blocks.

Optimization Effects:

  • Code blocks support syntax highlighting for easier reading

  • Code displays clearly in dark mode

  • Developers can copy and use the code directly

Example Response:

This code reads a CSV file and displays the first 5 rows.

Here are the top three selling products this quarter:

Product Name
Units Sold
Revenue

Product A

1,250

$125,000

Product B

980

$98,000

Product C

856

$85,600

Sales data is as of the 20th of this month.

  1. Basic Syntax

    • Variables and data types

    • Conditionals and loops

  2. Advanced Concepts

    • Functions and modules

    • Object-oriented programming

  3. Hands-on Practice

    • Complete small projects

    • Contribute to open source

We recommend spending 2-3 weeks on each step.

Last updated

Was this helpful?