Skip to main content

parse_heading_line

Function parse_heading_line 

Source
pub fn parse_heading_line(line: &str) -> Option<HeadingLine>
Expand description

Locate the parts of a heading line, or return None when line is not a heading.

Applies the same keyword and priority grammars as the extraction path, so a heading the extractor reads one way cannot be rewritten another way. See HeadingLine for what the result addresses and why it keeps text the agenda drops.

let line = "## TODO [#A] Write the report";
let heading = parse_heading_line(line).expect("a heading");
assert_eq!(&line[heading.priority.expect("a cookie").range], "[#A]");