A collection of serializers to convert Slate JSON objects to various formats and vice versa. Designed to work in both Node.js and browser environments.
| Primary docs | |
|---|---|
| Interactive | slate-serializers-demo (source) — live examples for each serializer |
| Published on npm | README in each package (e.g. @slate-serializers/html, @slate-serializers/react) |
| In this repo | docs/config/ — slateToDom, htmlToSlate, slateToMarkdown, SlateToReact · engineering.md |
- Convert Slate to a DOM object with
slateToDom. - Use the suite of DOM manipulation tools for
htmlparser2before serializing to HTML. - NPM: https://www.npmjs.com/package/@slate-serializers/dom.
- Convert Slate to HTML and vice versa with
htmlToSlateandslateToHtml. - NPM: https://www.npmjs.com/package/@slate-serializers/html.
- Include top-level custom components with
slateToTemplate. Framework agnostic - e.g. return Astro, React or Vue components alongside regular HTML nodes. - NPM: https://www.npmjs.com/package/@slate-serializers/template
- Convert Slate to React with
slateToReact. - NPM: https://www.npmjs.com/package/@slate-serializers/react
- Convert Slate to GitHub Flavored Markdown with
slateToMarkdown: headings, lists, task lists, tables, code blocks, links, images and marks. - NPM: https://www.npmjs.com/package/@slate-serializers/markdown
- For engineering decisions, see Engineering.
- Review generated NX documentation at NX.
- This repository is an NX monorepo. Review the docs at https://nx.dev/.
- The demo app lives in a separate repository so setups that consume only the published packages are easier to mirror.