@mdxld/markdown
Bi-directional conversion between Objects and Markdown
@mdxld/markdown
Bi-directional conversion between JavaScript objects and Markdown. Uses convention-based layouts that automatically determine how objects render based on their shape.
Installation
Quick Start
Output:
API Reference
toMarkdown(object, options?)
Convert an object to Markdown using convention-based layout.
Example with options:
fromMarkdown(markdown, options?)
Parse Markdown back to an object using convention-based extraction.
Example:
parseTable(content) / renderTable(headers, rows, options?)
The one markdown table primitive: toMarkdown / fromMarkdown and the entity components of
@mdxld/extract all read and write tables through it, so a table written by one is read by the other.
Diffing what comes back
@mdxld/markdown exports no diff / applyExtract: there is one diff implementation in the repo,
@mdxld/diff (diffPaths, applyPaths, merge3wayObjects), and
@mdxld/extract re-exports it as diff, applyExtract and the 3-way mergeExtract.
Layout Conventions
Objects are rendered based on their shape:
| Property | Markdown Output |
|---|---|
name | # {name} heading |
description | Paragraph after heading |
properties[] | Table with columns |
sections[] | H2 subsections |
items[] | Bulleted list |
Entity Example
Output:
Section Example
Output:
List Example
Output:
Use Cases
Documentation Generation
CMS Content Editing
AI Content Improvement
Related Packages
| Package | Description |
|---|---|
@mdxld/extract | Template-based extraction |
@mdxld/diff | Advanced diffing and patching |
@mdxui/markdown | Styled markdown output |
mdxdb | Document storage |