Function rustdoc::html::highlight::write_code[][src]

fn write_code(
    out: &mut Buffer,
    src: &str,
    edition: Edition,
    context_info: Option<ContextInfo<'_, '_, '_>>
)
Expand description

Convert the given src source code into HTML by adding classes for highlighting.

This code is used to render code blocks (in the documentation) as well as the source code pages.

Some explanations on the last arguments:

In case we are rendering a code block and not a source code file, context_info will be None. To put it more simply: if context_info is None, the code won’t try to generate links to an item definition.

More explanations about spans and how we use them here are provided in the