pub struct MD044ProperNames { /* private fields */ }Expand description
Rule MD044: Proper names should be capitalized
See docs/md044.md for full documentation, configuration, and examples.
This rule is triggered when proper names are not capitalized correctly in the document. For example, if you have defined “JavaScript” as a proper name, the rule will flag any occurrences of “javascript” or “Javascript” as violations.
§Purpose
Ensuring consistent capitalization of proper names improves document quality and professionalism. This is especially important for technical documentation where product names, programming languages, and technologies often have specific capitalization conventions.
§Configuration Options
The rule supports the following configuration options:
MD044:
names: [] # List of proper names to check for correct capitalization
code-blocks: false # Whether to check code blocks (default: false)Example configuration:
MD044:
names: ["JavaScript", "Node.js", "TypeScript"]
code-blocks: true§Performance Optimizations
This rule implements several performance optimizations:
- Regex Caching: Pre-compiles and caches regex patterns for each proper name
- Content Caching: Caches results based on content hashing for repeated checks
- Efficient Text Processing: Uses optimized algorithms to avoid redundant text processing
- Smart Code Block Detection: Efficiently identifies and optionally excludes code blocks
§Edge Cases Handled
- Word Boundaries: Only matches complete words, not substrings within other words
- Case Sensitivity: Properly handles case-specific matching
- Code Blocks: Optionally checks code blocks (controlled by code-blocks setting)
- Markdown Formatting: Handles proper names within Markdown formatting elements
§Fix Behavior
When fixing issues, this rule replaces incorrect capitalization with the correct form as defined in the configuration.
Implementations§
Trait Implementations§
Source§impl Clone for MD044ProperNames
impl Clone for MD044ProperNames
Source§fn clone(&self) -> MD044ProperNames
fn clone(&self) -> MD044ProperNames
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Rule for MD044ProperNames
impl Rule for MD044ProperNames
fn name(&self) -> &'static str
fn description(&self) -> &'static str
Source§fn should_skip(&self, ctx: &LintContext<'_>) -> bool
fn should_skip(&self, ctx: &LintContext<'_>) -> bool
fn check(&self, ctx: &LintContext<'_>) -> LintResult
fn fix(&self, ctx: &LintContext<'_>) -> Result<String, LintError>
fn as_any(&self) -> &dyn Any
Source§fn default_config_section(&self) -> Option<(String, Value)>
fn default_config_section(&self) -> Option<(String, Value)>
impl Rule for ... block,
not just the inherent impl.Source§fn from_config(config: &Config) -> Box<dyn Rule>where
Self: Sized,
fn from_config(config: &Config) -> Box<dyn Rule>where
Self: Sized,
Source§fn category(&self) -> RuleCategory
fn category(&self) -> RuleCategory
Source§fn config_aliases(&self) -> Option<HashMap<String, String>>
fn config_aliases(&self) -> Option<HashMap<String, String>>
Source§fn fix_capability(&self) -> FixCapability
fn fix_capability(&self) -> FixCapability
Source§fn cross_file_scope(&self) -> CrossFileScope
fn cross_file_scope(&self) -> CrossFileScope
Source§fn contribute_to_index(
&self,
_ctx: &LintContext<'_>,
_file_index: &mut FileIndex,
)
fn contribute_to_index( &self, _ctx: &LintContext<'_>, _file_index: &mut FileIndex, )
Source§fn cross_file_check(
&self,
_file_path: &Path,
_file_index: &FileIndex,
_workspace_index: &WorkspaceIndex,
) -> LintResult
fn cross_file_check( &self, _file_path: &Path, _file_index: &FileIndex, _workspace_index: &WorkspaceIndex, ) -> LintResult
Auto Trait Implementations§
impl Freeze for MD044ProperNames
impl RefUnwindSafe for MD044ProperNames
impl Send for MD044ProperNames
impl Sync for MD044ProperNames
impl Unpin for MD044ProperNames
impl UnwindSafe for MD044ProperNames
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more