# blocksToHtml (@salmonui/rich-text)

> The blocksToHtml function of @salmonui/rich-text: Serializes blocks to sanitized HTML in the shared vocabulary (getDataAsHtml). Block ids are written as data-block-id. Pure and server-safe; unsafe values in the JSON (a javascript: link, say) are removed by the sanitizer like any other HTML.

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

```ts
import { blocksToHtml } 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 blocksToHtml(blocks: readonly Block[]): string;
```

Serializes blocks to sanitized HTML in the shared vocabulary (`getDataAsHtml`). Block ids are written as `data-block-id`. Pure and
server-safe; unsafe values in the JSON (a `javascript:` link, say) are
removed by the sanitizer like any other HTML.
