7 releases

0.3.2 Sep 9, 2022
0.3.1 Feb 11, 2022
0.2.0 Dec 14, 2021
0.1.2 May 18, 2021

#25 in #highlight

21 downloads per month

MIT license

129MB
4M SLoC

C 4M SLoC // 0.0% comments JavaScript 14K SLoC // 0.0% comments C++ 2.5K SLoC // 0.0% comments Scheme 2K SLoC // 0.1% comments Rust 520 SLoC // 0.0% comments

treelight

Version Downloads License Docs crev reviews

A syntax highlighter for the web using tree-sitter.

use treelight::*;

let code = r#"
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ResponseError {
    #[error("api error {0}")]
    ApiError(#[from] PaypalError),
    #[error("http error {0}")]
    HttpError(#[from] reqwest::Error)
}
"#;

let result = highlight_to_html(Language::Rust, code);
println!("{}", result);

License: MIT


lib.rs:

Version Downloads License Docs crev reviews

A syntax highlighter for the web using tree-sitter.

use treelight::*;

let code = r#"
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ResponseError {
    #[error("api error {0}")]
    ApiError(#[from] PaypalError),
    #[error("http error {0}")]
    HttpError(#[from] reqwest::Error)
}
"#;

let result = highlight_to_html(Language::Rust, code);
println!("{}", result);

Dependencies

~3–5MB
~95K SLoC