Skip to content

Markdown

Stable

Turns the assistant's formatted text into headings, lists, links and tables, even while it is still being written.

Also known as rich text, markdown renderer, formatted text

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

A rich reply

Quarterly summary

Revenue grew 12% over the last quarter, mostly from the enterprise segment.1 Read the full report for detail.

SegmentGrowth
Enterprise+18%
Self-serve+4%
Churn held steady at 2.1%.

Next steps:

  • Review renewals due in November
  • Check self-serve conversion

ts
const growth = (a: number, b: number) => (b - a) / a;

Shows a heading, bold and italic text, a link, a source number, a table, a quote, a list, a divider and code.

When to use it

Turns the assistant's formatted text into real headings, lists, tables and code. It builds the page safely and copes with text that stops halfway, so it can show a reply while it is still arriving.

Made of: Headings and paragraphs · Bold, italic and links · Source numbers · Lists (up to 3 levels) and quotes · Tables · Code blocks

Use it for

  • The body of an assistant reply.
  • A reply that is still being written: pass all the text so far each time.
  • A draft document shown inside a CanvasPanel.

Not for

  • A code sample on its own, outside a reply: use CodeBlock.
  • Text that people need to edit.

Do and avoid

Your trip

  • Flight lands at 9:40
  • Hotel check-in from 2 pm
Do. Bold text and a short list make the reply easy to scan.

<b>Your trip</b><br><ul><li>Flight lands at 9:40</li></ul>

Avoid. Web code shows up as raw tags, so the reply looks broken.

Do

  • Put it in a container that sets text size and spacing.
  • While the reply is being written, give it all the text so far each time.
  • Show a SourceList under the reply so the [1] markers point somewhere.
  • Use it for assistant replies, where the content is not known ahead of time.

Avoid

  • Do not expect images, web code, checkbox lists or lists deeper than three levels. Deeper items stay at level three.
  • Do not add web code to the text. It is shown as plain text.
  • Do not use it to edit documents. It only displays text.
  • Do not rely on it for the page's heading structure. Its headings sit below the page title.

On a phone

  • Tables and code blocks scroll sideways inside their own box, so a wide one never pushes the page wider.
  • Source markers like [1] get a larger invisible tap area on a touch screen.
  • Paragraphs wrap long unbroken words and addresses, so they do not push the page wider.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started