| ensureMetadataCacheReady |
Ensures that the metadata cache is ready for all files. |
| getBacklinksForFileOrPath |
Retrieves the backlinks for a file or path. NOTE: The file may be non-existent. When Advanced Metadata Cache publishes its backlinks API and its Backlinks module is on, its cache answers. Otherwise the answer comes from a backlink index whose cost is proportional to the candidate notes rather than to every reference in the vault, and which gives the same references Obsidian’s own getBacklinksForFile gives. |
| getBacklinksForFileSafe |
Retrieves the backlinks for a file safely. When Advanced Metadata Cache publishes its backlinks API and its Backlinks module is on, that API answers. Otherwise this is NOT a pure read. It verifies each backlink against the note’s current text, and to do that it calls saveNote on every note that links to the file, which saves any open editor view of those notes that has unsaved changes. Call it from an explicit user action. Do not call it from an automatic trigger (a vault or metadata event, a save or render patch) that only decides whether to act. There, a forced save can race another plugin’s in-flight editor change. |
| getCacheSafe |
Retrieves the cached metadata for a given file or path. This is NOT a pure read: before it reads the cache, it calls saveNote, which saves any open editor view of the note that has unsaved changes. That save is why the cache matches what the user sees, and why a command that rewrites the note can use this safely without its rewrite being clobbered. It is also a write on the note. So do not call this from an automatic trigger (a vault or metadata event, a save or render patch, a layout hook) that only decides whether to act: a forced save one tick after another plugin has dispatched a change into the editor can leave Obsidian’s editor rendering stale state. A read-only probe on the note’s current text should use parseMetadata on that text instead. It needs no view, no cache and no save. |
| getFrontmatterSafe |
Retrieves the front matter from the metadata cache safely. It reads through getCacheSafe, so it saves any open editor view of the note that has unsaved changes. See getCacheSafe for when that save matters and what to use instead. |
| getLinks |
Retrieves the selected links from the provided cache. |
| hasBacklinkCachePlugin |
Determines whether a backlink cache plugin is currently loaded - either Advanced Metadata Cache (ADVANCED_METADATA_CACHE_PLUGIN_ID) or its retired predecessor Backlink Cache (BACKLINK_CACHE_PLUGIN_ID). Such a plugin keeps a drain-on-read backlink index and indexes canvas metadata, so a caller that compensates for Obsidian’s own gaps can stand down while one is present. Both ids are recognized; BACKLINK_CACHE_PLUGIN_ID records when the retired one may be dropped. This reads the LOADED plugin instance rather than app.plugins.enabledPlugins, deliberately: the question is whether the plugin’s patches are in place right now, and they are not until it has loaded. Plugins load in an unspecified order, so call this from a user-driven path rather than from plugin load - see rule L25 in AGENTS.md. |
| isCachedMetadataEx |
Determines whether a cache is a CachedMetadataEx (i.e. it was computed with external-link parsing enabled). |
| parseMetadata |
Parses the metadata for a given string. |
| registerFileCacheForNonExistingFile |
Registers the file cache for a non-existing file. |
| registerFiles |
Registers files in the Obsidian app. |
| unregisterFileCacheForNonExistingFile |
Unregisters the file cache for a non-existing file. |
| unregisterFiles |
Unregisters files from the Obsidian app. |