Parse Markdown with parseMarkdown or parseInline, render HTML with renderHtml, renderDocument, renderBlock, or renderInline, configure frontmatter and heading IDs, and reuse the serializable MarkdownDocument AST. Load for @tanstack/markdown core syntax, parser options, HTML output, references, footnotes, lists, tables, or AST work.
Parse Markdown with parseMarkdown or parseInline, render HTML with renderHtml, renderDocument, renderBlock, or renderInline, configure frontmatter and heading IDs, and reuse the serializable MarkdownDocument AST. Load for @tanstack/markdown core syntax, parser options, HTML output, references, footnotes, lists, tables, or AST work.
Heading IDs are a parse concern; visible anchor links are a render concern.
Parse inline content only when no block context is needed
import { parseInline, renderInline } from'@tanstack/markdown'const nodes = parseInline('Use **stable** APIs and `parseMarkdown`.')
const html = nodes.map(node =>renderInline(node)).join('')
console.log(html)
parseInline handles inline syntax only. Use parseMarkdown for headings,
lists, tables, frontmatter, reference definitions, and footnote definitions.
Behavioral Contracts
Parsing is synchronous, deterministic, and normalizes line endings.
Raw block and inline HTML are recognized only with allowHtml: true.
Link and image URLs have unsafe executable protocols removed.
Tight lists place simple content directly under <li>; loose lists retain
paragraph wrappers; task checkboxes remain inline with labels.
Reference definitions resolve case-insensitively before block parsing.
Footnotes render in first-reference order with collision-safe IDs and
repeated-reference back links.
Code fence metadata is recorded in the AST; highlighting is external.
The AST is public but pre-1.0. Regenerate persisted documents when an
upgrade changes node contracts.
Compatibility and Option Timing
TanStack Markdown targets controlled blog and documentation content rather
than complete CommonMark, GFM, MDX, or arbitrary HTML parsing. Before adding
syntax, require corpus evidence, regression coverage, renderer parity, and an
accepted bundle cost. See production-pipelines/SKILL.md for compatibility,
security, highlighting, and size gates.
Parsing fixes the document structure. Apply frontmatter, headingIds,
allowHtml, parser state, and parser/transform extensions before caching the
AST. Renderer-only options such as headingAnchors, highlighter, and
codeLineNumbers may be applied when rendering an existing document.
Setext headings and automatic URL linking are outside the supported syntax
profile, so unsupported input can remain literal or have different structure.
Source: docs/core-concepts/syntax-profile.md
See also: production-pipelines/SKILL.md - compatibility breadth must be
justified against corpus evidence and the bundle budget.
MEDIUM Reparsing unchanged content on every render