# Safe markdown

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.

- Registry name: `safe-markdown` (`@candor/safe-markdown`)
- Tier: Free (MIT). No licence key needed.
- Docs: https://candor.themethodic.com/docs/safe-markdown

## Install

```bash
npx candor-ui add safe-markdown
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/safe-markdown`.
It brings in: chat.

## Functions

### markdownBlocks

```ts
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

```ts
inline(text: string)
```

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

### plainBlocks

```ts
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.

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
