markdown-to-jsx
Ordinary Markdown can go straight to Fluxdown when migrating from markdown-to-jsx. If your content embeds custom React tags, first decide how those components will be rendered.
Migrate with an agent
Give this prompt to an agent with access to your project:
Replace the component
Before:
Older projects may import from
markdown-to-jsx. The replacement is the same.
After:
In Next.js App Router, put Fluxdown in a wrapper file starting with 'use client';. Keep data fetching in the server page, and define plugin classes and callbacks on the client side instead of passing them through server props.
Fluxdown renders its own container and has no matching wrapper, forceWrapper, or forceInline options. Keep an application wrapper for article semantics and layout. Avoid placing a block Markdown renderer inside paragraphs or other inline containers.
Adapt overrides and styles
For example, set the first-level heading and body font sizes:
Base styles load with the component. If necessary, import fluxdown/styles.css in the application entry. Check existing heading IDs, table-of-contents anchors, line breaks, and HTML parsing with real articles. Enable footnotes, indented code, and Setext headings through build when needed.
Handle embedded application components
Combining overrides: { ProductCard } with <ProductCard /> in Markdown does not automatically map to a Fluxdown slot. Fluxdown does not evaluate JSX expressions inside strings.
If a component already comes from structured data, keep rendering it outside the Markdown. For small substitutions inside text, use patches. For custom syntax, parse it with a plugin and render it through your own Render / Slot plugins. Configure any required HTML tags and attributes through the allowlists described in Rehype plugins.
Connect streaming content
Replace optimizeForStreaming with accumulated text and the request state:
Incomplete syntax behaves differently: Fluxdown attempts to repair the ending and reveal content smoothly instead of waiting for syntax to close. Set pending to false when the request finishes or stops. See Streaming content to adjust the effects.
Remove markdown-to-jsx after all custom components and Markdown entry points have been migrated.