Module rustdoc::html::highlight [−][src]
Expand description
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
Processes program tokens, classifying strings of text by highlighting
category (Class
).
This type is needed in case we want to render links on items to allow to go to their definition.
This iterator comes from the same idea than “Peekable” except that it allows to “peek” more than
just the next item by using peek_next
. The peek
method always returns the next item after
the current one whereas peek_next
will return the next item after the last one peeked.
Enums
Functions
Called when we start processing a span of text that should be highlighted.
The Class
argument specifies how it should be highlighted.
Called at the end of a span of highlighted text.
Classifies into identifier class; returns None
if this is a non-keyword identifier.
Highlights src
, returning the HTML output.
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
.
Convert the given src
source code into HTML by adding classes for highlighting.