pub struct DocTree {
pub frontmatter: Option<Frontmatter>,
pub body: String,
pub root: SectionNode,
}Expand description
The projected document: the frontmatter block (when present), the verbatim body
after it, and the synthetic root whose sections are the top-level body sections and whose
name is the leading-H1 title.
Fields§
§frontmatter: Option<Frontmatter>the leading --- YAML block, position-aware; None when absent
body: Stringverbatim source body after the frontmatter block (the whole doc when none)
root: SectionNodesynthetic root (depth 1); root.sections are the top-level body sections
Implementations§
Source§impl DocTree
impl DocTree
Sourcepub fn section_by_heading_path(&self, path: &[&str]) -> Option<Range<usize>>
pub fn section_by_heading_path(&self, path: &[&str]) -> Option<Range<usize>>
The section that a heading path names, as a byte range in
Self::body, trimmed. Obsidian’s rules, not the tree’s: every
heading counts, the first H1 included, and the segments before the
last must be the nearest headings above it. See crate::select.
Sourcepub fn section_by_selector(&self, selector: &str) -> Option<Range<usize>>
pub fn section_by_selector(&self, selector: &str) -> Option<Range<usize>>
The section a link fragment’s heading selector (Heading,
Parent#Child, or a heading whose text holds #) names, as a byte
range in Self::body. See crate::select::heading_range.
Sourcepub fn block_range_by_id(&self, id: &str) -> Option<Range<usize>>
pub fn block_range_by_id(&self, id: &str) -> Option<Range<usize>>
The text a ^id block marker labels, as a byte range in
Self::body, marker excluded. See crate::select::block_range.
Sourcepub fn block_by_id(&self, id: &str) -> Option<&BlockNode>
pub fn block_by_id(&self, id: &str) -> Option<&BlockNode>
The projected block bound to ^id, in any section, depth first.