blueheron786442 downloadsEfficiently calculates and caches word counts for notes, with folder exclusion. Uses cache to avoid recalculating word counts for unchanged notes.
This plugin efficiently calculates and caches the word counts of all Markdown files in your vault, excluding configurable folders like Templates. It updates in real-time as files change, and caches results to disk to speed up startup and vault-wide statistics.
Templates, .trash).window.wordCountCache) with:get(path) — word count for a specific file pathtotal() — total word count across all cached filesAvailable via the Community Plugins browser. If you want to install it manually:
.obsidian/plugins/efficient-wordcount/.You can access the word counts in your DataviewJS scripts or custom scripts via the global object:
// Get total word count in vault
const total = window.wordCountCache.total();
// Get word count for a specific file path
const count = window.wordCountCache.get("Folder/Note.md");
You can configure excluded files or folders via the plugin settings. For files, the .md extension is optional.
The plugin is written in JavaScript. If you prefer TypeScript, you're welcome to convert it over and open a PR.
Reload plugin in Obsidian after rebuilding via CTRL + P => Reload ....
MIT License. Feel free to contribute!