Overview
This guide show the overview implementation and explains how TinaCMS handles rich text input, converting it into Markdown using Slate, Plate, and Mdast.
📌 Prerequisites
Before diving in, ensure you have a basic understanding of:
- Slate & Plate – Core libraries for handling rich text in TinaCMS.
- Abstract Syntax Trees (AST) – Used to structure text transformations.
- Mdast & Remark – Markdown processing tools.
How TinaCMS Converts Rich Text to Markdown
When users type in the Rich Text Editor (RTE), their input moves through multiple layers before being stored as Markdown. Check out [getting-started](https://sswcom.sharepoint.com.mcas.ms/:w:/r/sites/SSWTinaCMS/_layouts/15/doc2.aspx?sourcedoc=%7BC434F640-D923-488D-8C70-88519E649D97%7D&file=getting-started.docx&action=default&mobileredirect=true] for diagram visual (excalidraw diagram)
Slate (User Input Layer)
- Users enter text and apply formatting (bold, italic, links, etc.).
- The editor stores this in Slate’s JSON-based format.
TinaCMS Layer (Intermediate Processing)
- Converts Slate data into a Markdown-compatible format.
- Uses key functions:
stringifyMDX(for converting MDX elements to Markdown)parseMDX(for converting Markdown back into Slate format)
Mdast (Markdown AST Representation)
- Markdown syntax is structured as an Abstract Syntax Tree (AST).
Remark (Markdown Processing)
- Converts the Mdast structure into final Markdown text.
Check out internal getting-started docs for diagram visualize
Key Components in TinaCMS
Stringify Module
- Converts MDX elements to Markdown.
- Location:
packages/@tinacms/mdx/src/next/stringify - Function:
stringifyMDX()
Parse Module
- Converts Markdown back into a Slate-compatible format.
- Location:
packages/@tinacms/mdx/src/next/parse - Function:
parseMDX()
For a deeper dive into how TinaCMS interacts with Plate, visit TinaCMS + Plate.
Additional Information
Understanding Remark & Mdast
- Remark is built on top of Mdast, similar to how shadcn is built on top of Radix.
- Mdast stores Markdown as an AST, while Remark provides utilities to modify it.