Skip to content

Knap Render API

POST https://api.findutils.com/api/tools/knap-render/execute

Render a Knap template (knap.md, the Markdown template language behind Obsidian Web Clipper and Importer) with a JSON object of variables and return the Markdown. Supports {{ variable | filter:"arg" }} with the 70+ standard filters (bold, h1 to h6, table, list, link, wikilink, callout, yaml_property, date, join, sort, unique, where, replace, upper, kebab and more), {% if %}/{% elseif %}/{% else %}, {% for item in items %} with loop.index, loop.first and loop.last, {% set %}, and {# comments #}. The engine is an AST interpreter with no eval; link and image filters drop javascript: and data: destinations. A syntax error is returned with its line and column. Templates are capped at 200,000 characters and output at 1,000,000.

Request body

application/json
  • template

    string required

    The Knap template text.

  • variables

    object required

    A JSON object mapping variable names to values (strings, numbers, booleans, arrays, nested objects). {{ title }} reads variables.title.

  • trim_output

    boolean optional

    Trim leading and trailing whitespace from the rendered Markdown. Default false. Default false.

Example arguments

Verified
{
  "template": "# {{ title | trim }}\n\n{% for tag in tags %}- #{{ tag | kebab }}\n{% endfor %}",
  "variables": {
    "title": "  Reading notes ",
    "tags": [
      "Deep Work",
      "focus"
    ]
  }
}