Skip to main content

code_and_link_spans

Function code_and_link_spans 

Source
pub fn code_and_link_spans(
    body: &str,
    format: ContentFormat,
) -> Result<BodySpans>
Expand description

The code spans, the inline-link spans and the image spans of body, in one parse.

All are read off the same node array, because a body-link scan wants each and twig’s parse is the expensive part: crate::link::scan_body_links asked for them separately and so parsed every document’s prose twice, which a profile of check put at 41% of the run. The two lists come back sorted by start offset, each exactly as its single-kind accessor would have returned it.