graphs inside a plain markdown file
Write ::graph-* blocks in an ordinary .md file. Comark parses them and mdxcn draws the frames, with no MDX and no compile step. The setup follows Sébastien Chopin's demo, and the piece you add is graph-comark.
pnpm dlx shadcn@latest add @mdxcn/graph-comarksource and rendered view of the same file
Below is one Markdown file, rendered. The source is standard CommonMark plus Comark component blocks, and the graphs are the same ones used across these docs. Switch to Source to see what produced them.
Latency crossed 800ms at 14:02, and we rolled back at 14:11.
- 14:02p95 crossed 800ms
- 14:11rolled back the cache flag
- 14:40write the postmortem
Users noticed it on two days that week.
█ up▒ slow· down
79 percent uptime over 14 days, Aug 14 to Aug 27how the pieces fit
Parsing is Comark's job, the graphs are the ones you already copied with shadcn, and the adapter is the only new code in between.
- parse
- Comark turns the
.mdfile into aMarkdownDocument. It can run on the server, in a worker, or on text that's still streaming in. - coerce
- Markdown attributes arrive as strings, so the adapter turns
value="0.86"back into0.86and renamesclasstoclassName. It also waits until required props exist, so a half-streamed table doesn't crash. - render
- Every
::graph-*tag is already allowed, and the same React graph you copied from the registry draws the frame.
where each format belongs
Use JSX in MDX and the plain-text figure on GitHub and in READMEs. Reach for Comark when you want a plain .md file that can render while it streams in.
- MDX / React✓–✓
- App .md file––✓
- README / GitHub–✓–
- Streaming tokens––✓
- auto-close dangling ::
- YAML all-or-nothing
- empty frame until props land
- incomplete YAML can throwhold last good tree