fm: Markdown frontmatter batch editor

Status: Alpha — single-maintainer project, breaking changes possible until v1.0.
Harmonize, refactor, and batch edit YAML frontmatter using SQL expressions.
Tailormade for Obsidian
fm is designed for Markdown in general and Obsidian in particular.
Vaults are modelled as big jagged tables where documents are rows and fields are columns.
SQL is the de facto standard data manipulation language for tabular data.
jq, yq and
dasel are great for deeply nested complex data,
but their syntax is hard and Obsidian frontmatter is not nested anyways.
So let's keep it simple!
Installation
⚠️ 👉 Note: I recommend only using fm on Vaults under version control or backup,
in case you mess up. Like most terminal commands, it's got no undo feature.
Homebrew (macOS / Linux)
brew install nofuss-io/tap/fm
go install
go install github.com/nofuss-io/frontmatter/cmd/fm@latest
Prebuilt binaries
Download the archive for your platform from the
Releases page, extract,
and place the fm binary on your PATH.
From source
Requirements: Git, Go, and Just:
git clone https://github.com/NoFuss-io/frontmatter.git
cd frontmatter
just install
just install-skill
In a nutshell
fm \
SELECT [expression], ... \
FROM [files] \
WHERE [condition] \
SORT BY [expression], ... \
LIMIT [number]
fm UPDATE [files] SET [assignment], ... WHERE [condition];
fm ALTER [files] DROP [field], ... WHERE [condition];
fm ALTER [files] RENAME [field] TO [field], ... WHERE [condition];
For example:
fm select vegan, vegetarian from recipes/*
filename vegan vegetarian
-------- ----- ----------
Amaretto-grädde.md false true
Apelsinkaka.md
Apfelstrudel.md
Baba ganoush.md true
Bacon Jam.md
Baconlindad fläskfilé med örter och senapssås.md
Banan- och havrecookies.md true
Basilikakyckling.md
Bechamelsås.md false true
Belugabolognese.md true
Syntax
SQL syntax follows BigQuery dialect but implements only a subset of it (see manual).
Notably missing:
- Functions (in the roadmap)
- Joins
- Aggregations
- Window functions
Notable additions
Shorthand type checking and casting
Only return documents with a property of a given type:
fm 'select * from recipes/* where `Prep time`:int'
fm 'select * from recipes/* where `Prep time` and not `Prep time`:int'
Cast field to type:
fm 'update recipes/* set `Prep time`:int where `Prep time`'
Read more.
| Tool |
Scope |
Multi-file globs |
Type-aware mutations |
Obsidian wikilinks |
fm |
Markdown frontmatter, SQL DSL |
✅ |
✅ |
✅ |
yq |
Any YAML, jq-style expressions |
manual loop |
partial |
❌ |
dasel |
Multi-format (yaml/json/toml) |
manual loop |
partial |
❌ |
awk / sed |
Line-oriented text |
✅ |
❌ |
❌ |
fm trades generality for ergonomics in one workflow: querying and mutating
YAML frontmatter across many Markdown files at once, with a syntax that reads
like SQL and round-trips Obsidian-specific link types.
Roadmap
- Functions in expressions.
- See open Issues for
what's being kicked around.
Contributing
Open an issue before sending a PR.
See CONTRIBUTING.md for details.
Contributions are most welcome and I do my best to respond quickly.