Skip to main content

Module inline_config

Module inline_config 

Source
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§

InlineConfig
InlineConfigWarning
Warning about an inline config comment.
InlineDirective
A parsed inline configuration directive.

Enums§

DirectiveKind
The type of an inline configuration directive.
InlineConfigProblem
What is wrong with an inline config comment.

Functions§

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 configuration left disabled, so the enable has no effect.

Type Aliases§

FileIndexExport
Type alias for the export_for_file_index return type: (file_disabled_rules, persistent_transitions, line_disabled_rules)