Struct MDBOOK007

Source
pub struct MDBOOK007 { /* private fields */ }
Expand description

MDBOOK007: Validate include file paths and existence

This rule validates that all include directives in markdown files point to existing files with correct syntax. It prevents build failures and broken includes by checking:

The rule:

  • Finds all include directive patterns in markdown content
  • Resolves include paths relative to the source file
  • Validates target files exist and are readable
  • Checks line range syntax and bounds where applicable
  • Verifies anchor references exist in target files
  • Detects circular include dependencies
  • Provides clear error messages for debugging

Include Directive Formats Supported:

  • Basic file includes: {{#include file.txt}}
  • Line ranges: {{#include file.rs:10:20}}
  • Named anchors: {{#include file.rs:anchor_name}}
  • Relative paths: {{#include ../other/file.md}}
  • Rust-specific: {{#rustdoc_include file.rs}}

Trait Implementations§

Source§

impl AstRule for MDBOOK007

Source§

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

Unique identifier for the rule (e.g., “MD001”)
Source§

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

Human-readable name for the rule (e.g., “heading-increment”)
Source§

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

Description of what the rule checks
Source§

fn metadata(&self) -> RuleMetadata

Metadata about this rule’s status and properties
Source§

fn check_ast<'a>( &self, document: &Document, _ast: &'a AstNode<'a>, ) -> Result<Vec<Violation>>

Check a document using its AST
Source§

fn can_fix(&self) -> bool

Whether this rule can automatically fix violations
Source§

fn fix(&self, _content: &str, _violation: &Violation) -> Option<String>

Attempt to fix a violation (if supported)
Source§

fn create_violation( &self, message: String, line: usize, column: usize, severity: Severity, ) -> Violation

Create a violation for this rule
Source§

impl Default for MDBOOK007

Source§

fn default() -> MDBOOK007

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Rule for T
where T: AstRule,

Source§

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

Unique identifier for the rule (e.g., “MD001”)
Source§

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

Human-readable name for the rule (e.g., “heading-increment”)
Source§

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

Description of what the rule checks
Source§

fn metadata(&self) -> RuleMetadata

Metadata about this rule’s status and properties
Source§

fn check_with_ast<'a>( &self, document: &Document, ast: Option<&'a Node<'a, RefCell<Ast>>>, ) -> Result<Vec<Violation>, MdBookLintError>

Check a document for violations of this rule with optional pre-parsed AST
Source§

fn check(&self, document: &Document) -> Result<Vec<Violation>, MdBookLintError>

Check a document for violations of this rule (backward compatibility)
Source§

fn can_fix(&self) -> bool

Whether this rule can automatically fix violations
Source§

fn fix(&self, content: &str, violation: &Violation) -> Option<String>

Attempt to fix a violation (if supported)
Source§

fn create_violation( &self, message: String, line: usize, column: usize, severity: Severity, ) -> Violation

Create a violation for this rule
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.