date-prefix and sticky tail v0.6 for Obsidian v1.12.7 and v1.13.0 (min v1.0.0)
Some checks failed
Zettelclean CI / build (20.x) (push) Has been cancelled
Zettelclean CI / build (22.x) (push) Has been cancelled
Zettelclean CI / build (24.x) (push) Has been cancelled
Release Zettelclean / build (push) Has been cancelled

This commit is contained in:
2026-07-30 18:16:52 -03:00
parent 35cb6dd976
commit adcb9e5d88
9 changed files with 232 additions and 23 deletions

View File

@@ -37,16 +37,23 @@ slug tail follows. Nothing else is touched.
## How it works
- A note is a zettel when its filename starts with a **TIMEID**: a run of 12 to 18 digits
(a timestamp) followed by any non-digit or the end of the name - so `20260728145404-my-note.md`,
`202607281454.md`, and even `202607281454 my note.md` all qualify. Files without that prefix
are ignored, so plain notes, daily notes, Excalidraw and Kanban files are never renamed.
- The TIMEID is minted **once** and never changes. Only the slug tail is regenerated.
- A note is a zettel when its filename starts with a recognized **prefix**: a **TIMEID** (a run
of 12 to 18 digits) always, and a **`yyyy-mm-dd` date** too if you enable date mode in settings.
The prefix is followed by any non-digit or the end of the name - so `20260728145404-my-note.md`,
`202607281454.md`, `202607281454 my note.md`, and (date mode) `2026-07-30 Journal.md` all
qualify. Files without a recognized prefix are ignored, so plain notes, Excalidraw and Kanban
files are never renamed.
- The prefix is fixed and never changes; only the slug tail is regenerated.
- When you edit the H1, zettelclean waits about 4 seconds of idle, then renames the file to
`TIMEID-slug(H1).md` using Obsidian's own rename (so backlinks are updated). A 6 second
`prefix-slug(H1).md` using Obsidian's own rename (so backlinks are updated). A 6 second
cooldown prevents a just-renamed file from being renamed again.
- Sync is strictly one-way, H1 to filename. Renaming a file by hand is never fought.
- Delete the H1 and the filename collapses back to the bare `TIMEID.md`.
- **Sticky tail:** the tail follows the H1 when it produces a slug; with no H1 the existing tail
is kept and cleaned. The tail is never deleted - delete the H1 and the filename keeps its last
slug. A note that never had a title stays bare (`TIMEID.md`); one with no usable title (empty
H1 and no sluggable tail) is left untouched.
- If a rename would collide with an existing filename, zettelclean keeps the current name and
shows a notice.
The slug is case-preserving, ASCII, dash-separated: accents are folded (`Ciências` becomes
`Ciencias`), runs of punctuation and whitespace collapse to a single dash, and leading and
@@ -71,6 +78,12 @@ Notes created before you adopted this workflow have no TIMEID. Right-click such
file explorer and choose **"Prefix timestamp to filename"**. It mints a fresh timestamp,
prepends it, and the note is now a zettel that syncs on future H1 edits.
### Date-prefixed notes (journaling)
Turn on **date mode** in settings to also treat `yyyy-mm-dd`-prefixed notes as zettels. A daily
note `2026-07-30.md` gains a slug once you title it (`# Gratitude` -> `2026-07-30-Gratitude.md`),
and `2026-07-30 Morning pages.md` is cleaned to `2026-07-30-Morning-pages.md`.
## Slugging a folder name
Right-click a folder and choose **"Slug folder name"** to ASCII-clean it in place (this folder
@@ -92,8 +105,12 @@ That reads the first H1 directly and falls back to the filename when there is no
## Settings
None. Zettelclean is zero-config in this version. The 4 second settle and 6 second cooldown
are fixed.
One setting: **Recognized filename prefixes** (Settings -> Community plugins -> Zettelclean).
- **Timestamp only** (default) - only 12-18 digit TIMEID prefixes.
- **Timestamp and date** - also `yyyy-mm-dd` prefixes, for journaling.
The 4 second settle and 6 second cooldown are fixed.
## Development