Introducing datocms/structured-text-to-markdown
You can now turn Structured Text fields back into Markdown with our new datocms/structured-text-to-markdown
package. Perfect if you need clean Markdown output for your pipelines, exports, or tooling (or just a clean .md page for all the LLMs 🤭).
Just a lil
npm install datocms/structured-text-to-markdown
and you're set!
The renderer supports all DatoCMS Structured Text nodes and converts them to CommonMark-compatible Markdown:
Block Nodes
Headings:
# H1
through###### H6
Paragraphs: Plain text with double newlines
Lists: Both unordered (
-
) and ordered (1.
) lists with nested supportBlockquotes: Lines prefixed with
>
Code blocks: Fenced code blocks with language support
Thematic breaks: Horizontal rules (
---
)
Inline Formatting
Strong:
**bold**
Emphasis:
*italic*
Code:
`code`
Strikethrough:
~~text~~
Highlight:
==text==
(extended Markdown)Underline:
<u>text</u>
(HTML fallback, no native Markdown)
Links
Regular links:
[text](url)
Record links: Custom rendering via
renderLinkToRecord
Full deets on the package and advanced usage are on the README.