Skip to main content

parse_at

Function parse_at 

Source
pub fn parse_at(source: &str, offset: usize, marks: &Marks) -> (Doc, Cursor)
Expand description

Parse markdown, and say where offset in it landed in the document.

The inverse of crate::serialize_at and the same trick: a sentinel goes into the source at the offset, the source is parsed, and the text holding the sentinel is the caret’s. The document comes back without it.

The caret is the start of the document where the sentinel would have changed what the source means — between a # and its space, inside a fence’s delimiter — because a caret in the right place is worth less than a document that is still the one you were editing.