pub fn extract_sections_in_file(text: &str) -> Vec<Section>Expand description
Extract the ##/### sections of a whole file (frontmatter + body),
returning each Section with line numbered against the source file,
not the body.
extract_sections numbers headings 1-based within the body it is handed —
the right frame for callers that already track the frontmatter offset
(validate adds fm_end_line). But the single-file views (dbmd sections,
dbmd outline) present Section::line as a source line an agent can jump to;
because every db.md file opens with a frontmatter block, the body-relative
number is off by the block’s length (opening fence + frontmatter lines + closing fence) for every file. This helper does the offset once, in the
parser, so those surfaces report true file lines. A file with no leading
frontmatter block is treated as all-body (offset 0), so the function never
fails just because a file lacks frontmatter.