frontmatter

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

fm: Markdown frontmatter batch editor

CI Release License Go Reference Go Report Card

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.

Compared to other tools

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.

Documentation

Overview

Package frontmatter is the public library API for fm. It re-exports the types and functions that downstream Go applications need to parse, run, and inspect frontmatter queries against Markdown files.

Index

Constants

This section is empty.

Variables

View Source
var (
	ParseProgram = internal.ParseProgram
	ParseQuery   = internal.ParseQuery
	ReadDocument = internal.ReadDocument
	Write        = internal.Write
	ExpandGlobs  = internal.ExpandGlobs
	NewOutput    = internal.NewOutput
	PrintTable   = internal.PrintTable
)

Functions

This section is empty.

Types

type AlterQuery

type AlterQuery = internal.AlterQuery

type Document

type Document = internal.Document

type ExecOptions

type ExecOptions = internal.ExecOptions

type FilePath

type FilePath = internal.FilePath

type FrontMatter

type FrontMatter = internal.FrontMatter

type Output

type Output = internal.Output

type Program

type Program = internal.Program

type Query

type Query = internal.Query

type SelectQuery

type SelectQuery = internal.SelectQuery

type Table

type Table = internal.Table

type TableRow

type TableRow = internal.TableRow

type UpdateQuery

type UpdateQuery = internal.UpdateQuery

Directories

Path Synopsis
cmd
fm command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL