Files
fflow/README.md
T

52 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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`.
## 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 **FFLOW: <name>: next step** / **previous step** commands for hotkeys; **Loop** wraps around at the ends.
- **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.
### 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:
1. sets the flow's property;
2. 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);
3. 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](https://momentjs.com/docs/#/displaying/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](ROADMAP.md) for planned features.