Skip to content

Importing notes

One file

1
2
3
notecast add notes/kubernetes.md
notecast add notes/kubernetes.md --title "K8s basics"   # override the title
notecast add notes/kubernetes.md --process              # then process all pending notes

A folder

add-batch walks a directory recursively and imports every file with a matching extension (.md and .txt by default):

1
2
3
4
notecast add-batch ~/notes
notecast add-batch ~/notes --ext .md,.org
notecast add-batch ~/notes -x SUMMARY.md -x 'drafts/*' -x '**/README.md'
notecast add-batch ~/notes --dry-run

-x / --exclude takes a glob and can be repeated. Each pattern is matched against the path relative to the folder and against the bare file name, with shell-style rules where * also matches /.

Titles

A note's title is, in order:

  1. the first # Heading in the first 2 KB of the file;
  2. for a generic file name (index, readme, overview, summary, introduction, intro), the folder path relative to the imported directory, such as observability/alerting;
  3. the file name without its extension.

Re-importing

Every note remembers the absolute path it came from, so importing the same files again is safe:

The file is… notecast…
new adds a note (pending)
unchanged skips it
changed (content or title) updates the note, clears its summary, keywords, embedding and themes, and sets it back to pending

add-batch reports the three counts:

1
added 2, updated 1, unchanged 37 note(s), skipped 3

Files deleted from disk are not deleted from notecast; remove their notes with notecast delete.