Skip to content
mdxcn is now part of Shadcn Labs. details

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-comark
[ pipeline ]

source 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.

[ NIGHT ]
  1. 14:02p95 crossed 800ms
  2. 14:11rolled back the cache flag
  3. 14:40write the postmortem

Users noticed it on two days that week.

[ API ]

79%

Aug 14Aug 27

█ up▒ slow· down

79 percent uptime over 14 days, Aug 14 to Aug 27

how 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 .md file into a MarkdownDocument. 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 into 0.86 and renames class to className. 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.

[ host ]
JSXASCIIComark
  • MDX / React✓–✓
  • App .md file––✓
  • README / GitHub–✓–
  • Streaming tokens––✓
[ stream ]
  • auto-close dangling ::
  • YAML all-or-nothing
  • empty frame until props land
  • incomplete YAML can throwhold last good tree
3 of 4 done