[−][src]Module rustdoc::html::highlight

Basic syntax highlighting functionality.

This module uses librustc_ast's lexer to provide token-based highlighting for the HTML documentation generated by rustdoc.

Use the render_with_highlighting to highlight some rust code.

Structs

Classifier

Processes program tokens, classifying strings of text by highlighting category (Class).

TokenIter

Enums

Class

How a span of text is classified. Mostly corresponds to token kinds.

Highlight

Functions

enter_span

Called when we start processing a span of text that should be highlighted. The Class argument specifies how it should be highlighted.

exit_span

Called at the end of a span of highlighted text.

render_with_highlighting

Highlights src, returning the HTML output.

string

Called for a span of text. If the text should be highlighted differently from the surrounding text, then the Class argument will be a value other than None.

write_code
write_footer
write_header