# htmlToBlocks (@salmonui/rich-text)

> The htmlToBlocks function of @salmonui/rich-text: Parses HTML into blocks (parseHtmlToBlocks). The HTML is sanitized first. Ids come from data-block-id; missing or duplicate ids get deterministic ones from the index path (b0, b2-1, ...), so server and client agree. Content the block model has no type for (iframe embeds, images inside text) is dropped.

Canonical: https://salmonui.dev/docs/reference/rich-text/htmlToBlocks

```ts
import { htmlToBlocks } from '@salmonui/rich-text';
```

Entry index: https://salmonui.dev/docs/reference/rich-text (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/rich-text.md).

## Reference

Kind: function

```ts
function htmlToBlocks(html: string): Block[];
```

Parses HTML into blocks (`parseHtmlToBlocks`). The HTML is
sanitized first. Ids come from `data-block-id`; missing or duplicate ids get
deterministic ones from the index path (`b0`, `b2-1`, ...), so server and
client agree. Content the block model has no type for (iframe embeds,
images inside text) is dropped.
