syntaxmate 0.2.1

Rust-native TextMate syntax highlighting with bundled grammars and themes
Documentation
1
2
3
4
5
6
7
8
9
10
use syntaxmate::Highlighter;

fn main() -> syntaxmate::Result<()> {
    let source = "fn main() { println!(\"hello\"); }";
    let highlighter = Highlighter::bundled()?;
    let output = highlighter.highlight_ansi("rust", source, "github-dark")?;
    assert!(output.status().is_complete());
    println!("{}", output.as_str());
    Ok(())
}