Updated: November 19, 2026
- Overview
- Data model
- Pipeline components
- Triggers
- Vault sync
- Derived content generation
- Full cache rebuild
- Markdown pipeline stages
- Preview math delimiter rules
- Completion signals
Notebook Navigator maintains a local file cache in IndexedDB and mirrors it into an in-memory cache for synchronous reads during rendering.
The pipeline has three layers:
- Vault sync: keep a
FileDatarecord for each indexable file path up to date with the vault state. - Derived content: generate tags, frontmatter metadata, preview text, word/character counts, task counters, property pills, and feature images using background content providers.
- Tree indexing: build tag and property trees from cached markdown metadata for navigation and selection.
The cache includes:
- File mtimes plus provider-specific processed mtimes
- Tags, frontmatter-derived metadata, word/character counts, task counters, property pills
- Status fields for preview text and feature images, and stable source keys for feature images
- Preview text and feature image blobs stored in dedicated stores (status/key fields live in the main record)
Notebook Navigator indexes markdown notes, PDFs and SVG files allowed by the active file visibility setting, and
supported non-markdown drawing source files through getIndexableFiles() in src/context/storage/useStorageFileQueries.ts,
backed by getFilteredIndexableFiles(..., { showHiddenItems: true }) in src/utils/fileFilters.ts.
Each indexed file path has a FileData record (src/storage/indexeddb/fileData.ts, re-exported through
src/storage/IndexedDBStorage.ts) containing:
mtime: last observed vault mtime for the file- Provider processed mtimes:
markdownPipelineMtimetagsMtimemetadataMtimefileThumbnailsMtime
- Provider outputs:
tags: extracted tags (nulluntil extracted; markdown only)metadata: extracted frontmatter metadata and hidden state (nulluntil extracted; markdown only)wordCount: word count (nulluntil generated; markdown only)characterCountWithSpaces/characterCountWithoutSpaces: character counts (nulluntil generated; markdown only)taskTotal/taskUnfinished: task counters (nulluntil generated; markdown only)properties: supported scalar frontmatter values used by property search, trees, and pills (nulluntil generated; markdown only)
Defaults are set by createDefaultFileData() (src/storage/indexeddb/fileData.ts, re-exported through
src/storage/IndexedDBStorage.ts):
- Markdown:
tags=null,metadata=null,wordCount=null,characterCountWithSpaces=null,characterCountWithoutSpaces=null,taskTotal=null,taskUnfinished=null,properties=null,previewStatus='unprocessed' - Non-markdown:
tags=[],metadata={},wordCount=0,characterCountWithSpaces=0,characterCountWithoutSpaces=0,taskTotal=0,taskUnfinished=0,properties=null,previewStatus='none'
Preview text and feature images are stored separately and tracked through status fields:
previewStatus:unprocessed: markdown pipeline provider has not run yetnone: processed, no preview text storedhas: processed, preview text stored in the preview store
featureImageStatus:unprocessed: feature image provider has not run yetnone: processed, no thumbnail blob storedhas: processed, thumbnail blob stored in the blob store
featureImageKey(stable source key):null: not generated yet'': processed and resolved to “no image”f:<path>@<mtime>: local vault file reference (image embeds, PDF cover thumbnails, rasterized SVG thumbnails)e:<url>: external https URL reference (normalized, hash stripped)y:<videoId>: YouTube thumbnail referenced:<provider>:<path>: drawing file with provider-owned preview rendering
The dedicated stores are cleared alongside the main file store during a full rebuild:
- Preview text store: keyed by file path (
previewStatustracks presence) - Feature image blob store: keyed by file path (
featureImageStatus/featureImageKeytrack presence and source)
StorageContext(src/context/StorageContext.tsx) wires the storage hooks and exposes synchronous reads to the UI.- Storage hooks (
src/context/storage/*):useIndexedDBReady: initializes IndexedDB and the in-memory mirroruseInitializeContentProviderRegistry: registers content providersuseStorageVaultSync: initial cache build, vault event handling, rename seeding, and file diffsuseStorageContentQueue: selects files that need derived content and queues providersuseMetadataCacheQueue: gates markdown providers on Obsidian metadata cache readinessuseStorageSettingsSync: reacts to settings changes and queues regeneration workuseTagTreeSync: builds the tag tree and schedules rebuilds when tags changeusePropertyTreeSync: builds the property tree and schedules rebuilds when properties or visibility rules changeuseStorageCacheRebuild: implements the “Rebuild cache” actionuseCacheRebuildNotice: shows and updates the rebuild progress notice
IndexedDBStorage(src/storage/IndexedDBStorage.ts) persists file records and emitsonContentChangenotifications.MemoryFileCache(src/storage/MemoryFileCache.ts) mirrors file records (and small caches like preview text) for synchronous reads.src/utils/frontmatterMetadataCache.tspersists a signature of the frontmatter metadata settings inlocalStorage. Frontmatter-driven display name and timestamp reads (StorageContext) and navigation sorting (src/utils/fileFinder.ts) use the mirroredmetadatafield when the signature matches the current settings andmetadataMtimematches the file mtime, and fall back toextractMetadata()against the Obsidian metadata cache otherwise.src/utils/tagSourceCache.tsrecords inlocalStoragethe Tag source value (tagSource) the cachedtagsfields were read with. A missing record meansall, the source of every tag cache built before the setting existed.MetadataService(src/services/MetadataService.ts) and its sub-services manage settings-backed appearances, pinned notes, and separators; frontmatter-backed file/folder-note style writes patch cachedmetadatathroughIndexedDBStorage.updateFileMetadata().ContentProviderRegistry(src/services/content/ContentProviderRegistry.ts) runs provider batches and coordinates settings changes.- Content providers (
src/services/content/*):MarkdownPipelineContentProvider(markdownPipeline): preview, word/character counts, task counters, property pills, markdown feature imagesTagContentProvider(tags): tag extraction from Obsidian metadata cache, throughgetMetadataTags()insrc/utils/tagUtils.ts: frontmatter and inline body tags (getAllTags) whentagSourceisall, frontmatter tags only (parseFrontMatterTags) when it isfrontmatterMetadataContentProvider(metadata): frontmatter metadata + hidden stateFeatureImageContentProvider(fileThumbnails): non-markdown feature images (PDF covers, rasterized SVG files, and supported drawing source files)
graph TD
User["User action"] --> Trigger["Settings button or command palette"]
Trigger --> Plugin["NotebookNavigatorPlugin.rebuildCache"]
Plugin --> Activate["activateView() and resolve navigator leaf"]
Activate --> View["NotebookNavigatorView.rebuildCache"]
View --> Component["NotebookNavigatorComponent.rebuildCache"]
Component --> Storage["StorageContext.rebuildCache"]
Storage --> DB["IndexedDBStorage and MemoryFileCache"]
Storage --> Registry["ContentProviderRegistry"]
Registry --> MP["MarkdownPipelineContentProvider"]
Registry --> Tags["TagContentProvider"]
Registry --> Meta["MetadataContentProvider"]
Registry --> Thumbs["FeatureImageContentProvider"]
MP --> DB
Tags --> DB
Meta --> DB
Thumbs --> DB
The metadata pipeline is driven by a mix of manual actions, vault events, metadata cache events, and settings changes:
- Startup: once IndexedDB initialization completes, the initial cache build runs (
useStorageVaultSync). The build also compares the persisted frontmatter metadata settings signature and clears cachedmetadata(batchClearAllFileContent('metadata')) when those settings changed while the plugin was unloaded. It likewise clears cachedtags(batchClearAllFileContent('tags')) when the recorded tag source differs fromtagSource, before the tag tree is built. - Vault sync:
create/delete: debounced diff usingcalculateFileDiff()andrecordFileChanges()(useStorageVaultSync)rename: seed/move cached artifacts, then schedule a diff to reconcile state (useStorageVaultSync)modify: record the new mtime and queue derived content for that file (useStorageVaultSync)
- Obsidian metadata cache:
metadataCache.on('changed', file)can trigger a regeneration pass even when vault mtimes did not update in the expected order (markFilesForRegeneration()resets provider processed mtimes and a re-queue follows). - Settings changes:
ContentProviderRegistry.handleSettingsChange()can stop providers, clear affected content, and re-queue regeneration (useStorageSettingsSync). When frontmatter metadata settings change,useStorageSettingsSyncalso updates the frontmatter metadata cache signature, or clears it when frontmatter metadata is disabled. AtagSourcechange while tags are shown clears cachedtagstonull, so the empty-tag retries do not keep tags the new source no longer reads, andTagContentProvider.clearContent()records the new source. - Metadata service writes:
FileMetadataServiceandFolderNoteMetadataAdaptercan update markdown frontmatter throughapp.fileManager.processFrontMatter(...), then patch the cachedmetadataobject throughIndexedDBStorage.updateFileMetadata()so file and folder-note style changes emitonContentChangebefore the later metadata-cache regeneration pass. - Manual rebuild: Settings → Notebook Navigator → Advanced → Rebuild cache, or the
notebook-navigator:rebuild-cachecommand.
The file cache is seeded and kept up to date with a diff-based sync:
calculateFileDiff(currentFiles)(src/storage/diffCalculator.ts) compares vault files to cachedFileDatarecords and returns:toAdd: new pathstoUpdate: paths whosefile.stat.mtimechangedtoRemove: cached paths no longer present in the vaultexistingData: cached records for thetoUpdatepaths, consumed byrecordFileChanges
recordFileChanges(files, existingData, ...)(src/storage/fileOperations.ts) updates the database:- New files: create default
FileDatawith “unprocessed”/nullmarkers for derived content - Modified files: patch only
mtimeand leave provider-owned fields intact, so existing derived content remains visible until providers regenerate
- New files: create default
removeFilesFromCache(paths)removes the file record and associated preview/blob store entries.
Renames are handled with a seed-and-move step before the diff runs:
useStorageVaultSyncseeds the new path in the in-memory cache and moves preview text / feature image blob store keys when applicable.- After the move, it schedules a diff pass to reconcile the final file state and provider mtimes.
Derived content is generated by content providers managed by ContentProviderRegistry (src/services/content/ContentProviderRegistry.ts):
- Providers decide whether a file needs work by comparing their processed mtime field (
*Mtime) tofile.stat.mtimeand checking status fields (previewStatus,featureImageStatus,featureImageKey,tags,metadata,wordCount,characterCountWithSpaces,characterCountWithoutSpaces,taskTotal,taskUnfinished,properties). - Providers update content fields and their processed mtime in one IndexedDB transaction (
IndexedDBStorage.batchUpdateFileContentAndProviderProcessedMtimes), and processed mtime updates are guarded to avoid overwriting forced regeneration resets. markFilesForRegeneration()(src/storage/fileOperations.ts) resets provider processed mtimes without clearing existing provider output fields, forcing providers to re-run against the current metadata cache/settings.- Markdown providers are metadata-gated via
queueMetadataContentWhenReady(...)(useMetadataCacheQueue), which tracks pending work per path and flushes it whenapp.metadataCache.getFileCache(file)is available. TagContentProviderandMarkdownPipelineContentProvideruse bounded retries when Obsidian metadata is temporarily empty so existing tags and frontmatter-driven outputs are not cleared too early while the metadata cache is still settling.
The rebuild flow starts from Settings → Notebook Navigator → Advanced → Rebuild cache, or the notebook-navigator:rebuild-cache command.
sequenceDiagram
actor User
participant Settings as AdvancedTab
participant Plugin as NotebookNavigatorPlugin
participant Workspace as Obsidian workspace
participant View as NotebookNavigatorView
participant Component as NotebookNavigatorComponent
participant Storage as StorageContext
participant Registry as ContentProviderRegistry
participant DB as IndexedDBStorage
participant Obsidian as Obsidian metadataCache
participant Providers as Content providers
User->>Settings: Click "Rebuild cache"
Settings->>Plugin: rebuildCache()
Plugin->>Plugin: activateView()
Plugin->>Workspace: getLeavesOfType(NOTEBOOK_NAVIGATOR_VIEW)
Plugin->>View: rebuildCache()
View->>Component: rebuildCache()
Component->>Storage: rebuildCache()
Storage->>Registry: stopAllProcessing()
Storage->>DB: clearDatabase()
Storage->>Storage: reset tag/property tree state
Storage->>Storage: isStorageReady=false
Storage->>Storage: buildFileCache(isInitialLoad=true)
Storage->>DB: calculateFileDiff
Storage->>DB: recordFileChanges
Storage->>Storage: rebuildTagTree() + rebuildPropertyTree()
Storage->>Storage: isStorageReady=true
Storage->>Obsidian: queueMetadataContentWhenReady(markdown files, markdownPipeline/tags/metadata)
Storage->>Registry: queue fileThumbnails (supported non-markdown feature images)
Note over Registry,Providers: Background content generation
Registry->>Providers: startProcessing(settings)
Registry->>Providers: queueFiles(files)
Providers->>DB: write content updates
DB-->>Storage: onContentChange(changes)
Storage->>Storage: scheduleTagTreeRebuild()/schedulePropertyTreeRebuild() as needed
IndexedDBStorage.clearDatabase()clears:- File records
- Preview text store
- Feature image blob store
- In-memory mirrors and LRU caches
buildFileCache(true)(initial-load path inuseStorageVaultSync) seeds the database by diffing against an empty cache:- New markdown records start with
tags=null,metadata=null,wordCount=null,characterCountWithSpaces=null,characterCountWithoutSpaces=null,taskTotal=null,taskUnfinished=null,properties=null, andpreviewStatus='unprocessed'. - New non-markdown records start with
tags=[],metadata={},wordCount=0,characterCountWithSpaces=0,characterCountWithoutSpaces=0,taskTotal=0,taskUnfinished=0,properties=null, andpreviewStatus='none'. - Feature image fields start as
featureImageStatus='unprocessed'andfeatureImageKey=nullfor markdown and supported non-markdown records.
- New markdown records start with
queueMetadataContentWhenReady(...)gates markdown providers onapp.metadataCache.getFileCache(file):- Filters to files that still need content based on status fields and processed mtimes.
- Tracks pending work per file path and flushes it when Obsidian emits
metadataCacheresolved/changedevents.
- Non-markdown feature image generation is queued directly through the registry (
fileThumbnails) whenshowFeatureImageis enabled.
MarkdownPipelineContentProvider runs a processor chain for markdown-derived outputs. Each processor inspects a shared context (settings, file data, frontmatter, optional file content) and returns a partial update.
flowchart LR
A[Job: markdown file] --> B["Read metadata cache: frontmatter and offsets"]
B --> C{Needs body read?}
C -->|Yes| D[Read markdown content]
C -->|No| E[Skip body read]
D --> F[Build pipeline context]
E --> F
F --> P1[Processor: preview]
P1 --> P2[Processor: word count]
P2 --> P3[Processor: character count]
P3 --> P4[Processor: tasks]
P4 --> P5[Processor: properties]
P5 --> P6[Processor: feature image]
P6 --> G["Write patch to IndexedDB: update stores, status fields, markdownPipelineMtime"]
Body reads are only performed when at least one output requires markdown content:
- Preview text extraction
- Word count (uses Obsidian text-count frontmatter slicing)
- Character counts (use Obsidian text-count frontmatter slicing)
- Task counting
- Feature image reference resolution from the note body (when not resolved from frontmatter)
The provider can also skip reads for large markdown files and still apply “safe” updates derived from
frontmatter/metadata (for example, setting wordCount=0, characterCountWithSpaces=0,
characterCountWithoutSpaces=0, taskTotal=0, and taskUnfinished=0, and clearing previews by writing an empty
preview string).
Feature image references can be resolved from frontmatter without reading the note body. Exclusion rules (featureImageExcludeProperties) can force the “no image” marker (featureImageKey='', featureImageStatus='none').
Preview math stripping is implemented in src/utils/previewText/latexParsing.ts and
src/utils/previewText/previewPipeline.ts (re-exported through src/utils/previewTextUtils.ts). It follows
Obsidian's bundled markdown math tokenizer behavior for dollar delimiters.
Rule set for inline math parsing:
- Delimiters:
$...$and$$...$$ - Escaped opening
\$is parsed as literal$, not as a math start - Single-dollar opening is rejected when the first character after
$is a space or tab - Single-dollar closing is accepted only when:
- the character before the closing
$is not a space or tab - the character after the closing
$is not a digit (0-9)
- the character before the closing
- Double-dollar closing requires a closing
$$pair - After closing
$$, trailing whitespace up to the first newline is consumed by the tokenizer
Rule set for fenced-dollar math blocks:
- Opening fence line:
- optional leading spaces
- two or more dollars
- optional spaces
- newline
- Closing fence line:
- optional indentation
- dollar run length equal to or greater than the opening run length
- optional trailing spaces
- If no closing fence is found, the block token extends to end of input
Delimiter scope:
- Supported delimiters in this parser path:
$...$,$$...$$, and fenced dollar runs - Delimiters
\(...\)and\[...\]are not part of this tokenizer path
Processing boundaries in Notebook Navigator:
- Math stripping runs only when
stripLatexInPreviewis enabled - The preview source is clipped before stripping (
MAX_PREVIEW_TEXT_LENGTH,PREVIEW_SOURCE_SLACK,PREVIEW_EXTENSION_LIMIT) - Stripping runs only on non-code segments; inline and fenced code ranges are preserved
- Cache invalidation for preview regeneration is triggered when
stripLatexInPreviewchanges (MarkdownPipelineContentProvider.getRelevantSettings()andgetMarkdownPipelineClearFlags())
Callout removal and blockquote fence detection are implemented in src/utils/codeRangeUtils.ts
(removeCalloutBlocks, scanFencedCodeSegments) and applied in
src/utils/previewText/previewPipeline.ts. The rules match Obsidian Reading view rendering
(verified against Obsidian 1.13), which applies blockquote lazy continuation more broadly than
CommonMark.
Rule set for callout membership:
- A callout starts at a line whose blockquote prefix is followed by a
[!type]marker, with an optional+or-fold suffix - Every following line with blockquote depth at least the header depth is callout content, including nested callouts and fenced code
- Lazy continuation: a non-blank line at shallower depth is still callout content unless it starts a heading, list item, thematic break, or fence. This includes lines directly after a fenced code block or a
>-only line - A blank line or an interrupting block line ends the callout; that line is kept
- Callout markers inside fenced code blocks are code and are not treated as callouts
Rule set for fences inside blockquotes:
- Closing fences must use the same fence character, be at least as long as the opener, and appear at the same blockquote depth
- Shallower non-blank lines are absorbed into an open blockquote fence as code content
- A blank line, or a shallower line starting a heading, list item, thematic break, or another fence, ends the blockquote and the open fence with it; a shallower fence marker then starts its own fence
- An unclosed fence otherwise runs to the end of input
Processing boundaries in Notebook Navigator:
- Callout removal runs only when
skipCalloutsInPreviewis enabled; it runs before clipping so a leading callout longer than the clip window does not blank the preview - When
skipCalloutsInPreviewis disabled, callout markers are stripped but callout title text and content remain in the preview - Cache invalidation for preview regeneration is triggered when
skipCalloutsInPreviewchanges (MarkdownPipelineContentProvider.getRelevantSettings()andgetMarkdownPipelineClearFlags())
- Storage is ready when the initial diff + tag/property tree build completes and
StorageContextsetsisStorageReady=true(useStorageVaultSync). - Rebuild progress is tracked from metadata-ready work (
readyRemainingCount), while rebuild completion checks the full missing-content count (rawRemainingCount) across the tracked content types (useCacheRebuildNotice):- Preview: markdown files where
previewStatus === 'unprocessed'(when preview tracking is enabled) - Tags: markdown files where
tags === null(when tag tracking is enabled) - Metadata: markdown files where
metadata === null(when metadata tracking is enabled) - Word count: markdown files where
wordCount === null(when word-count tracking is enabled) - Character count: markdown files where
characterCountWithSpaces === nullorcharacterCountWithoutSpaces === null(when character-count tracking is enabled) - Tasks: markdown files where
taskTotal === nullortaskUnfinished === null(always tracked) - Properties: markdown files where
properties === null(always tracked) - Feature image: files where
featureImageKey === nullorfeatureImageStatus === 'unprocessed'(when feature image tracking is enabled)
- Preview: markdown files where
- Once the database has been seeded, the notice can complete after two empty polls even if no new queueable work is observed in that tick.
- If metadata-gated work never becomes queueable, the notice also has a 60-second dismissal fallback so it does not stay open indefinitely.