4.3 KiB
FFLOW — Frontmatter Flow
Set frontmatter properties from the editor with trigger symbols, the way # autocompletes tags.
Type &mee, pick meeting: the text &mee disappears and the note gets type: meeting.
The top of the popup says what the pick will do: Set a property that is empty, Replace its current value (shown), or Add to a list.
Flows
Everything is a flow (Settings → FFLOW). A flow has:
- Name: labels its hotkey commands.
- Symbol (optional): one character that is not a letter, digit or space.
# [ / :are reserved (tags, links, slash commands, emoji). It fires only at the start of a word (line start or after a space), never inside frontmatter or code. - Property: the frontmatter key the flow sets.
- Kind:
- Ordered list: fixed steps, in order. Each step can also set other properties (Also sets). Gets next/previous step commands for hotkeys (see below); Loop wraps around at the ends. Also the way to offer a fixed list of values: only the listed values are proposed.
- Open (vault): suggests every value already used for the property in the vault, ranked by use, and accepts new values. Single value replaces, List appends without duplicates. No steps, no hotkeys.
- Only on notes where (optional): a property and comma-separated values, e.g.
type=highlight, source. The flow runs only on notes whose property holds one of the values (case-insensitive; for a list property, any item). Leave the values empty to match any note where the property is set.
Several flows on one symbol
Flows can share a symbol when they have conditions. On a given note, the first flow whose condition matches runs; a flow without a condition runs when none matches. Example:
| Symbol | Flow | Only on notes where | Property |
|---|---|---|---|
@ |
Author | type = highlight, source |
author |
@ |
Participants | type = meeting |
participants (list) |
! |
Project status | type = project |
status: inactive → active → done |
! |
Client status | type = business |
status: active → inactive |
On a note that matches none of them, ! and @ do nothing. The condition is read from the note as typed, so &project then ! works right away. A flow that can never run (an earlier flow with the same symbol covers the same notes) is flagged in the settings.
Every ordered flow gets FFLOW: : next step / previous step, available only on notes its condition matches. Command ids derive from the flow id, so hotkeys and toolbar buttons (e.g. Note Toolbar) survive renames. Ordered flows sharing a symbol also get a shared pair, FFLOW: ! Project status / Client status: next step / previous step, that moves whichever flow matches the note: one hotkey for every status.
Step effects
Example, flow status:
| Step | Also sets |
|---|---|
| todo | cssclasses: st-todo |
| started | cssclasses: st-started, priority: high |
| done | cssclasses: st-done, archived: true |
Picking a step, by symbol or by hotkey:
- sets the flow's property;
- undoes the other steps' effects: their items are removed from list properties, and scalar properties are removed only if they still hold the value the flow wrote (a value you edited by hand is kept);
- applies the step's effects.
List properties (cssclasses, tags, aliases, any property Obsidian types as a list, or one that already holds a list) take comma-separated items and are merged with what's there. Other properties are replaced; true/false and plain numbers are written typed.
Date and time, as in Obsidian's core Templates: {{date}} (YYYY-MM-DD), {{time}} (HH:mm), or any moment.js format with {{date:DD/MM/YYYY}}, {{time:HH:mm:ss}}, {{date:YYYY-MM-DD[T]HH:mm}}. Tokens can sit inside text (done on {{date}}). Leaving the step removes the value only if it still matches the template, i.e. a date the flow wrote.
A note without a value, or with a value outside the flow, enters at the first step. Properties change only through FFLOW, not when edited by hand.
Development
npm install
npm run build
Copy main.js, manifest.json and styles.css to <vault>/.obsidian/plugins/fflow/.
Settings from 0.1–0.2 (separate triggers and flows) are converted to flows on first load.
See ROADMAP.md for planned features.