[go: up one dir, main page]

code_highlighter 0.2.0

Highlights code for printing
Documentation
  • Coverage
  • 0%
    0 out of 7 items documented0 out of 0 items with examples
  • Size
  • Source code size: 68.11 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.53 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • yazaldefilimone/codelighter
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • yazaldefilimone

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:

example

A fork of highlight_error 🥺