pub struct SectionScanner { /* private fields */ }Expand description
Visitor that builds outline sections from body events. Tracks headings, links, tasks, and code blocks per section.
Implementations§
Source§impl SectionScanner
impl SectionScanner
pub fn new() -> Self
Sourcepub fn into_sections(self) -> Vec<OutlineSection>
pub fn into_sections(self) -> Vec<OutlineSection>
Consume and return all collected sections.
Trait Implementations§
Source§impl Default for SectionScanner
impl Default for SectionScanner
Source§impl FileVisitor for SectionScanner
impl FileVisitor for SectionScanner
Source§fn on_body_line(
&mut self,
raw: &str,
cleaned: &str,
line_num: usize,
) -> ScanAction
fn on_body_line( &mut self, raw: &str, cleaned: &str, line_num: usize, ) -> ScanAction
Called for each body line outside fenced code blocks and comment blocks. Read more
Source§fn on_code_fence_open(
&mut self,
_raw: &str,
language: &str,
_line_num: usize,
) -> ScanAction
fn on_code_fence_open( &mut self, _raw: &str, language: &str, _line_num: usize, ) -> ScanAction
Called when a fenced code block opens (e.g.
```rust).Source§fn on_frontmatter(&mut self, _props: IndexMap<String, Value>) -> ScanAction
fn on_frontmatter(&mut self, _props: IndexMap<String, Value>) -> ScanAction
Called with parsed frontmatter properties (empty
IndexMap if none). Read moreSource§fn on_code_fence_close(&mut self, _line_num: usize) -> ScanAction
fn on_code_fence_close(&mut self, _line_num: usize) -> ScanAction
Called when a fenced code block closes.
Source§fn on_code_block_line(&mut self, _raw: &str, _line_num: usize) -> ScanAction
fn on_code_block_line(&mut self, _raw: &str, _line_num: usize) -> ScanAction
Called for each line inside a fenced code block (between open/close fences).
Default: no-op. Override this to receive code block content.
Source§fn needs_body(&self) -> bool
fn needs_body(&self) -> bool
Whether this visitor needs body events (
on_body_line, on_code_block_line,
on_code_fence_*). If false, the visitor only receives on_frontmatter
and is then stopped. Default: true.Source§fn needs_frontmatter(&self) -> bool
fn needs_frontmatter(&self) -> bool
Whether this visitor needs parsed frontmatter properties.
If no visitor needs frontmatter, the scanner skips YAML accumulation
and
serde_saphyr parsing (but still reads past the --- delimiters).
Default: true.Auto Trait Implementations§
impl Freeze for SectionScanner
impl RefUnwindSafe for SectionScanner
impl Send for SectionScanner
impl Sync for SectionScanner
impl Unpin for SectionScanner
impl UnsafeUnpin for SectionScanner
impl UnwindSafe for SectionScanner
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> 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