pub struct MarkdownElements;
Expand description
Utility struct for working with Markdown elements
Implementations§
Source§impl MarkdownElements
impl MarkdownElements
Sourcepub fn detect_code_blocks(content: &str) -> Vec<MarkdownElement>
pub fn detect_code_blocks(content: &str) -> Vec<MarkdownElement>
Detect all code blocks in the content
Sourcepub fn detect_code_block_lines(content: &str) -> HashSet<usize>
pub fn detect_code_block_lines(content: &str) -> HashSet<usize>
Detect all code block line indices in the content
Sourcepub fn is_in_code_span(line: &str, position: usize) -> bool
pub fn is_in_code_span(line: &str, position: usize) -> bool
Check if position in a line is within a code span
Sourcepub fn detect_headings(content: &str) -> Vec<MarkdownElement>
pub fn detect_headings(content: &str) -> Vec<MarkdownElement>
Detect all headings in the content
Sourcepub fn get_heading_level(element: &MarkdownElement) -> Option<u32>
pub fn get_heading_level(element: &MarkdownElement) -> Option<u32>
Get heading level (1-6) for a heading element
Sourcepub fn detect_lists(content: &str) -> Vec<MarkdownElement>
pub fn detect_lists(content: &str) -> Vec<MarkdownElement>
Detect all list items in the content
Sourcepub fn detect_front_matter(content: &str) -> Option<MarkdownElement>
pub fn detect_front_matter(content: &str) -> Option<MarkdownElement>
Detect front matter in content
Sourcepub fn heading_to_fragment(text: &str) -> String
pub fn heading_to_fragment(text: &str) -> String
Convert heading text to a valid ID for fragment links
Sourcepub fn is_line_in_code_block(content: &str, line_number: usize) -> bool
pub fn is_line_in_code_block(content: &str, line_number: usize) -> bool
Check if a line is in a code block
Sourcepub fn get_element_line_indices(element: &MarkdownElement) -> Vec<usize>
pub fn get_element_line_indices(element: &MarkdownElement) -> Vec<usize>
Get all line indices in a given Markdown element
Auto Trait Implementations§
impl Freeze for MarkdownElements
impl RefUnwindSafe for MarkdownElements
impl Send for MarkdownElements
impl Sync for MarkdownElements
impl Unpin for MarkdownElements
impl UnwindSafe for MarkdownElements
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