Summary
Fern currently handles only text/markdown files, which leaves users without a good way to store/reference non-text files (images, PDFs, diagrams, etc.) alongside their notes. This issue adds a full asset management layer to the vault and closes the gap between Fern and other PKM tools that allow for mixed-media vaults.
Two complementary mechanisms are introduced:
- An internal
vault/assets/folder syncs with the vault and uses vault-relative links that remain stable across machine migrations or sync tools. - Named external asset directories let users map a short
@namespacealias to any local path, so sensitive files or tool-generated output can be referenced in notes without ever entering the vault.
Both types of assets would be viewable in the sidebar and would be able to be opened via the OS' system viewer.
Conditions of Satisfaction
- Config and state integrations
- Asset DB Index
- Files in
assets/are indexed by the DB withkind = 'asset' - DB schema version should be bumped accordingly to auto-rebuilds any existing Vault DBs launch
- Files in
- Sidebar Assets section shows up
- A new
SectionAssetsentry is added to the sidebar section enum
- A new
- Internal
vault/assets/directory is created on vault initinitVault()createsassets/alongside other top-level folders likenotes/,journals/,templates/
- Named external asset directories with
@namespacelink syntax- Users add external dirs via a palette command ("Assets: Add External Directory") using a two-step name + path prompt
- Entries are persisted in
fern.jsonstate (notfern.conf) asasset_dirs: [{name, path}]so they survive restarts and roam with the vault list - Links use
[label](@namespace/file.ext)syntax;handleOpenLinkdetects the@prefix, resolves the full path via the namespace map, and callsopenAssetFile - If the namespace is not configured on the current machine, a descriptive cmdbar error is shown instead of attempting file creation
- Asset link resolution opens files externally rather than in the editor
handleOpenLinkchecks for a file extension first and stats the vault-relative path directly, bypassing the existing.md-only resolver- Resolved internal asset paths call
openAssetFile, which invokesxdg-open(Linux),open(macOS), orrundll32(Windows) - Dead internal asset links not found on disk fall through to a guard in
createAndOpenVaultFilethat shows a cmdbar error instead of creating a.mdfile
- Palette commands to add and link Assets
- "Assets: Add File" - copies a file into
vault/assets/and updates the index; shows cmdbar success - "Assets: Add File and Insert Link" - copies the file and inserts a formatted
[filename](assets/filename.ext)link at the viewer cursor - "Assets: Add File and Copy Link" - copies the file and places the formatted link in the internal yank register with a cmdbar confirmation
- "Assets: Open Asset" - fuzzy-picks from
idx.AssetCompletionsand opens the selected file externally - "Assets: Add External Directory" - two-step input (name, then path);
- calls
cfg.AddAssetDir - validates the name and persists to
fern.json - then refreshes sidebar entries
- calls
- "Assets: Add File" - copies a file into
External Resources
N/A
## Summary
Fern currently handles only text/markdown files, which leaves users without a good way to store/reference non-text files (images, PDFs, diagrams, etc.) alongside their notes. This issue adds a full asset management layer to the vault and closes the gap between Fern and other PKM tools that allow for mixed-media vaults.
Two complementary mechanisms are introduced:
1. An internal `vault/assets/`folder syncs with the vault and uses vault-relative links that remain stable across machine migrations or sync tools.
2. Named external asset directories let users map a short `@namespace` alias to any local path, so sensitive files or tool-generated output can be referenced in notes without ever entering the vault.
Both types of assets would be viewable in the sidebar and would be able to be opened via the OS' system viewer.
# Conditions of Satisfaction
- [x] Config and state integrations
- [x] Asset DB Index
- Files in `assets/` are indexed by the DB with `kind = 'asset'`
- DB schema version should be bumped accordingly to auto-rebuilds any existing Vault DBs launch
- [x] Sidebar Assets section shows up
- A new `SectionAssets` entry is added to the sidebar section enum
- [x] Internal `vault/assets/` directory is created on vault init
- `initVault()` creates `assets/` alongside other top-level folders like `notes/`, `journals/`, `templates/`
- [x] Named external asset directories with `@namespace` link syntax
- Users add external dirs via a palette command ("Assets: Add External Directory") using a two-step name + path prompt
- Entries are persisted in `fern.json` state (not `fern.conf`) as `asset_dirs: [{name, path}]` so they survive restarts and roam with the vault list
- Links use `[label](@namespace/file.ext)` syntax; `handleOpenLink` detects the `@` prefix, resolves the full path via the namespace map, and calls `openAssetFile`
- If the namespace is not configured on the current machine, a descriptive cmdbar error is shown instead of attempting file creation
- [x] Asset link resolution opens files externally rather than in the editor
- `handleOpenLink` checks for a file extension first and stats the vault-relative path directly, bypassing the existing `.md`-only resolver
- Resolved internal asset paths call `openAssetFile`, which invokes `xdg-open` (Linux), `open` (macOS), or `rundll32` (Windows)
- Dead internal asset links not found on disk fall through to a guard in `createAndOpenVaultFile` that shows a cmdbar error instead of creating a `.md` file
- [x] Palette commands to add and link Assets
- "Assets: Add File" - copies a file into `vault/assets/` and updates the index; shows cmdbar success
- "Assets: Add File and Insert Link" - copies the file and inserts a formatted `[filename](assets/filename.ext)` link at the viewer cursor
- "Assets: Add File and Copy Link" - copies the file and places the formatted link in the internal yank register with a cmdbar confirmation
- "Assets: Open Asset" - fuzzy-picks from `idx.AssetCompletions` and opens the selected file externally
- "Assets: Add External Directory" - two-step input (name, then path);
- calls `cfg.AddAssetDir`
- validates the name and persists to `fern.json`
- then refreshes sidebar entries
## External Resources
N/A