A focused YAML editing mode for Obsidian — not just syntax highlighting, but a tool that knows it's editing YAML and behaves accordingly. It gives you schema-aware completions, structural indentation, folding, a snippet palette, and a dedicated editor for standalone YAML files, all without reformatting your text.
It works in three places:
--- block at the top of a note.```yaml or ```yml..yaml / .yml files — opened directly in their own editor (Obsidian normally hides these).Design intent and the full specification live in SPEC.md. The guiding principle is round-trip preservation: the plugin never reorders your keys, strips your comments, or reformats your whitespace behind your back.
As you type a key inside a YAML region, autocomplete suggests:
.yaml/.yml file) and learns which keys tend to appear where. Suggestions are ranked by how often they occur, and annotated with the value types observed (e.g. string, date) and example values.The suggestion list is path-aware: at the top level of your frontmatter you'll see top-level keys; nested under dataview: you'll see the keys other notes nest there. Keys already present at the current level are filtered out.
You can also point the plugin at explicit JSON Schemas for stronger, authoritative suggestions — see Explicit schemas below.
Two ways to insert structured YAML quickly:
Tab through — e.g. tags:, aliases:, created: <today>, a Dataview field stub, or a list / map / list of maps skeleton. Date placeholders (${TODAY}, ${NOW}) are filled in automatically.tags, aliases, cssclasses, publish, …), Dataview stubs, shape templates, anchors/aliases, and any snippets you've defined in settings.You can add your own snippets in the plugin's settings tab (id, label, hint, and a body using ${1:placeholder} tab stops and ${TODAY}/${NOW} dates).
- ), indents one level after a block-opening key:, and otherwise keeps the current indent for a sibling. Outside YAML regions, Enter behaves normally.The YAML: Toggle quotes on value command quotes or unquotes the value on the current line, choosing minimal correct quoting. It only quotes when leaving the value bare would actually change how YAML parses it (a : that looks like a mapping, a leading indicator character, surrounding whitespace, or a reserved word like true/no/null). Values that are safe bare — including URLs like http://example.com — are left alone. Quoting is an explicit command rather than something that fires while you type, so it never surprises you mid-edit.
Cmd/Ctrl+Shift+A in the editor) — adds an &anchor to the value on the current line.Cmd/Ctrl+Shift+R) — inserts an *alias reference.frontmatter › project › milestones[2] › title, updating as you move the cursor.dataview.project). Matching respects nesting, so a.b only finds a b: that's actually a child of a:.Parse errors are surfaced quietly: an underline on the offending text plus a marker in the lint gutter, with the parser's message on hover. The plugin reports genuine parse errors only — it is not a style linter and won't nag you about formatting.
.yaml / .yml filesObsidian normally hides non-Markdown files. With this plugin enabled, .yaml and .yml files appear in the file explorer and open in a dedicated editor that brings along everything above — completions, smart Enter/Tab, folding, diagnostics, the breadcrumb, and anchor shortcuts — plus line numbers and syntax highlighting. The whole file is treated as YAML.
The Insert frontmatter command adds a --- block to the top of a note that doesn't have one, and drops your cursor inside it.
All commands are in the command palette and can be assigned hotkeys via Settings → Hotkeys.
| Command | What it does |
|---|---|
| Insert frontmatter | Add a --- block at the top of the note |
| YAML: Insert element here… | Open the Schema Palette at the cursor's path |
| YAML: Toggle quotes on value | Quote / unquote the current line's value |
| YAML: Toggle list/scalar | Wrap the current value as an inline list (x → [x]), or strip a trailing empty [] |
| YAML: Go to key… | Jump to a key by dotted path |
| YAML: Add anchor | Add an &anchor to the current value |
| YAML: Reference anchor | Insert an *alias reference |
| YAML: Format YAML region | Normalize indentation to 2-space multiples (no other reformatting) |
| YAML: Reload schemas | Re-read JSON Schema files from the schema directory |
Apart from Insert frontmatter (Markdown-only) and Reload schemas (global), these commands work in both Markdown notes and standalone .yaml/.yml files, and appear only when the cursor is inside a YAML region.
The following work as built-in keybindings whenever the cursor is inside a YAML region (including standalone YAML files):
| Key | Action |
|---|---|
Enter |
Structure-aware newline + indent |
Tab / Shift+Tab |
Indent / outdent by 2 spaces |
Cmd/Ctrl+Shift+D |
Insert today's date (YYYY-MM-DD) |
Cmd/Ctrl+Shift+A |
Add an anchor on the current value |
Cmd/Ctrl+Shift+R |
Insert an alias reference |
.obsidian/yaml-schemas/.Suggestions come from two sources that work together: an always-on inferred schema, and optional explicit JSON Schemas you provide.
There's nothing to set up. The plugin builds a probabilistic schema by watching your vault: for every key path it sees — across note frontmatter, yaml code blocks, and standalone .yaml/.yml files — it records the value types, a few example values, and how often the path occurs. This updates incrementally as you create, edit, rename, and delete files. The more consistently you use a field across your notes, the better the suggestions get. Vaults are messy, so these are ranked by frequency, not enforced as rules.
For fields you want to standardize, drop a JSON Schema file into the schema directory (default .obsidian/yaml-schemas/, configurable in settings). Then opt a note or file into it:
_schema: book```yaml code block, a comment: # yaml-schema: bookbook is either the schema file's name (book.json) or its $id. Once opted in:
properties at your current path, ranked above inferred suggestions and annotated with type, required status, and the field's description.enum values defined for the field you're editing.Nested objects, array items, and local $refs (#/$defs/..., #/definitions/...) are followed. Remote $refs and full validation are out of scope. After editing schema files, run YAML: Reload schemas (they're also loaded on startup and when you change the schema directory).
A minimal example — .obsidian/yaml-schemas/book.json:
{
"type": "object",
"required": ["title"],
"properties": {
"title": { "type": "string", "description": "Book title" },
"status": { "enum": ["unread", "reading", "finished"] },
"rating": { "type": "integer" }
}
}
---
_schema: book
title: |
status: # completion offers unread / reading / finished
---
This plugin isn't in the community store yet, so install it manually.
From a release build: copy main.js, manifest.json, and styles.css into <your vault>/.obsidian/plugins/yaml-editor/, then enable YAML Editor under Settings → Community plugins.
For development (symlink the repo into your vault):
ln -s /path/to/obsidian-yaml-editor <your vault>/.obsidian/plugins/yaml-editor
The symlink (or folder) must be named yaml-editor to match the plugin id. Then:
npm install
npm run dev # esbuild watch — rebuilds main.js on change
Obsidian has no hot reload, so after a rebuild, reload the plugin (toggle it off/on, or run "Reload app without saving"). For a one-off production build, use npm run build.
Requires Obsidian 1.5.0+. Works on desktop and mobile (the status-bar breadcrumb is desktop-only, as Obsidian mobile has no status bar).
See SPEC.md for the complete design rationale and non-goals.
If this plugin saves you time or makes your YAML editing more pleasant, consider buying me a coffee ☕
Your support helps cover development time, testing across platforms, and keeping the plugin maintained.
MIT