For the complete documentation index, see llms.txt. This page is also available as Markdown.

WordTemplate

Learn about how to change what Vale considers a word boundary.

StylesPath = styles
MinAlertLevel = suggestion

WordTemplate = (?m)(?:%s)

[*.md]
BasedOnStyles = Vale

WordTemplate sets the pattern Vale wraps a rule's tokens in. The default is:

(?m)\b(?:%s)\b

%s is where the rule's tokens are inserted, and \b on either side is what stops cat from matching inside concatenate. Rules built from token lists—existence, substitution, consistency, and sequence—all use it.

When you need it

\b is defined as the boundary between a word character ([0-9A-Za-z_]) and anything else. Scripts written outside that set have no word characters at all, so the boundary never occurs and the rule matches nothing:

extends: existence
message: "Found it."
level: error
tokens:
  - 世界

Given the text 你好世界朋友, that rule reports nothing—and reports nothing for hello 世界 there too, where the term is surrounded by spaces. There is no error and no warning; the rule is simply silent.

Setting a template without \b fixes it:

Per-rule alternatives

If only some rules need different boundaries, leave WordTemplate alone and use the rule's own keys instead:

  • nonword: true drops the boundaries for one rule.

  • raw lets a rule supply its pattern verbatim, boundaries included.

Related: BasedOnStyles View

Last updated