Yamark
Beta
Yamark formats every layer of a Markdown file in one pass: prose rewraps, YAML frontmatter tidies, and fenced code goes to its language’s formatter - recursively, all the way down. It formats Markdown wherever it lives: .md and .qmd files, YAML scalars, and marked strings or comments in Python and R source. Pass --verify to reparse changed YAML and reject invalid or value-changing output.
yamark format
$ yamark format config.yaml docs/
format config.yaml
format docs/index.md
format docs/reference.qmdFormat
Rewrite supported files in place.
Check
Use non-mutating CI and diff modes.
Embed
Format marked Markdown in Python or R.
Recurse
Format YAML and Markdown inside fences.
A quick example
A short Markdown file with YAML frontmatter - the shape of most skills, prompts, and LLM-readable docs. The first pane is the file as typed; the second is what yamark format writes back.
Before
---
title: Why YAML + Markdown?
description: Token-efficient and human-readable, structured enough for programs and free-form enough for prose - the lingua franca between people and language models.
tags: [llm, authoring, formats]
---
# Why YAML + Markdown?
YAML and Markdown are the closest thing the web has to a native interface between humans and language models: cheap to tokenize, easy to read, and trivial to render. The frontmatter holds the metadata your code wants to query; the body holds the prose people and models want to write.
Where the combination shines:
- Skills and prompt files where typed frontmatter sits next to free-form instructions in one diffable file.
- Agent skills, OpenAI custom GPT instructions, and Cursor rules all follow this shape.
- The body can carry code samples and nested Markdown structures with their own escapes and indentation.
- Retrieval and RAG corpora that humans author and models consume without a build step.
- Tool inputs and outputs that round-trip through chat UIs and stay recognizable after the model rewrites them.
- Authoring pipelines that render the same source to HTML, PDF, and agent context, with no template engine in the middle.After
---
title: Why YAML + Markdown?
description: >-
Token-efficient and human-readable, structured enough for programs and
free-form enough for prose - the lingua franca between people and
language models.
tags: [llm, authoring, formats]
---
# Why YAML + Markdown?
YAML and Markdown are the closest thing the web has to a native
interface between humans and language models: cheap to tokenize, easy to
read, and trivial to render. The frontmatter holds the metadata your
code wants to query; the body holds the prose people and models want to
write.
Where the combination shines:
- Skills and prompt files where typed frontmatter sits next to free-form
instructions in one diffable file.
- Agent skills, OpenAI custom GPT instructions, and Cursor rules all
follow this shape.
- The body can carry code samples and nested Markdown structures with
their own escapes and indentation.
- Retrieval and RAG corpora that humans author and models consume
without a build step.
- Tool inputs and outputs that round-trip through chat UIs and stay
recognizable after the model rewrites them.
- Authoring pipelines that render the same source to HTML, PDF, and
agent context, with no template engine in the middle.Toggle soft wrap on the Before pane to see what the raw file actually looks like. Yamark wraps each region the way its grammar expects: folded scalars at their column, prose at a comfortable width, and list continuations indented under their bullets.
One command
Run yamark format on a file, a folder, or the whole repository. The same command also reads from stdin and runs in CI or editor integrations.
Rewrap after writing
Edit Markdown prose, YAML descriptions, prompt bodies, and front matter without hand-maintaining line breaks.
Optional verification
Use --verify to reparse changed YAML regions and reject invalid or value-changing output before writing.
Performance
Yamark formats a 4 MB Markdown document in 109 ms and a 4 MB YAML file in 69 ms. The next-fastest tool on each is dprint-markdown (349 ms) and yamlfmt (187 ms). On a directory of 500 YAML files (50 MB), yamark finishes in 133 ms; the next-fastest formatter, deno-fmt, takes 2.6 s.
Same harness, same input, every tool’s own CLI used simply, and the median of 3 measured runs after 1 warmup run. Full tables per input kind - Markdown, YAML, Markdown with front matter, and a directory tree - plus methodology and reproduce commands are on the Benchmarks page.