@comark/react
v0.7.0
Published
React renderer for Comark. Render Markdown with components at runtime, with streaming support for AI output. Works with Next.js and Server Components.
Readme
@comark/react
React renderer for Comark. Render markdown with custom React components, streaming support, and Server Components.
Features
- 🧩
<Markdown>component for one-shot markdown rendering - 🎯 Map any Comark tag to a custom React component
- 🌊 Streaming-friendly with auto-close and caret support
- 🖥️ Works with React Server Components and SSR
- 🔌 Plugin ecosystem (math, mermaid, highlight, binding…)
- 🎯 Full TypeScript support
Installation
npm install @comark/react
# or
pnpm add @comark/reactUsage
import { Markdown } from '@comark/react'
import math, { Math } from '@comark/react/plugins/math'
const content = `# Hello\n\nThis is **Comark** in React.`
export default function App() {
return (
<Markdown components={{ math: Math }} plugins={[math()]}>
{content}
</Markdown>
)
}Custom components
import { Markdown } from '@comark/react'
import { Alert } from './components/Alert'
<Markdown components={{ alert: Alert }}>{content}</Markdown>::alert{type="warning"}
Heads up!
::Streaming
<Markdown streaming={isStreaming} caret>
{content}
</Markdown>Documentation
Full guide and API reference at comark.dev/rendering/react.
License
Made with ❤️
Published under MIT License.
