Go to file Use this template
Isaac Lyman 5cf3da943f Update README to make Safety section less ominous and document the Recount command 2022-03-09 22:06:46 -07:00
logic Use instanceof instead of duck typing for TAbstractFile 2022-03-09 13:50:58 -07:00
.editorconfig Update sample plugin to use ESBuild. 2021-10-19 13:34:58 -04:00
.eslintignore Adding eslint for code .\src\ (#17) 2021-10-30 14:04:07 -04:00
.eslintrc add version bump script (#10) 2022-01-22 16:13:50 -05:00
.gitignore Update .gitignore (#25) 2022-01-28 10:34:53 -05:00
.npmrc add version bump script (#10) 2022-01-22 16:13:50 -05:00
LICENSE Create LICENSE 2022-03-09 15:23:43 -07:00
README.md Update README to make Safety section less ominous and document the Recount command 2022-03-09 22:06:46 -07:00
esbuild.config.mjs Update esbuild script to include codemirror packages as external. 2022-01-10 09:01:38 -05:00
main.ts Remove unnecessary event handler; wait up to 1 second for File Explorer pane to load on initialization 2022-03-09 22:00:49 -07:00
manifest.json 2.0.0 2022-03-09 22:02:13 -07:00
package-lock.json 2.0.0 2022-03-09 22:02:13 -07:00
package.json 2.0.0 2022-03-09 22:02:13 -07:00
readme-screenshot-1.png Update README, add screenshot 2022-03-09 13:39:39 -07:00
styles.css Develop functionality 2022-03-09 13:15:14 -07:00
tsconfig.json add type check (#22) 2022-01-16 10:07:19 -05:00
version-bump.mjs add version bump script (#10) 2022-01-22 16:13:50 -05:00
versions.json 2.0.0 2022-03-09 22:02:13 -07:00

README.md

Novel word count plugin

A screenshot of the plugin, which shows slightly transparent word counts next to every document, folder, and vault in the File Explorer pane.

This plugin displays a word or page count next to every file, folder, and vault in the File Explorer pane. It updates as you write.

If you make changes to your files outside of Obsidian, you can trigger a recount of all files from the Command Palette (type "recount") or the plugin settings.

Safety

This plugin treats your vault as read-only. It never modifies, deletes, or renames any file or folder. It uses cached reads of all files for performance reasons.

Obsidian's API does not provide contractual access to the File Explorer pane, so this plugin uses duck typing to find it. This is technically undocumented, so future updates of Obsidian may break functionality. If and when that happens, this plugin is designed to fail gracefully. Any cached word counts will still appear in the File Explorer but they won't update when you write; you may wish to disable the plugin until it can be updated.

This plugin's effect on the File Explorer DOM is extremely minimal. It adds a [data-novel-word-count-plugin] attribute to each node (vault, folder, or file), then defines CSS ::after pseudo-elements that display the contents of the attribute. The existing elements are not modified in any other way and the structure is not changed.

Development

  • Clone this repo.
  • npm i or yarn to install dependencies
  • npm run dev to start compilation in watch mode.

Manually installing the plugin

  • Copy over main.js, styles.css, manifest.json to your vault VaultFolder/.obsidian/plugins/novel-word-count/.