Skip to content

Add auto-export of .note files to markdown/images - #106

Draft
philips wants to merge 1 commit into
mainfrom
worktree-auto-export-issue-41
Draft

Add auto-export of .note files to markdown/images#106
philips wants to merge 1 commit into
mainfrom
worktree-auto-export-issue-41

Conversation

@philips

@philips philips commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds an opt-in auto-export feature (settings: Enable auto-export, Watched folders, Auto-export output, Auto-export output folder) that watches configured vault folders and auto-generates/updates a companion markdown file (and optionally images) whenever a .note file appears or changes there - the workflow requested in Enhancement: Auto-export images/markdown to vault #41 (e.g. a folder synced from a Supernote via OneDrive/Dropbox/a symlink).
  • Tracks each .note's content via a sha1 digest stored in the generated file's frontmatter (supernote-source-digest) to detect real changes across devices without relying on mtimes, addressing the reliability concern raised in the issue thread.
  • supernote-overwrite: false frontmatter lets a user opt a specific generated file out of future auto-regeneration (e.g. after hand-editing it).
  • .note file renames patch the companion file's supernote-source-path frontmatter (and relocate it if needed) instead of orphaning the reference. Deleting a .note intentionally leaves previously generated files in place.
  • create/modify listeners are registered unconditionally (to catch the startup replay of files that synced in while Obsidian was closed) but only enqueue a reference; the actual conversion work is deferred until after workspace.onLayoutReady() and processed one file at a time, so this never blocks Obsidian's own startup - addressing the original concern that a prior version of this feature scanned/blocked on load.

Closes #41.

Test plan

  • npx tsc -noEmit -skipLibCheck passes
  • npx eslint . - no new errors (pre-existing warnings only)
  • npx vitest run - 37 tests pass, including new src/autoExport.test.ts covering digest determinism, folder-scope matching, and the create/noop/regenerate/skip decision matrix
  • npm run build succeeds
  • Manual test in a real vault (not done in this environment - no Obsidian instance available)

Watches a configurable set of vault folders and, for each .note file
that appears or changes there, creates or updates a deterministic
companion markdown file (and optionally images) - no manual "attach
to vault" click required. Off by default, and no folder is watched
until the user adds one, so enabling it doesn't churn through every
.note already in the vault.

- supernote-source-digest frontmatter (sha1 of the .note bytes)
  detects real changes across devices/sync tools without relying on
  mtimes, and supernote-overwrite: false lets a user opt a specific
  file out of future auto-regeneration after hand-editing it.
- .note create/modify listeners are registered unconditionally (to
  catch files that synced in while Obsidian was closed, via
  Obsidian's startup replay of 'create' events) but only enqueue -
  actual conversion work is deferred until after
  workspace.onLayoutReady() and processed one file at a time, so
  Obsidian's own startup is never blocked.
- .note renames patch the companion file's supernote-source-path
  frontmatter (and relocate it if the deterministic target path
  changed) instead of orphaning the reference; deleting a .note
  intentionally leaves generated files in place.
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.

Enhancement: Auto-export images/markdown to vault

1 participant