rustc_errors::markdown::parse

Function expand_plaintext

Source
fn expand_plaintext<'a>(
    txt: &'a str,
    stream: &mut Vec<MdTree<'a>>,
    f: fn(_: &'a str) -> MdTree<'a>,
)
Expand description

Perform transformations to text. This splits paragraphs, replaces patterns, and corrects newlines.

To avoid allocating strings (and using a different heavier tt type), our replace method means split into three and append each. For this reason, any viewer should treat consecutive PlainText types as belonging to the same paragraph.