Skip to content

Prototype: optional YAML front matter on generated markdown (#57) - #182

Draft
philips-clanker wants to merge 1 commit into
mainfrom
frontmatter-issue-57
Draft

Prototype: optional YAML front matter on generated markdown (#57)#182
philips-clanker wants to merge 1 commit into
mainfrom
frontmatter-issue-57

Conversation

@philips-clanker

Copy link
Copy Markdown
Collaborator

Summary

Prototype for #57 ("Adding YAML"): adds an opt-in setting, "Add YAML front matter to Markdown files" (off by default), that prefixes generated notes with a small, fixed set of front matter properties:

---
tags:
  - supernote
source: "[[Meeting notes.note]]"
device: "A5X2"
pages: 3
keywords:
  - "budget"
  - "Q3 plan"
---
  • tags: [supernote] — lets a vault filter/query every Supernote-imported note (e.g. tag:#supernote or a Dataview FROM #supernote).
  • source — a link back to the original .note/.spd file as a property (not just the existing body-text link), so it's usable in Obsidian's property search ([source]) and in Dataview/Bases link queries.
  • device — the capturing device model (SupernoteX.header.APPLY_EQUIPMENT), omitted when the device didn't record one.
  • pages — page count, useful for sorting/filtering long vs. short notes.
  • keywords — the device's own "starred" keywords, deduplicated across all pages, omitted when there are none.

Serialization is hand-rolled (src/frontmatter.ts, no new dependency) using JSON.stringify for double-quoted YAML scalars, which safely escapes colons/quotes in note titles or keywords without needing a YAML library.

Kept intentionally small for a first pass — no template/Templater integration, no custom per-vault property mapping, no created/modified dates (the .note format doesn't carry a real creation timestamp; TFile.stat.ctime would just be vault-import time, which felt more misleading than useful to include by default). Posted a comment on #57 with the fuller brainstorm of what else front matter could carry, for discussion before committing to a fixed schema.

Test plan

  • npx vitest run — all existing tests plus new src/frontmatter.test.ts pass
  • npx tsc --noEmit — clean
  • npm run lint — clean (no new warnings)
  • npm run build — builds cleanly
  • Manual check in an actual Obsidian vault (not done in this environment)

Prototype for #57: a new "Add YAML front matter to Markdown files"
setting (default off) prefixes generated notes with tags, a source
link, device model, page count, and keywords, making imported notes
filterable via Obsidian's property search, Dataview, and Bases.
@philips-clanker philips-clanker mentioned this pull request Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant