pub struct MarkdownParser<'a> { /* private fields */ }Implementations§
Source§impl<'a> MarkdownParser<'a>
impl<'a> MarkdownParser<'a>
pub fn new(content: &'a str) -> Self
pub fn content(&self) -> &'a str
pub fn lines(&self) -> &[&'a str]
pub fn line_count(&self) -> usize
pub fn get_line(&self, line_num: usize) -> Option<&'a str>
pub fn parse(&self) -> impl Iterator<Item = Event<'a>> + 'a
pub fn parse_with_offsets( &self, ) -> impl Iterator<Item = (Event<'a>, Range<usize>)>
Sourcepub fn parse_with_broken_links(
&self,
) -> impl Iterator<Item = (Event<'a>, Range<usize>)> + 'a
pub fn parse_with_broken_links( &self, ) -> impl Iterator<Item = (Event<'a>, Range<usize>)> + 'a
Like parse_with_offsets, but resolves otherwise-broken reference links
(undefined labels) by flagging their LinkType as the corresponding
*Unknown variant instead of silently dropping the event as plain text.
Used by rules that need to detect undefined reference links/images.
pub fn offset_to_line(&self, offset: usize) -> usize
pub fn offset_to_position(&self, offset: usize) -> (usize, usize)
Sourcepub fn get_code_line_numbers(&self) -> &HashSet<usize>
pub fn get_code_line_numbers(&self) -> &HashSet<usize>
Returns the 1-indexed line numbers inside code blocks or inline code.
Result is precomputed in new() — O(1) to access.
Sourcepub fn get_code_block_line_numbers(&self) -> &HashSet<usize>
pub fn get_code_block_line_numbers(&self) -> &HashSet<usize>
Returns the 1-indexed line numbers inside code blocks only (not inline spans).
Result is precomputed in new() — O(1) to access.
Sourcepub fn get_code_ranges(&self) -> &[Range<usize>]
pub fn get_code_ranges(&self) -> &[Range<usize>]
Returns byte ranges (into the original content) for all code blocks and
inline code spans. Result is precomputed in new() — O(1) to access.
Sourcepub fn get_ref_def_line_numbers(&self) -> &HashSet<usize>
pub fn get_ref_def_line_numbers(&self) -> &HashSet<usize>
Returns the 1-indexed line numbers that form link reference definitions
([label]: url). Result is precomputed in new() — O(1) to access.
Sourcepub fn get_ref_defs(&self) -> &HashMap<String, usize>
pub fn get_ref_defs(&self) -> &HashMap<String, usize>
Returns a map of normalised (lowercase) label → 1-indexed line number for every link reference definition in the document.
Sourcepub fn line_offset_to_absolute(
&self,
line_num: usize,
byte_offset_in_line: usize,
) -> usize
pub fn line_offset_to_absolute( &self, line_num: usize, byte_offset_in_line: usize, ) -> usize
Converts a (1-indexed) line number and 0-indexed byte offset within that line to an absolute byte offset in the content.