This example reads notes from a host folder and presents another view of them
under mount/Notes. A note mentioning #work appears in Tags/work; notes
without tags appear in Untagged. A note can appear under several tags without
being copied or moved on disk.
Use Node.js 22 or newer, pnpm 12.4 or newer within version 12, Rust, GNU Make, and a working Podman runtime. See the host requirements. Run these commands from the repository root in a macOS or Linux shell:
pnpm install --frozen-lockfile
make example EXAMPLE=notesThe command builds ScriptFS and mounts the example, building the runtime image on first use. Leave it running and open a second terminal at the repository root.
cat examples/notes/mount/Notes/index.md
ls examples/notes/mount/Notes/Tags
ls examples/notes/mount/Notes/Tags/work
cat 'examples/notes/mount/Notes/Tags/work/projects - plan.md'
cat examples/notes/mount/Notes/Untagged/journal.mdThe sample notes produce the tags errands, home, ideas, and work.
projects/plan.md appears as projects - plan.md in a tag directory: the module
flattens subfolder names so you can browse all notes for a tag in one place.
journal.md has no tags and appears under Untagged.
Compare a generated note with its original in sample-notes. Both contain the same text. The index and tag directories are generated by the module; they do not exist in the notes folder.
The mounted view and the bound notes folder are read-only inside the container. Make changes in the host folder:
printf '# Reading list\n\nRead about filesystems. #learning #work\n' \
> examples/notes/sample-notes/reading-list.mdThe module caches its scan for two seconds. After that cache expires, browse the new tag and read the note:
cat examples/notes/mount/Notes/Tags/learning/reading-list.md
cat examples/notes/mount/Notes/index.mdThe same note is also available under Tags/work. Remove the tutorial note
from sample-notes when you are done:
rm examples/notes/sample-notes/reading-list.mdIts generated entries disappear after the next scan.
In config.json, change modules.notes.paths.notes from
"./sample-notes" to your notes directory and restart ScriptFS. Relative paths
are resolved from this example directory. Removing the binding uses the
manifest's default ~/Notes. To show your originals at the mount's root too,
also change filesystems[0].source to that folder.
By default, the module includes .md and .txt files. To include only Markdown,
merge this settings object into modules.notes:
{
"settings": { "extensions": [".md"] }
}The manifest declares a read-only notes host path at /notes in the container.
module/index.mjs uses this.path("notes") to scan it, then
builds the view with TreeModule. The Notes/** rule is opaque, so that subtree
comes from the module. source: "./sample-notes" also exposes the original notes
at the mount's root, alongside the generated Notes view.
Press Ctrl+C in the ScriptFS terminal to unmount. From the repository root:
make test-examplesThe notes tests supply temporary notes and check tag grouping, subfolder names, read-only behavior, and changes picked up after the scan cache expires.