Crate mdbook_lint

Crate mdbook_lint 

Source
Expand description

mdbook-lint CLI and preprocessor

This crate provides the command-line interface and mdBook preprocessor functionality for mdbook-lint. It builds on the mdbook-lint-core library to provide CLI tools and mdBook integration.

§Basic Usage

use mdbook_lint::{Document, PluginRegistry};
use mdbook_lint_rulesets::{StandardRuleProvider, MdBookRuleProvider};
use std::path::PathBuf;

let mut registry = PluginRegistry::new();
registry.register_provider(Box::new(StandardRuleProvider)).unwrap();
registry.register_provider(Box::new(MdBookRuleProvider)).unwrap();
let engine = registry.create_engine().unwrap();
let document = Document::new("# Hello".to_string(), PathBuf::from("test.md"))?;
let violations = engine.lint_document(&document)?;

Re-exports§

pub use config::Config;
pub use preprocessor::MdBookLint;

Modules§

cli_prelude
Common imports for CLI usage
config
deduplication
Rule deduplication logic to eliminate duplicate violations
document
engine
Rule provider system and lint engine.
error
Error types for mdbook-lint
prelude
Common imports
preprocessor
registry
rule
test_helpers
Test helper utilities for rule testing
violation
Violation types for mdbook-lint

Structs§

Document
Represents a parsed markdown document with position information
LintEngine
Markdown linting engine
PluginRegistry
Registry for managing rule providers and creating engines
RuleMetadata
Metadata about a rule’s status, category, and properties
RuleRegistry
Registry for managing linting rules
Violation
A violation found during linting

Enums§

ConfigError
Specialized error type for configuration operations
DocumentError
Specialized error type for document-related operations
MdBookLintError
Main error type for mdbook-lint operations
PluginError
Specialized error type for plugin operations
RuleCategory
Rule categories for grouping and filtering
RuleError
Specialized error type for rule-related operations
RuleStability
Rule stability levels
Severity
Severity levels for violations

Constants§

CLI_DESCRIPTION
Description for CLI
CLI_NAME
Human-readable name for CLI
CLI_VERSION
Current version of mdbook-lint CLI
DESCRIPTION
Description
NAME
Human-readable name
VERSION
Current version of mdbook-lint-core

Traits§

AstRule
Helper trait for AST-based rules
ErrorContext
Error context extension trait for adding contextual information to errors
IntoMdBookLintError
Extension trait for converting specialized errors to MdBookLintError
Rule
Trait that all linting rules must implement
RuleProvider
Trait for rule providers to register rules with the engine

Functions§

create_engine_with_all_rules
Create a lint engine with all available rules (standard + mdBook) Note: Requires mdbook-lint-rulesets dependency for rule providers
create_mdbook_engine
Create a lint engine with only mdBook-specific rules Note: Requires mdbook-lint-rulesets dependency for rule providers
create_standard_engine
Create a lint engine with only standard markdown rules Note: Requires mdbook-lint-rulesets dependency for rule providers

Type Aliases§

MdlntError
Compatibility alias for the old error name
Result
Result type alias for mdbook-lint operations