Parse per-file Word Count Target header and show progress
Header parsing now recognises a `Word Count Target:` line at any heading level (## included) in addition to `# Title:`/`# Slug:`, and accepts one or more leading `#`. The value parses a single number or a range — "1500 - 2000", "1500-2000", "1,500 to 2,000" — into a min/max WordGoal (stripped from the exported document like the other header lines). When a target is set, the status bar shows a progress bar of the file's prose word count (the body below the draft marker) against it: amber under the target, green in range, blue over. Aliases "Word Count Goal:" and "Word Count:" also work. Adds preprocess tests for the range forms, ## heading level, alias, and absence; 44 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N9kRuP7JvXoUGdNNeg5ZSs
This commit is contained in:
@@ -110,6 +110,22 @@ The status bar shows a live **word count** for the current file, plus the net
|
||||
words added (or removed) to it since the current session started. The count
|
||||
updates as you type, including unsaved edits.
|
||||
|
||||
### Per-file word-count targets
|
||||
|
||||
Give a file a target by adding a **`Word Count Target:`** line to its header (at
|
||||
any heading level):
|
||||
|
||||
```markdown
|
||||
## Word Count Target: 1500 - 2000
|
||||
```
|
||||
|
||||
A **progress bar** then appears in the status bar, comparing the file's **prose**
|
||||
word count (the body below the draft marker, so header metadata isn't counted)
|
||||
against the target: **amber** while under the target, **green** once inside the
|
||||
range, **blue** when over it. A single number (`## Word Count Target: 1800`) sets
|
||||
a point goal; ranges accept `-`, `–`, `to`, and grouped digits (`1,500`). Like
|
||||
the other header lines, the target is stripped from the exported document.
|
||||
|
||||
## Spelling (offline)
|
||||
|
||||
Spelling is checked **live as you type**, entirely offline — no server, no
|
||||
|
||||
Reference in New Issue
Block a user