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 count_cells_with_flavor(row: &str, flavor: MarkdownFlavor) -> usize
pub fn count_cells_with_flavor(row: &str, flavor: MarkdownFlavor) -> usize
Count the number of cells in a table row with flavor-specific behavior
For Standard/GFM flavor, pipes in inline code ARE cell delimiters (matches GitHub). For MkDocs flavor, pipes in inline code are NOT cell delimiters.
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 escape_pipes_in_inline_code(text: &str) -> String
pub fn escape_pipes_in_inline_code(text: &str) -> String
Escape pipes inside inline code blocks with backslash.
Converts | to \| inside backtick spans.
Used by auto-fix to preserve content while making tables valid.
Sourcepub fn mask_pipes_for_table_parsing(text: &str) -> String
pub fn mask_pipes_for_table_parsing(text: &str) -> String
Mask escaped pipes for accurate table cell parsing
In GFM tables, escape handling happens BEFORE cell boundary detection:
\|→ escaped pipe → masked (stays as cell content)\\|→ escaped backslash + pipe → NOT masked (pipe is a delimiter)
IMPORTANT: Inline code spans do NOT protect pipes in GFM tables!
The pipe in `a | b` still acts as a cell delimiter, splitting into
two cells: `a and b ``. This matches GitHub’s actual rendering.
To include a literal pipe in a table cell (even in code), you must escape it:
`a \| b` → single cell containing a | b (with code formatting)
Sourcepub fn split_table_row_with_flavor(
row: &str,
flavor: MarkdownFlavor,
) -> Vec<String>
pub fn split_table_row_with_flavor( row: &str, flavor: MarkdownFlavor, ) -> Vec<String>
Split a table row into individual cell contents with flavor-specific behavior.
Returns a Vec of cell content strings (not trimmed - preserves original spacing). This is the foundation for both cell counting and cell content extraction.
For Standard/GFM flavor, pipes in inline code ARE cell delimiters (matches GitHub). For MkDocs flavor, pipes in inline code are NOT cell delimiters.
Sourcepub fn split_table_row(row: &str) -> Vec<String>
pub fn split_table_row(row: &str) -> Vec<String>
Split a table row into individual cell contents using Standard/GFM behavior.
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