2 unstable releases
0.2.0 | Sep 6, 2024 |
---|---|
0.1.1 | Jul 26, 2024 |
#682 in Programming languages
Used in stella_checker
55KB
129 lines
Rust util that highlights an error.
Example
The code below:
let code = "functon is_zero (x) {
if (x == 0) [
return true;
] else {
return false;
}
}";
println!("Error:");
println!("{}", code_highlighter::highlight_error(38, 64, &code));
println!("");
println!("Warning:");
println!("{}", code_highlighter::highlight_warning(38, 64, &code));
println!("");
println!("Custom color:");
println!("{}", code_highlighter::highlight(38, 64, &code, "\x1b[4m\x1b[32m"));
println!("");
let code = "(Foo x) = 7[0 ]\n";
println!("Error:");
println!("{}", code_highlighter::highlight_error(16, 17, &code));
println!("");
Will output:
A fork of highlight_error 🥺