Install the package with pnpm:
pnpm add @tanstack/markdownThe parser and HTML renderer have no peer dependencies:
import { renderHtml } from '@tanstack/markdown/html'
const html = renderHtml('# Hello')Use the narrowest entry point your application needs:
import { parseMarkdown } from '@tanstack/markdown/parser'
import { renderHtml } from '@tanstack/markdown/html'The default @tanstack/markdown entry re-exports the parser, HTML renderer, inline parser, and all public types.
The React adapter requires React 18 or newer:
pnpm add @tanstack/markdown reactimport { Markdown } from '@tanstack/markdown/react'
export function Article({ source }: { source: string }) {
return <Markdown>{source}</Markdown>
}React is a peer dependency and is not bundled into the adapter.
The Octane adapter requires Octane 0.1.12 or newer:
pnpm add @tanstack/markdown octaneimport { Markdown } from '@tanstack/markdown/octane'
export function Article({ source }: { source: string }) @{
<Markdown>{source}</Markdown>
}Octane is an optional peer dependency and is not bundled into the adapter.
TanStack Markdown ships ESM JavaScript and TypeScript declarations. Its synchronous core works in modern browsers, server runtimes, build tools, React server rendering, and Octane server rendering.
Syntax highlighting is supplied as a callback, so install only the highlighter your application uses. Docs-specific behavior is available through separately importable extensions.