graphs from a knap template
Pipe your data through a graph_* filter in a Knap template and the output Markdown contains a framed figure. The Knap CLI doesn't load custom filters, so you register them in your own code.
pnpm dlx shadcn@latest add @mdxcn/graph-knaptemplate and the frames it produces
The same incident as on the Comark page, this time written as a Knap template. Switch to Source to see the template that produced these figures.
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
Templating is Knap's job, and the graphs are the ones you copied with shadcn if you also render React. The filters are the only new code.
- data
- Pass plain JSON, or any variables Knap can resolve. The filter reads the value with its types intact, so there's no special schema to learn.
- filter
- Pipe the data through
graph_timeline,graph_meteror any other graph filter. A string argument sets the title, andcomarkswitches the output to a::graph-*block. - markdown
- You get the plain-text figure, identical to the .md tab in the docs, which reads fine in Obsidian, GitHub and READMEs. Graphs without a text version print Comark YAML instead.
where each format belongs
Knap generates text. It writes the plain-text figure for a README, or the ::graph-* block a Comark app renders. Drawing the live React frame is still the component's job.
- MDX / React✓–✓–
- App .md file––✓✓
- README / GitHub–✓–✓
- Data in, Markdown out–––✓
- same props as react
- official fence, not homemade
- comark param → ::graph-*
- cli loads graph filterswire createEngine