Expand description
bat
is a library to print syntax highlighted content.
The main struct of this crate is PrettyPrinter
which can be used to
configure and run the syntax highlighting.
If you need more control, you can also use the structs in the submodules
(start with controller::Controller
), but note that the API of these
internal modules is much more likely to change. Some or all of these
modules might be removed in the future.
“Hello world” example:
use bat::PrettyPrinter;
PrettyPrinter::new()
.input_from_bytes(b"<span style=\"color: #ff00cc\">Hello world!</span>\n")
.language("html")
.print()
.unwrap();
Modules§
- assets
- assets_
metadata - config
- controller
- error
- input
- line_
range - style
- theme
- Utilities for choosing an appropriate theme for syntax highlighting.
Macros§
Structs§
- Input
- An input source for the pretty printer.
- Pretty
Printer - Syntax
- Syntax
Mapping
Enums§
- Binary
Behavior - How to treat binary content
- Mapping
Target - Nonprintable
Notation - How to print non-printable characters with crate::config::Config::show_nonprintable
- Paging
Mode - Strip
Ansi Mode - Wrapping
Mode