The Custom Selected Word Count plugin adds precise and flexible word counting for selected text across all editing modes. It goes far beyond the default functionality by allowing users to exclude specific file paths, file types, and even URL-like strings from counts. Advanced users can define their own regex patterns for detecting words, with an interactive test area to validate and refine these patterns. It also logs word count history with timestamps, making it useful for writing sessions or progress tracking. The detailed settings give fine control over behaviour, from path exclusion rules to UI preferences, making it highly customisable for both casual users and power users alike.
Custom Selected Word Count v1.5.0
This release introduces powerful per-note exclusion overrides, improved UI organization, and comprehensive documentation updates.
Highlights
- Per-note exclusion overrides - Override global settings for individual notes
- Inline comment markers - Disable exclusions for specific text sections
- Code exclusion UI - Previously hidden settings now accessible
- Better organized settings - Improved visual hierarchy and property references
- Comprehensive docs - All features now fully documented
New Features
Per-Note Exclusion Override System
Override global exclusion settings for individual notes using YAML frontmatter:
---
cswc-disable: [exclude-urls, exclude-comments]
---
Or disable all exclusions at once:
---
cswc-disable: all
---
Supported override values:
- Path exclusions: exclude-windows-paths, exclude-unix-paths, exclude-unc-paths, exclude-environment-paths
- Content exclusions: exclude-urls, exclude-code-blocks, exclude-inline-code, exclude-comments
- Structure exclusions: exclude-headings, exclude-specific-headings, exclude-words-phrases
Inline Comment-Based Overrides
Use special comment markers to disable exclusions for specific sections within your notes:
This text follows global exclusion rules.
<!-- cswc-disable -->
This section ignores all exclusions - URLs, paths, and comments are counted.
<!-- cswc-enable -->
Back to normal exclusion rules.
Also works with Obsidian comment syntax: %% cswc-disable %%
and %% cswc-enable %%
Code Exclusion Settings
The settings UI now includes previously missing code exclusion toggles:
- Master toggle "Exclude code"
- Sub-options for "Exclude code blocks" (triple-backtick blocks)
- Sub-options for "Exclude inline code" (single-backtick code)
Improvements
Settings UI Enhancements
- Added property value indicators next to each exclusion toggle (e.g.,
Property: exclude-urls
) - Added collapsible "Using per-note exclusion overrides" help section with examples
- Reorganized settings with better grouping and visual hierarchy
- Improved section headings and descriptions for clarity
Technical Improvements
- Added proper word-count- prefix to CSS classes for better scoping
- Implemented efficient frontmatter parsing using Obsidian's MetadataCache API
- Minimal performance impact with smart caching
Documentation
All documentation has been overhauled to include the new features:
- Architecture overview updated with per-note override system details
- User guides now cover all features from the architecture
- Settings reference includes all new options
- Added comprehensive examples and use cases
Technical Details
New Functions:
getDisabledExclusionsFromFrontmatter()
- Parses YAML frontmatter for overridesprocessTextWithOverrides()
- Handles inline comment markers
Updated Functions:
- All counting functions (
countSelectedWords
,countSelectedCharacters
,countSelectedSentences
) now respect override settings
Installation
From Obsidian Community Plugins
- Open Settings → Community Plugins
- Search for "Custom Selected Word Count"
- Install and enable the plugin
Manual Installation
- Download main.js, manifest.json, and styles.css from this release
- Place them in your vault's .obsidian/plugins/custom-selected-word-count/ folder
- Enable the plugin in Settings → Community Plugins
Acknowledgments
Thank you to all users who have provided feedback and feature requests. Your input helps make this plugin better for everyone!
Bug Reports & Feature Requests
If you encounter any issues or have suggestions for future improvements, please create an issue.
Support
If you find this plugin useful, consider supporting its development:
Full Changelog: https://github.com/banisterious/obsidian-custom-selected-word-count/compare/1.4.0…1.5.0