by tommyhedgerow
Publish a finished note and every file it embeds into a second vault, mirroring the folder structure.
Lesson Publisher
Publish the note you are working on, and every file it embeds, into a second Obsidian vault. The folder structure is mirrored, so a note that finds an image by name in your working vault finds it in the library too. The plugin is desktop only, because it writes with Node's filesystem modules.
What it does
Lesson Publisher runs in the vault you write in and writes into a second vault, called the library below. You give the plugin the library's folder path in its settings, and nothing is published until you do.
The rule is a mirror. A note's path relative to the mirror root, Learn by default, is recreated inside the library, and every file the note embeds comes along to the same relative position. Obsidian resolves an embed by name when the exact path fails, so keeping the relative positions is what makes the published note stand on its own.
Anything outside the mirror root lands in a fallback folder inside the mirror root: notes in Inbox, embedded files in Attachments, both configurable. A folder overrides map can send a folder or a whole subtree somewhere else, and it is checked before the mirror root.
Embeds are found in both forms, ![[diagram.svg]] and , including the angle-bracket form for paths with spaces. Remote and data: URLs are left alone. Embeds of other notes, ![[Some Note]], are published only by the "with linked notes" command, and only when the linked note's frontmatter status is one of the values listed in settings. A linked note with no status is skipped. The note you run the command on is published as it is; the status filter applies to the notes it links to.
Before anything is written, the destination files that already exist are listed in a confirmation dialog, and cancelling writes nothing. If two planned files would land on the same path, only the first is kept. Writes go to the library through Node's fs module, so the library folder is written to directly rather than through Obsidian. A summary notice then reports how many files were published, how many linked notes were skipped by status, and how many embeds were not found.
If a write fails, publishing stops, the error is shown in a notice, and the files already written stay where they are.
Install
Lesson Publisher is not in the community directory yet. Submission is pending, so the manual path is the one that works today. It is desktop only.
Manual install:
- Download
main.jsandmanifest.jsonfrom the latest release at https://github.com/tommyhedgerow/obsidian-lesson-publisher/releases. This repository has nostyles.css. - Put both files in
<Vault>/.obsidian/plugins/lesson-publisher/.
<Vault>/.obsidian/plugins/lesson-publisher/
main.js
manifest.json
- Reload Obsidian, then enable Lesson Publisher in Settings → Community plugins.
Once the listing is live, the plugin can be installed from Settings → Community plugins → Browse, by searching for "Lesson Publisher".
Usage
There is a ribbon icon and three commands:
- Publish active note publishes the active note and the files it embeds.
- Publish active note and its finished linked notes does the same, and brings embedded notes whose status is publishable.
- Show what publishing this note would copy opens the plan and writes nothing.
Settings
All settings live in one tab, Lesson Publisher.
- Library vault path. The absolute path to the library vault on this machine, for example
/Users/you/Documents/SecondVault. This is a local filesystem path, not a vault name. The plugin writes into it with Node'sfs, so it must be a path this machine can write to. Publishing does nothing until it is set. - Mirror root. The folder whose relative paths are preserved inside the library. Default
Learn. - Fallback folder. Where notes from outside the mirror root land inside the library. Default
Inbox. - Asset fallback folder. Where embedded files from outside the mirror root land. Default
Attachments. - Copy embedded files. On by default. Turn it off to publish the note alone.
- Stamp the source note. On by default. Records
publishedandpublished_toin the note you published from. - Stamp the published copy. On by default. Records
source_vaultand the publish date in the library copy. - Linked notes included. Comma-separated frontmatter statuses that the "with linked notes" command will publish. Default
done, established. - Folder overrides. An optional JSON map, for example
{"Learn/Concepts": "Knowledge/Concepts"}, which sends a folder or a subtree somewhere else in the library.
Disclosures
- Desktop only. The plugin uses Node's
fsandpathmodules and cannot run on mobile. - Files outside the vault: yes, and this is the whole point of the plugin. It reads the notes and attachments you publish, and writes them into the second folder you configure in settings. The library vault path is a local filesystem path, so a wrong path writes files somewhere else on disk. No other part of the filesystem is read or written.
- Editing your notes: the note you publish is copied, and with "Stamp the source note" on, its frontmatter is also edited in place. The library copy gets
source_vaultandpublishedwhen "Stamp the published copy" is on. - Network use: none.
- Data stored: the settings above, in the plugin's
data.json. - Accounts and payments: none.
- Ads: none.
- Telemetry: none.
Licence
MIT. See LICENSE.
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.