#syntax-highlighting #documentation #rustdoc #class #lexer #classifier #html

nightly rustdoc-highlight

A Rust syntax highlighting library

10 releases

Uses old Rust 2015

0.1.10 Nov 16, 2019
0.1.9 Aug 18, 2019
0.1.7 Feb 1, 2019
0.1.6 Dec 19, 2018
0.1.1 Mar 26, 2018

#1766 in Development tools

33 downloads per month
Used in cargo-src


347 lines


Rustdoc's syntax highlighting in its own crate for ease of use.




Basic syntax highlighting functionality.

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

If you just want to syntax highlighting for a Rust program, then you can use the render_inner_with_highlighting or render_with_highlighting functions. For more advanced use cases (if you want to supply your own css classes or control how the HTML is generated, or even generate something other then HTML), then you should implement the Writer trait and use a Classifier.