The notes in Dendron are stored in a so-called “vault” in a flat structure with “dotted” filenames that represent the hierarchy of the note. An example file name would be: with the hierarchy being self-evident in the naming scheme. Each note is in MarkDown for the most part, with some Dendron-specific syntax thrown in for features like wikilinks, transclusion etc.

This script

  • Looks at all files in the Dendron vault (only top level, not subdirs) whose name ends in .md
  • Extracts a filename like into
    • An export_fname
    • A export_dir pqr/abc/
  • If the export_fname or export_dir are part of an exclusion list, they are excluded
  • Populates an sqlite database table, named files, with the dotted file name and its corresponding exported path pqr/abc/
  • Copies the file from the Dendron vault to the correct folder in exported hierarchy
  • moves e.g foo/bar/ to foo/bar/baz/ if foo/bar/baz exists
  • moves to content/notes/
    • And adds title, cascaded type, a nav bar menu entry to the frontmatter
  • Adds a date field to each note’s frontmatter
    • Date matches the updated variable in Dendron frontmatter, if it exists. Else
    • Date matches the created variable