BasedOnStyles
Learn how to enable a style for a specific file type.
StylesPath = styles
[*.md]
BasedOnStyles = Vale, MyStyleBasedOnStyles enables every rule in the named styles for the files a section matches.
It's a section-level setting, so it has to appear under a glob. Putting it above the first section is an error:
'BasedOnStyles' is a syntax-specific optionTo apply styles to everything, use the catch-all section:
[*]
BasedOnStyles = ValeMore than one section
When several sections match a file, the most specific one's BasedOnStyles replaces the others—it doesn't add to them:
[*]
BasedOnStyles = Vale
[*.md]
# Markdown files get Microsoft *instead of* Vale, not as well as.
BasedOnStyles = MicrosoftIf you want the defaults plus something extra, name them all:
Individual rules
Rules can be switched on or off by name, and unlike BasedOnStyles, these settings accumulate across every section that matches:
That's the way to extend your defaults for one file type without repeating them.
Turning a rule off works the same way:
A rule can also be enabled on its own, without its style being listed at all:
Severity
The same syntax sets a rule's level, which overrides whatever the rule file declares:
A bare style name sets the default for every rule in that style, and a rule naming itself still wins:
This is the concise way to keep one part of a style while turning the rest down—or off:
See MinAlertLevel for how levels affect Vale's exit code.
Parameters
A bracketed key overrides one scalar on a rule you have enabled, keeping the rule's identity:
Values are coerced to the field's type at compile time, and an unknown parameter fails the rule's compilation rather than being silently dropped.
Only scalars can be tuned this way. A structural field — tokens, swap, message — is refused with a pointer at extending the rule in a style, which is what authoring is for. [level] is refused too: the classic Style.Rule = warning syntax already says that.
Related: MinAlertLevel SkippedScopes
Last updated