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: reference.computers.setup.docker-install.md 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.
https://github.com/sagarbehere/dendron-hugo-export/blob/main/export-hierarchy.py
This script
- Looks at all files in the Dendron vault (only top level, not subdirs) whose name ends in
.md - Extracts a filename like
pqr.abc.xyz.mdinto- An
export_fnamexyz.md - A
export_dirpqr/abc/
- An
- If the
export_fnameorexport_dirare part of an exclusion list, they are excluded - Populates an sqlite database table, named
files, with the dotted file namepqr.abc.xyz.mdand its corresponding exported pathpqr/abc/xyz.md - Copies the file from the Dendron vault to the correct folder in exported hierarchy
- moves e.g
foo/bar/baz.mdtofoo/bar/baz/_index.mdiffoo/bar/bazexists - moves
root.mdtocontent/notes/_index.md- And adds
title, cascadedtype, a nav bar menu entry to the frontmatter
- And adds
- Adds a
datefield to each note’s frontmatter- Date matches the
updatedvariable in Dendron frontmatter, if it exists. Else - Date matches the
createdvariable
- Date matches the