Skip to content
프로젝트

소개

데이터를 Markdown으로 변환하는 간단한 템플릿 언어입니다.

개발 도구

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
+2
in 7 days
+9
in 15 days
+21
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Knap

Knap is a simple template language that turns data into Markdown using variables, filters, and logic. It powers templating in Obsidian Web Clipper and Obsidian Importer.

Documentation · Playground

Knap parses templates into an AST and interprets them without eval or arbitrary JavaScript execution. Applications control the data and integrations available to templates.

Install

npm install knap

Node.js 20 or later is required for the CLI.

CLI

Render a template with JSON data:

npx knap render template.md --data data.json --output note.md

Knap also supports inline templates, validation, batch rendering, CSV input, and offline language help. See the CLI guide.

Library

import { createEngine, standardFilters } from 'knap';

const engine = createEngine({ filters: standardFilters });

const markdown = await engine.renderOrThrow(
	'# {{ title | trim }}\n\n{{ tags | list }}',
	{
		variables: {
			title: '  An imported note  ',
			tags: ['reference', 'reading'],
		},
	},
);

See the API guide for rendering, validation, custom filters, asynchronous variables, HTML filters, and execution limits.

Syntax highlighting

Knap syntax highlighting is available for .knap and .knap.md templates:

  • VS Code and Cursor: Download knap.vsix from the latest release, then choose Extensions: Install from VSIX from the command palette.
  • Sublime Text 4: Download Knap.sublime-package from the latest release and place it in Sublime Text's Installed Packages folder.
  • Prism: Run npm install knap prismjs, then import the adapter from knap/prism.
  • CodeMirror 6: Run npm install knap @codemirror/language, then import the adapter from knap/codemirror.
  • highlight.js: Run npm install knap highlight.js, then import the adapter from knap/highlightjs.

See the syntax highlighting guide for setup examples, CodeMirror 5 support, and editor-specific details.

Documentation

Development

pnpm install
pnpm check

The portable rendering fixtures make selected documentation examples and regression expectations reusable by implementations in other languages.

Knap is available under the MIT License.

관련 프로젝트 살펴보기

불러오는 중…