errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.52k stars 155 forks source link

Indicators in capitalization rule do not work with title case #898

Open DominikaK opened 2 months ago

DominikaK commented 2 months ago

Check for existing issues

Environment

OS: macOS Install method: Homebrew Vale version: 3.7.1

Describe the bug / provide steps to reproduce it

When using a capitalization rule, indicators functions correctly with a $title match, but not with a $sentence match.

The following rule (Vale Studio: https://studio.vale.sh/s/bb9890c4782f80c8c30a88007219574c):

extends: capitalization
message: "'%s' should be in sentence case"
level: warning
scope: heading
match: $sentence
indicators:
    - ":"

correctly shows # Heading One to be incorrect, but # Heading: One to be correct - capital letter is ignored after the colon indicator.

However, when I change match to $title (Vale Studio: https://studio.vale.sh/s/28ca0c60b15db662d53caa8375e6f47e):

extends: capitalization
message: "'%s' should be in title case"
level: warning
scope: heading
match: $title
indicators:
    - ":"

both # Heading one and # Heading: one are marked as mistakes - the colon indicator does not make the rule ignore the lowercase "one".