Safe markdown

Free · MIT

Reads model text as safe markdown: paragraphs, lists and fenced code. Never HTML. # lines are bold paragraphs unless headings is set, when #, ## and ### (and deeper, as level 3) become heading blocks.

Markdown

Preview

It's types and helpers, listed below.

Install

With the Candor CLI

First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/safe-markdown

Brings in: chat

Functions

markdownBlocks(text: string, { headings = false }: { headings?: boolean | undefined } = {})

Reads model text as safe markdown: paragraphs, lists and fenced code. Never HTML. # lines are bold paragraphs unless headings is set, when #, ## and ### (and deeper, as level 3) become heading blocks.

inline(text: string)

code, **strong**, *em* and links (as text). Everything else stays literal.

plainBlocks(text: string)

A person's own words as one block, exactly as typed. Adapters use this for user messages: what someone typed is never read as markdown.