fn write_code(
    out: &mut Buffer,
    src: &str,
    edition: Edition,
    context_info: Option<ContextInfo<'_, '_, '_>>,
    decoration_info: Option<DecorationInfo>,
) {
    // This replace allows to fix how the code source with DOS backline characters is displayed.
    let src = src.replace("\r\n", "\n");
    Classifier::new(
        &src,
        edition,
        context_info.as_ref().map(|c| c.file_span).unwrap_or(DUMMY_SP),
        decoration_info,
    )
    .highlight(&mut |highlight| {
        match highlight {
            Highlight::Token { text, class } => string(out, Escape(text), class, &context_info),
            Highlight::EnterSpan { class } => enter_span(out, class),
            Highlight::ExitSpan => exit_span(out),
        };
    });
}
/// 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
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
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
fn write_code(
    out: &mut Buffer,
    src: &str,
    edition: Edition,
    context_info: Option<ContextInfo<'_, '_, '_>>,
    decoration_info: Option<DecorationInfo>,
) {
    // This replace allows to fix how the code source with DOS backline characters is displayed.
    let src = src.replace("\r\n", "\n");
    Classifier::new(
        &src,
        edition,
        context_info.as_ref().map(|c| c.file_span).unwrap_or(DUMMY_SP),
        decoration_info,
    )
    .highlight(&mut |highlight| {
        match highlight {
            Highlight::Token { text, class } => string(out, Escape(text), class, &context_info),
            Highlight::EnterSpan { class } => enter_span(out, class),
            Highlight::ExitSpan => exit_span(out),
        };
    });
}
fn write_code ( out : & mut Buffer , src : & str , edition : Edition , context_info : Option < ContextInfo < ' _ , ' _ , ' _ > > , decoration_info : Option < DecorationInfo > , ) { // This replace allows to fix how the code source with DOS backline characters is displayed. let src = src . replace ( " \r \n " , " \n " ) ; Classifier :: new ( & src , edition , context_info . as_ref ( ) . map ( | c | c . file_span ) . unwrap_or ( DUMMY_SP ) , decoration_info , ) . highlight ( & mut | highlight | { match highlight { Highlight :: Token { text , class } => string ( out , Escape ( text ) , class , & context_info ) , Highlight :: EnterSpan { class } => enter_span ( out , class ) , Highlight :: ExitSpan => exit_span ( out ) , } ; } ) ; }
Convert the given `src` source code into HTML by adding classes for highlighting.
Convert the given ` src ` source code into HTML by adding classes for highlighting .
out
&mut Buffer
src
&str
edition
Edition
context_info
Option<ContextInfo<'_, '_, '_>>
decoration_info
Option<DecorationInfo>
out
&mut Buffer
src
&str
edition
Edition
context_info
Option<ContextInfo<'_, '_, '_>>
decoration_info
Option<DecorationInfo>