Expand description
Inline configuration comment handling for markdownlint compatibility
Supports:
<!-- markdownlint-disable -->- Disable all rules from this point<!-- markdownlint-enable -->- Re-enable all rules from this point<!-- markdownlint-disable MD001 MD002 -->- Disable specific rules<!-- markdownlint-enable MD001 MD002 -->- Re-enable specific rules<!-- markdownlint-disable-line MD001 -->- Disable rules for current line<!-- markdownlint-disable-next-line MD001 -->- Disable rules for next line<!-- markdownlint-capture -->- Capture current configuration state<!-- markdownlint-restore -->- Restore captured configuration state<!-- markdownlint-disable-file -->- Disable all rules for entire file<!-- markdownlint-enable-file -->- Re-enable all rules for entire file<!-- markdownlint-disable-file MD001 MD002 -->- Disable specific rules for entire file<!-- markdownlint-enable-file MD001 MD002 -->- Re-enable specific rules for entire file<!-- markdownlint-configure-file { "MD013": { "line_length": 120 } } -->- Configure rules for entire file<!-- prettier-ignore -->- Disable all rules for next line (compatibility with prettier)
Also supports rumdl-specific syntax with same semantics.
configure-file differs from every other directive in two ways: its comment
may span multiple lines, and a rule may be given a boolean instead of an
options object to turn it off (false) or on (true) for the whole file.
Directives inside fenced code blocks are ignored.
Structs§
- Disable
Site - An inline comment that disables rules, and the lines it can act on.
- Inline
Config - Inline
Config Warning - Warning about an inline config comment.
- Inline
Directive - A parsed inline configuration directive.
Enums§
- Directive
Kind - The type of an inline configuration directive.
- Disable
Layer - The kind of directive a rule’s disabled state at a line comes from.
- Disable
Scope - The lines an inline disable comment can suppress a finding on.
- Enable
NoEffect Reason - Why an inline enable cannot take effect.
- Inline
Config Problem - What is wrong with an inline config comment.
Constants§
- INLINE_
CONFIG_ DIAGNOSTIC_ NAME - The diagnostic code inline config warnings carry.
Functions§
- collect_
disable_ sites - Every inline comment that disables rules, in document order.
- is_
capture_ comment - Check if line contains a capture comment
- is_
restore_ comment - Check if line contains a restore comment
- parse_
configure_ file_ comment - Parse a configure-file comment and return the JSON configuration.
- parse_
disable_ comment - Parse a disable comment and return the list of rules (empty vec means all rules)
- parse_
disable_ file_ comment - Parse a disable-file comment and return the list of rules (empty vec means all rules)
- parse_
disable_ line_ comment - Parse a disable-line comment
- parse_
disable_ next_ line_ comment - Parse a disable-next-line comment
- parse_
enable_ comment - Parse an enable comment and return the list of rules (empty vec means all rules)
- parse_
enable_ file_ comment - Parse an enable-file comment and return the list of rules (empty vec means all rules)
- parse_
inline_ directives - Parse all inline configuration directives from a line, in left-to-right order.
- validate_
inline_ config_ rules - Validate all inline config comments in content and return warnings for unknown rules.
- validate_
inline_ enables_ against_ active_ rules - Warn when an inline directive tries to ENABLE a rule that will not run over this document, so the enable has no effect.
Type Aliases§
- File
Index Export - Type alias for the export_for_file_index return type: (file_disabled_rules, persistent_transitions, line_disabled_rules)