pub struct TableUtils;Expand description
Shared table detection utilities
Implementations§
Source§impl TableUtils
impl TableUtils
Sourcepub fn is_potential_table_row(line: &str) -> bool
pub fn is_potential_table_row(line: &str) -> bool
Check if a line looks like a potential table row
Sourcepub fn is_delimiter_row(line: &str) -> bool
pub fn is_delimiter_row(line: &str) -> bool
Check if a line is a table delimiter row (e.g., |—|—|)
Sourcepub fn find_table_blocks_with_code_info(
content: &str,
code_blocks: &[(usize, usize)],
code_spans: &[CodeSpan],
html_comment_ranges: &[ByteRange],
) -> Vec<TableBlock>
pub fn find_table_blocks_with_code_info( content: &str, code_blocks: &[(usize, usize)], code_spans: &[CodeSpan], html_comment_ranges: &[ByteRange], ) -> Vec<TableBlock>
Find all table blocks in the content with optimized detection This version accepts code_blocks and code_spans directly for use during LintContext construction
Sourcepub fn find_table_blocks(
content: &str,
ctx: &LintContext<'_>,
) -> Vec<TableBlock>
pub fn find_table_blocks( content: &str, ctx: &LintContext<'_>, ) -> Vec<TableBlock>
Find all table blocks in the content with optimized detection This is a backward-compatible wrapper that accepts LintContext
Sourcepub fn count_cells(row: &str) -> usize
pub fn count_cells(row: &str) -> usize
Count the number of cells in a table row
Sourcepub fn mask_pipes_in_inline_code(text: &str) -> String
pub fn mask_pipes_in_inline_code(text: &str) -> String
Mask pipes inside inline code blocks with a placeholder character
Sourcepub fn mask_pipes_for_table_parsing(text: &str) -> String
pub fn mask_pipes_for_table_parsing(text: &str) -> String
Mask both inline code pipes AND escaped pipes for accurate table cell parsing
This function combines two types of masking:
- Pipes inside inline code blocks (between backticks) → masked as ‘_’
- Escaped pipes
\|→ masked as\_(backslash + underscore)
This allows split('|') to correctly identify cell boundaries without
accidentally splitting on:
- Literal pipes inside code:
| a | b |→ treated as single cell - Escaped pipes:
a \| b→ treated as single cell containing literal pipe
The original text is reconstructed from byte offsets, so these masks only affect where we split, not the actual cell content.
Sourcepub fn determine_pipe_style(line: &str) -> Option<&'static str>
pub fn determine_pipe_style(line: &str) -> Option<&'static str>
Determine the pipe style of a table row
Auto Trait Implementations§
impl Freeze for TableUtils
impl RefUnwindSafe for TableUtils
impl Send for TableUtils
impl Sync for TableUtils
impl Unpin for TableUtils
impl UnwindSafe for TableUtils
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> 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