---
title: Knap Markdown Templates
description: Learn Knap in Phasoric with working JSON-to-Markdown examples, loops, filters, YAML frontmatter, reusable artifacts, and source-backed intelligence briefs.
excerpt: Learn Knap in Phasoric with working JSON-to-Markdown examples, loops, filters, YAML frontmatter, reusable artifacts, and source-backed intelligence briefs.
category: Templates & Artifacts
icon: 📋
sort_order: 16
published_at: 2026-09-11T00:00:00Z
updated_at: 2026-09-11T00:00:00Z
tags:
  - Knap
  - Markdown templates
  - JSON to Markdown
cta_heading: Give your knowledge a reusable document format
cta_copy: Create a Phasoric workspace to write, validate, and preview Knap templates, then turn selected sources into editable Markdown.
cta_label: Start using templates in Phasoric
cta_workflow: markdown-templates
cta_target: markdown-templates
faq:
  - question: What is Knap used for?
    answer: Knap formats supplied data into Markdown. In Phasoric, it can produce reusable note layouts, artifact previews, reviewed source notes, and evidence briefs.
  - question: Does Knap need an AI model?
    answer: Formatting supplied values does not require an AI call. A configured Phasoric workflow can ask a model for structured JSON first, validate it, and then render it through a template.
  - question: Can I use an Obsidian Web Clipper template in Phasoric?
    answer: The shared Knap syntax is a useful starting point. Web Clipper selectors, browser variables, and other application-specific values need equivalent Phasoric inputs. Import the template and validate it with representative data before using it.
  - question: Will changing a template update my existing notes?
    answer: No. Saving creates a new template version. Existing generated notes remain ordinary Markdown and are not automatically rewritten.
  - question: Are preview variables saved into a new note?
    answer: Test variables are preview inputs. Create note supplies the note title, vault, folder, date, time, and datetime. Artifact Studio supplies its title, request, and selected source objects.
  - question: Can a downloaded note be read without Knap or Phasoric?
    answer: Yes. The output is Markdown. Rendering provenance is optional document metadata; reading the generated text does not require a template engine.
slug: knap-markdown-templates
canonical_url: https://phasoric.com/guides/knap-markdown-templates
markdown_url: https://phasoric.com/guides/knap-markdown-templates.md
---
# Knap Markdown Templates

Use Knap when you want a repeatable document layout for information you already have: a project record, a collection of sources, or the accepted evidence behind an intelligence brief. In Phasoric, you can write the template once, test it with JSON, and reuse it as your source material changes.

This guide starts with a complete JSON-to-Markdown example, then explains the Phasoric workflows that supply real inputs. You can read and copy the examples without creating an account.

- [What is Knap?](#what-is-knap)
- [Create your first Knap template](#create-your-first-knap-template)
- [A complete JSON-to-Markdown example](#a-complete-json-to-markdown-example)
- [Filters and YAML frontmatter](#filters-and-yaml-frontmatter)
- [Use templates for notes and artifacts](#use-templates-for-notes-and-artifacts)
- [Render an Intelligence Pack evidence brief](#render-an-intelligence-pack-evidence-brief)
- [Template versions, source context, and troubleshooting](#template-versions-source-context-and-troubleshooting)

## What is Knap?

[Knap](https://github.com/obsidianmd/knap) is a Markdown template language maintained in the Obsidian project. Its syntax is shared by tools including Obsidian Web Clipper and Importer. Applications provide the data; Knap formats it with variables, conditions, loops, and filters.

Phasoric uses the official Knap package through its rendering runtime. The runtime also supports ordinary Markdown templates. Knap templates are useful when a layout needs structured inputs, such as a list of sources or a nested project object.

For example, a research workflow may already know which claims are accepted, which publication supports each claim, and the relevant reporting date. A template gives that information a consistent document layout. Choosing the evidence and deciding what it means remain separate steps.

**Structured information → input checks → saved template → Markdown → review and save.**

For templates that use only supplied values, the same input and template version produce the same Markdown body. Generation timestamps remain separate metadata. This makes recurring reports easier to inspect and compare.

## Create your first Knap template

1. Open **Templates** in your Phasoric workspace.
2. Select **New template**, give it a name, and choose **Knap** in the **Renderer** selector.
3. Paste a template into **Markdown template**.
4. Enter sample data in **Test variables (JSON)**.
5. Select **Validate syntax**, then **Preview output**.
6. Review any diagnostics and select **Save template**.

Syntax validation checks the template without running its filters or resolvers. Preview renders with your sample data so you can check the output as well as the syntax.

To start with a note layout, use:

```knap
# {{ title | escape_md }}

Date: {{ date }}

## Notes

## Decisions

## Next actions
- [ ]
```

The `{{ ... }}` expressions insert values. In this example, `escape_md` keeps punctuation in the title from accidentally becoming Markdown formatting. Ordinary headings and checklist text remain exactly where you put them.

For the simpler six-placeholder workflow, see [Vault Templates](/guides/vault-templates).

## A complete JSON-to-Markdown example

Imagine a weekly review with two already-selected sources. Paste this object into **Test variables (JSON)**. The URLs below are illustrative; replace them with your own source URLs.

```json
{
  "title": "Weekly evidence brief",
  "summary": "Two sources are ready for review",
  "status": "Review",
  "tags": ["research", "weekly"],
  "sources": [
    {
      "title": "Project update",
      "publisher": "Project team",
      "url": "https://example.com/project-update"
    },
    {
      "title": "Decision record",
      "publisher": "Review group",
      "url": "https://example.com/decision-record"
    }
  ]
}
```

Use this as the **Markdown template**:

```knap
# {{ title | escape_md }}

{{ summary | escape_md }}

## Sources
{% if sources %}
{% for source in sources %}
- {{ source.url | link:source.title }} — {{ source.publisher | escape_md }}
{% endfor %}
{% else %}
No sources were supplied. Add source data before using this brief.
{% endif %}
```

The preview contains the title, summary, and a linked list. The generated Markdown includes:

```markdown
# Weekly evidence brief

Two sources are ready for review

## Sources
- [Project update](https://example.com/project-update) — Project team
- [Decision record](https://example.com/decision-record) — Review group
```

Whitespace around loop blocks can add blank lines. The links and text carry the same meaning.

The **for loop** formats each source. The **if condition** handles a missing or empty collection. The **link filter** takes the URL as its input and the label after the colon: `source.url | link:source.title`. Keeping those arguments in that order produces a readable label pointing to the correct destination.

This example uses data you supply. Mentioning `sources` in a template does not search the web or retrieve private notes by itself. In a production workflow, Phasoric supplies the selected, authorized source objects.

## Filters and YAML frontmatter

A filter transforms a value at the point where it appears in the document. These are useful building blocks for Phasoric templates:

| Task | Template expression |
| --- | --- |
| Preserve a literal title | `{{ title \| escape_md }}` |
| Link to a note title | `{{ title \| wikilink }}` |
| Turn tags into a list | `{{ tags \| list }}` |
| Render rows as a table | `{{ rows \| table }}` |
| Format a source link | `{{ url \| link:title }}` |
| Serialize tags into frontmatter | `{{ tags \| yaml_property:"tags" }}` |

For frontmatter, let a YAML filter handle quoting and collection formatting. With the sample JSON above, this template produces a document with title, status, and tags:

```knap
---
{{ title | yaml_property:"title" }}
{{ status | yaml_property:"status" }}
{{ tags | yaml_property:"tags" }}
---

# {{ title | escape_md }}

{{ summary | escape_md }}
```

Phasoric can add a `phasoric` metadata block identifying the renderer and template version when it creates a generated note or artifact. Keep your own descriptive fields alongside that generation record.

The [official filter reference](https://obsidian.md/help/web-clipper/filters) and [logic reference](https://obsidian.md/help/web-clipper/logic) provide more language examples. Application-specific variables and available integrations can differ between tools. Validate imported templates against Phasoric's inputs.

## Use templates for notes and artifacts

**Create note** uses the saved template and the new note's title, vault, folder, date, time, and datetime. The JSON you type under **Test variables** is for preview; it is not automatically used as the content of a newly created note.

For a source-based deliverable, open **Artifact Studio**, select the relevant sources, and choose a saved template under **Rendering template**. The rendering inputs include `title`, `request`, and `sources`. A source list can use each source's `title` and `path`:

```knap
# {{ title | escape_md }}

## Request
{{ request | escape_md }}

## Source notes
{% for source in sources %}
- {{ source.title | wikilink }} — {{ source.path | code }}
{% endfor %}
```

The result is an editable artifact preview. Check the selected evidence, edit the document, and save through the existing review flow. You can browse the available studios in the [Phasoric Marketplace](/marketplace).

For configured AI workflows, a Prompt Recipe can declare a structured output schema and rendering template. The model first returns JSON; Phasoric checks it and then renders the document before creating a Forge proposal. Invalid JSON or invalid inputs stop that proposal. This lets reasoning use a model while recurring formatting remains in a reusable template. See [Connected Intelligence](/connected-intelligence) and [Forge workflows](/guides/forge-automation-workflows) for the surrounding workflow.

## Render an Intelligence Pack evidence brief

In an Intelligence Pack's evidence view, select **Preview evidence brief**. Phasoric formats the accepted assertions in that view, including the evidence date and source references. Select **Download Markdown brief** to keep a portable copy.

The brief retains template and source-version information. When the evidence view is paginated, the brief describes the current page. Its purpose is to preserve the evidence you are inspecting; it does not imply that every document in the pack has been summarized.

The reviewed source-ingestion path also uses a template to turn normalized source passages into Markdown. This gives source notes a consistent layout while preserving their ingestion receipt and original source identity.

Domain and Intelligence Pack authors can bundle named, versioned templates. For example, `investing/company` and `education/lesson` identify templates within separate namespaces. Bundled templates are validated before activation. A pack declares approved rendering capabilities rather than supplying executable filter code. See [Installable Feature Packs](/guides/installable-feature-packs) for the installation workflow.

## Template versions, source context, and troubleshooting

**Saving a template creates a new version.** Existing notes stay as they are. Generated artifacts retain the template identity, version, and source context needed to inspect how their content was created. They can still be read as normal Markdown without Phasoric or Knap.

Use **Export template file** for a portable `.md.knap` file. Use **Export with schema** when you also need the input declaration and template metadata. Import a template for review, supply representative sample values, and validate it before saving.

If a preview fails, use the diagnostic code and line/column location:

- **Syntax error:** check that each `if` and `for` block has its matching closing tag.
- **Unknown filter:** check the spelling and whether that filter is available in Phasoric.
- **Unknown variable:** add a representative sample value, or check which inputs the intended workflow supplies.
- **Input validation error:** match the template's declared types and required fields. A number and a quoted number are different JSON values.
- **Rendering limit:** reduce the template, collection size, or output. For a large corpus, render a bounded evidence view.

Approved resolvers can supply additional information in configured Phasoric workflows. Explicit input values take precedence. Templates do not receive arbitrary filesystem, network, or credential access, and the browser preview treats generated Markdown as content to display safely.

For related workflows, continue with [Vault Templates](/guides/vault-templates), [Research Studio](/guides/research-studio), or [public sharing and export](/guides/public-sharing-and-export).
