pub struct ElementCache { /* private fields */ }Expand description
Cache for Markdown document structural elements This allows sharing computed data across multiple rule checks
Implementations§
Source§impl ElementCache
impl ElementCache
Sourcepub fn is_valid_for(&self, content: &str) -> bool
pub fn is_valid_for(&self, content: &str) -> bool
Check if this cache is valid for the given content
Sourcepub fn calculate_indentation_width(indent_str: &str, tab_width: usize) -> usize
pub fn calculate_indentation_width(indent_str: &str, tab_width: usize) -> usize
Calculate the visual indentation width of a string, expanding tabs to spaces.
Per CommonMark, tabs expand to the next tab stop (columns 4, 8, 12, …). This means:
- “ \t“ (1 space + tab) → 4 columns
- “ \t“ (2 spaces + tab) → 4 columns
- “ \t“ (3 spaces + tab) → 4 columns
- “\t” (just tab) → 4 columns
- “ “ (4 spaces) → 4 columns
Sourcepub fn calculate_indentation_width_default(indent_str: &str) -> usize
pub fn calculate_indentation_width_default(indent_str: &str) -> usize
Calculate the visual indentation width using default tab width of 4
Sourcepub fn is_in_code_block(&self, line_num: usize) -> bool
pub fn is_in_code_block(&self, line_num: usize) -> bool
Check if a line is within a code block
Sourcepub fn is_in_code_span(&self, position: usize) -> bool
pub fn is_in_code_span(&self, position: usize) -> bool
Check if a position is within a code span
Sourcepub fn is_list_item(&self, line_num: usize) -> bool
pub fn is_list_item(&self, line_num: usize) -> bool
Check if a line is a list item
Sourcepub fn get_list_item(&self, line_num: usize) -> Option<&ListItem>
pub fn get_list_item(&self, line_num: usize) -> Option<&ListItem>
Get list item at line
Sourcepub fn get_list_items(&self) -> &[ListItem]
pub fn get_list_items(&self) -> &[ListItem]
Get all list items
Sourcepub fn get_code_blocks(&self) -> &[CodeBlock]
pub fn get_code_blocks(&self) -> &[CodeBlock]
Get all code blocks
Sourcepub fn get_code_spans(&self) -> &[Range]
pub fn get_code_spans(&self) -> &[Range]
Get all code spans
Trait Implementations§
Source§impl Clone for ElementCache
impl Clone for ElementCache
Source§fn clone(&self) -> ElementCache
fn clone(&self) -> ElementCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ElementCache
impl Debug for ElementCache
Source§impl Default for ElementCache
impl Default for ElementCache
Source§fn default() -> ElementCache
fn default() -> ElementCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ElementCache
impl RefUnwindSafe for ElementCache
impl Send for ElementCache
impl Sync for ElementCache
impl Unpin for ElementCache
impl UnwindSafe for ElementCache
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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