{"id":103482,"plugin_id":"plugins_6aee4fde227881919d61b034b1c31096","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-18T06:20:18.541Z","digest":"5b4c2f1def497da9007009ec4cc5e678d34f5131f5ae9b41a844a3d78c4d3b11","against":null,"payload":{"description":"Render Markdown from templates and structured data using Knap CLI. Use when the user asks to apply a Knap template, turn JSON or CSV data into notes, batch-generate Markdown files, or format Defuddle output into a note.","included_files":[],"name":"knap","skill_md_contents":"---\nname: knap\ndescription: Render Markdown from templates and structured data using Knap CLI. Use when the user asks to apply a Knap template, turn JSON or CSV data into notes, batch-generate Markdown files, or format Defuddle output into a note.\n---\n\n# Knap\n\nUse Knap CLI to render Markdown templates with variables, filters, and logic.\n\nCheck availability with `knap --help`. If it is missing, explain that Knap requires Node.js 20 or later and offer installation with `npm install -g knap` or execution with `npx knap`. Do not claim a template was rendered if the tool is unavailable or returns an error.\n\nRun `knap --help` for available commands and options. Discover the language through the CLI's offline reference:\n\n```bash\nknap help syntax\nknap help filters\nknap help filter date\nknap help tags\nknap help tag for\n```\n\nUse the lists to find names, then request individual help for syntax, parameters, and examples with expected output.\n\n## Usage\n\nRender a template with JSON variables:\n\n```bash\nknap render template.md --data article.json -o note.md\n```\n\nSupply a template and data inline:\n\n```bash\nknap render -t '# {{ title | trim }}' --data-json '{\"title\":\"Hello\"}'\n```\n\nOverride a variable or pipe JSON data:\n\n```bash\nknap render template.md --data article.json --set 'title=Custom title'\ncat article.json | knap render template.md --data -\n```\n\nData must be a JSON object; its properties become template variables. `--set` overrides literal top-level keys with strings. Use JSON for nested objects, arrays, numbers, and booleans.\n\nChoose one template source (file, `-t`, or stdin) and one data source (`--data` or `--data-json`). Only one input can read stdin. Without a template file or `-t`, Knap reads the template from stdin.\n\nOutput defaults to stdout. `-o` creates parent directories and overwrites the destination after rendering succeeds. Errors exit with status `1`; diagnostics go to stderr. Warnings can accompany successful output.\n\n## Templates\n\nUse `{{ variable }}` for values, `|` for filters, and `{% ... %}` for logic. For example, save this as `template.md`:\n\n```knap\n---\n{{ title | yaml_property:\"title\" }}\n{{ tags | yaml_property:\"tags\" }}\n---\n# {{ title | trim }}\n{% if author %}\nBy {{ author }}\n{% endif %}\n\n{{ content }}\n```\n\nUse `yaml_property` for complete frontmatter properties so values are quoted and indented correctly. The CLI includes standard filters, but does not supply Web Clipper browser variables, selectors, prompts, or DOM-dependent HTML filters. Supply variables through JSON.\n\nCheck a template before rendering:\n\n```bash\nknap validate template.md\n```\n\nValidation checks syntax, filter names, and static filter arguments without data or file output. It does not check variable existence, runtime values, or dynamic arguments; render with real data to check runtime behavior. Diagnostics go to stderr and include relevant help commands.\n\n## Defuddle pipeline\n\nExtract a web page as JSON with Markdown content, then render it into a note:\n\n```bash\ndefuddle parse https://example.com/article --md --json \\\n  | knap render template.md --data - -o note.md\n```\n\nDefuddle's JSON properties, such as `title` and `content`, become template variables directly.\n\n## Batch rendering\n\nCreate one file per CSV row, JSON array object, or JSON file in a folder:\n\n```bash\nknap batch template.md --data articles.csv --output-dir notes \\\n  --filename '{{ title | safe_name }}.md'\n```\n\nUse `--data articles.json` for an array or `--data ./articles` for a folder of JSON objects. CSV headers become variable names and values remain strings. Piped data defaults to JSON; add `--format csv` for piped CSV.\n\nUse `--dry-run` to validate and list output paths without writing files. Existing files require `--overwrite`, including during a dry run. Duplicate output names within a batch are errors even with `--overwrite`.\n\nFilename templates must produce a single filename with its extension, without directories. Use `safe_name` for data-derived names. Without `--filename`, Knap preserves source JSON basenames or numbers CSV rows and array items as `1.md`, `2.md`, and so on.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}