Rule

Trait Rule 

Source
pub trait Rule:
    DynClone
    + Send
    + Sync {
Show 18 methods // Required methods fn name(&self) -> &'static str; fn description(&self) -> &'static str; fn check(&self, ctx: &LintContext<'_>) -> LintResult; fn fix(&self, ctx: &LintContext<'_>) -> Result<String, LintError>; fn as_any(&self) -> &dyn Any; // Provided methods fn check_with_structure( &self, ctx: &LintContext<'_>, _structure: &DocumentStructure, ) -> LintResult { ... } fn check_with_ast( &self, ctx: &LintContext<'_>, _ast: &MarkdownAst, ) -> LintResult { ... } fn check_with_structure_and_ast( &self, ctx: &LintContext<'_>, _structure: &DocumentStructure, _ast: &MarkdownAst, ) -> LintResult { ... } fn should_skip(&self, _ctx: &LintContext<'_>) -> bool { ... } fn category(&self) -> RuleCategory { ... } fn uses_ast(&self) -> bool { ... } fn uses_document_structure(&self) -> bool { ... } fn as_maybe_document_structure(&self) -> Option<&dyn MaybeDocumentStructure> { ... } fn as_maybe_ast(&self) -> Option<&dyn MaybeAst> { ... } fn default_config_section(&self) -> Option<(String, Value)> { ... } fn config_aliases(&self) -> Option<HashMap<String, String>> { ... } fn fix_capability(&self) -> FixCapability { ... } fn from_config(_config: &Config) -> Box<dyn Rule> where Self: Sized { ... }
}
Expand description

Remove marker /// TRAIT_MARKER_V1

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn description(&self) -> &'static str

Source

fn check(&self, ctx: &LintContext<'_>) -> LintResult

Source

fn fix(&self, ctx: &LintContext<'_>) -> Result<String, LintError>

Source

fn as_any(&self) -> &dyn Any

Provided Methods§

Source

fn check_with_structure( &self, ctx: &LintContext<'_>, _structure: &DocumentStructure, ) -> LintResult

Enhanced check method using document structure By default, calls the regular check method if not overridden

Source

fn check_with_ast( &self, ctx: &LintContext<'_>, _ast: &MarkdownAst, ) -> LintResult

AST-based check method for rules that can benefit from shared AST parsing By default, calls the regular check method if not overridden

Source

fn check_with_structure_and_ast( &self, ctx: &LintContext<'_>, _structure: &DocumentStructure, _ast: &MarkdownAst, ) -> LintResult

Combined check method using both document structure and AST By default, calls the regular check method if not overridden

Source

fn should_skip(&self, _ctx: &LintContext<'_>) -> bool

Check if this rule should quickly skip processing based on content

Source

fn category(&self) -> RuleCategory

Get the category of this rule for selective processing

Source

fn uses_ast(&self) -> bool

Check if this rule can benefit from AST parsing

Source

fn uses_document_structure(&self) -> bool

Check if this rule can benefit from document structure

Source

fn as_maybe_document_structure(&self) -> Option<&dyn MaybeDocumentStructure>

Source

fn as_maybe_ast(&self) -> Option<&dyn MaybeAst>

Source

fn default_config_section(&self) -> Option<(String, Value)>

Returns the rule name and default config table if the rule has config. If a rule implements this, it MUST be defined on the impl Rule for ... block, not just the inherent impl.

Source

fn config_aliases(&self) -> Option<HashMap<String, String>>

Returns config key aliases for this rule This allows rules to accept alternative config key names for backwards compatibility

Source

fn fix_capability(&self) -> FixCapability

Declares the fix capability of this rule

Source

fn from_config(_config: &Config) -> Box<dyn Rule>
where Self: Sized,

Factory: create a rule from config (if present), or use defaults.

Trait Implementations§

Implementors§

Source§

impl Rule for MD004UnorderedListStyle

Source§

impl Rule for MD013LineLength

Source§

impl Rule for MD030ListMarkerSpace

Source§

impl Rule for MD001HeadingIncrement

Source§

impl Rule for MD002FirstHeadingH1

Source§

impl Rule for MD003HeadingStyle

Source§

impl Rule for MD005ListIndent

Source§

impl Rule for MD006StartBullets

Source§

impl Rule for MD007ULIndent

Source§

impl Rule for MD009TrailingSpaces

Source§

impl Rule for MD010NoHardTabs

Source§

impl Rule for MD012NoMultipleBlanks

Source§

impl Rule for MD014CommandsShowOutput

Source§

impl Rule for MD018NoMissingSpaceAtx

Source§

impl Rule for MD019NoMultipleSpaceAtx

Source§

impl Rule for MD020NoMissingSpaceClosedAtx

Source§

impl Rule for MD021NoMultipleSpaceClosedAtx

Source§

impl Rule for MD022BlanksAroundHeadings

Source§

impl Rule for MD023HeadingStartLeft

Source§

impl Rule for MD024NoDuplicateHeading

Source§

impl Rule for MD025SingleTitle

Source§

impl Rule for MD026NoTrailingPunctuation

Source§

impl Rule for MD027MultipleSpacesBlockquote

Source§

impl Rule for MD028NoBlanksBlockquote

Source§

impl Rule for MD029OrderedListPrefix

Source§

impl Rule for MD031BlanksAroundFences

Source§

impl Rule for MD032BlanksAroundLists

Source§

impl Rule for MD033NoInlineHtml

Source§

impl Rule for MD034NoBareUrls

Source§

impl Rule for MD035HRStyle

Source§

impl Rule for MD036NoEmphasisAsHeading

Source§

impl Rule for MD037NoSpaceInEmphasis

Source§

impl Rule for MD038NoSpaceInCode

Source§

impl Rule for MD040FencedCodeLanguage

Source§

impl Rule for MD041FirstLineHeading

Source§

impl Rule for MD043RequiredHeadings

Source§

impl Rule for MD044ProperNames

Source§

impl Rule for MD045NoAltText

Source§

impl Rule for MD046CodeBlockStyle

Source§

impl Rule for MD047SingleTrailingNewline

Source§

impl Rule for MD048CodeFenceStyle

Source§

impl Rule for MD049EmphasisStyle

Source§

impl Rule for MD050StrongStyle

Source§

impl Rule for MD051LinkFragments

Source§

impl Rule for MD052ReferenceLinkImages

Source§

impl Rule for MD053LinkImageReferenceDefinitions

Source§

impl Rule for MD054LinkImageStyle

Source§

impl Rule for MD055TablePipeStyle

Source§

impl Rule for MD056TableColumnCount

Source§

impl Rule for MD058BlanksAroundTables