Obsidian vaults

Published

February 13, 2025

You can construct a Vault from a directory in your file system. We’ve predefined a variable named root to point to the base directory of this repository, and will use a sample Obsidian vault in the repository’s test/data directory.

using Obsidian
vaultdir = joinpath(root, "test", "data", "presidents-vault")
v = Vault(vaultdir)
v isa Vault
true

Wikinames and files

Obsidian identifies notes by the name of their plain-text files, minus any extension. We refer to this as its wikiname, since this reference can be used as a link anywhere in the vault without knowledge of the note’s location in the vault.

To find the names Obsidian uses for all notes in a vault, use the wikinames function:

notenames = wikinames(v)
12-element Vector{String}:
 "Abraham Lincoln"
 "Abraham Lincoln 1860 census"
 "Custis"
 "Dandridge"
 "George Washington"
 "Lincoln"
 "Martha Washington"
 "Springfield, Sangamon, Illinois"
 "View geography"
 "Washington"
 "overview"
 "yamltest"

If you need to find the location of the note in your file system, you can use the path function:

path(v, notenames[1])
"/Users/nsmith/Desktop/family-site/Obsidian.jl/test/data/presidents-vault/people/Abraham Lincoln.md"

Tags

Find all tags labelling the page “Abraham Lincoln”:

tags(v, "Abraham Lincoln")
2-element Vector{String}:
 "#assassinated"
 "#president"

Find all pages tagged #president:

tagged(v, "#president")
2-element Vector{String}:
 "Abraham Lincoln"
 "George Washington"