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

knap

graph-knap

Turn data into figures inside a Knap template. Pipe your data through a graph_* filter and it prints the plain-text figure, or a ::graph-* block if you're rendering with Comark.

install

Three names are involved. Knap is the templating language, installed from npm. graph-knap is the set of filters you copy from this registry, and graph_* is what you type in templates. Install the graphs first; all.json already includes the filters.

command

knap

wire

Add graphFilters to createEngine alongside standardFilters. The filters run synchronously and read context.rawValue, so arrays reach them as arrays rather than strings. The Knap CLI doesn't load custom filters, so this only works through the engine.

engine

subset

author

The value you pipe in is the same props object the React component takes, and a string argument sets the title. Every component page has a Knap tab with a template, sample JSON, and the Markdown it produces.

template

format

By default a filter prints the plain-text figure in a code block. Pass comark to get a ::graph-* block instead. Flow, Plot, Activity, Heatmap, Calendar, Timer and Countdown have no plain-text version, so they always print Comark YAML. If you need text output, pick a different graph.

validate

Pass graphFilterMetadata to validateFilters and a misspelled graph_* name is reported just like an unknown standard filter. Limits, resolvers and allowRegex are configured in Knap as usual.

editor

hosts

The output is plain Markdown, so GitHub, Linear, Obsidian and READMEs all show the text figure as is. If you asked for Comark output, a Comark app renders the ::graph-* block. Knap itself lives at obsidianmd/knap.