pub struct CodeBlockUtils;
Expand description
Utility functions for detecting and handling code blocks in Markdown
Implementations§
Source§impl CodeBlockUtils
impl CodeBlockUtils
Sourcepub fn detect_code_blocks(content: &str) -> Vec<(usize, usize)>
pub fn detect_code_blocks(content: &str) -> Vec<(usize, usize)>
Detect all code blocks in the content
Sourcepub fn is_in_code_block_or_span(blocks: &[(usize, usize)], pos: usize) -> bool
pub fn is_in_code_block_or_span(blocks: &[(usize, usize)], pos: usize) -> bool
Check if a position is within a code block or code span
Sourcepub fn analyze_code_block_context(
lines: &[LineInfo],
line_idx: usize,
min_continuation_indent: usize,
) -> CodeBlockContext
pub fn analyze_code_block_context( lines: &[LineInfo], line_idx: usize, min_continuation_indent: usize, ) -> CodeBlockContext
Analyze code block context relative to list parsing This is the core function implementing Design #3’s three-tier classification
Sourcepub fn calculate_min_continuation_indent(
lines: &[LineInfo],
current_line_idx: usize,
) -> usize
pub fn calculate_min_continuation_indent( lines: &[LineInfo], current_line_idx: usize, ) -> usize
Calculate minimum indentation required for code block to continue a list Based on the most recent list item’s marker width
Auto Trait Implementations§
impl Freeze for CodeBlockUtils
impl RefUnwindSafe for CodeBlockUtils
impl Send for CodeBlockUtils
impl Sync for CodeBlockUtils
impl Unpin for CodeBlockUtils
impl UnwindSafe for CodeBlockUtils
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> 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