1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! The `LintRule` trait — `mdwright`'s open extension point.
//!
//! A rule is any `Send + Sync` value that names itself, describes
//! itself, and inspects a [`Document`] to produce [`Diagnostic`]s.
//! The standard library in [`crate::stdlib`] ships fifteen
//! implementors; user code adds more by implementing this trait on
//! a struct and dropping it into a [`RuleSet`](crate::RuleSet).
//!
//! ## Identity
//!
//! Each rule carries a stable kebab-case name. The name is the
//! identifier used in CLI flags (`--rules orphan-reference-link`),
//! configuration files, suppression comments, and diagnostic output.
//! Names must be unique within any `RuleSet` — duplicate insertion
//! fails (see [`RuleSet::add`](crate::RuleSet::add)).
//!
//! ## Emit pattern
//!
//! Rule implementations append [`Diagnostic`]s to the supplied
//! `Vec`. They should leave the diagnostic's `rule` field empty —
//! the dispatcher stamps it from `self.name()` after the call
//! returns, so rule code does not repeat its own name on every emit.
use crateDiagnostic;
use Document;
/// A lint check. Implementors may be unit structs (stdlib rules) or
/// carry configuration (regex patterns, allowlists, …).