on sponsor help sign in
bat/src/lib.rs
57 lines 1.4 kB history raw
1//! `bat` is a library to print syntax highlighted content.
2//!
3//! The main struct of this crate is `PrettyPrinter` which can be used to
4//! configure and run the syntax highlighting.
5//!
6//! If you need more control, you can also use the structs in the submodules
7//! (start with `controller::Controller`), but note that the API of these
8//! internal modules is much more likely to change. Some or all of these
9//! modules might be removed in the future.
10//!
11//! "Hello world" example:
12//! ```
13//! use bat::PrettyPrinter;
14//!
15//! PrettyPrinter::new()
16//! .input_from_bytes(b"<span style=\"color: #ff00cc\">Hello world!</span>\n")
17//! .language("html")
18//! .print()
19//! .unwrap();
20//! ```
22#![deny(unsafe_code)]
24mod macros;
26pub mod assets;
27pub mod assets_metadata {
28 pub use super::assets::assets_metadata::*;
30pub mod config;
31pub mod controller;
32mod decorations;
33mod diff;
34pub mod error;
35pub mod input;
36mod less;
37pub mod line_range;
38mod output;
39#[cfg(feature = "paging")]
40mod pager;
41#[cfg(feature = "paging")]
42pub(crate) mod paging;
43mod preprocessor;
44mod pretty_printer;
45pub(crate) mod printer;
46pub mod style;
47pub(crate) mod syntax_mapping;
48mod terminal;
49mod vscreen;
50pub(crate) mod wrapping;
52pub use pretty_printer::{Input, PrettyPrinter};
53pub use syntax_mapping::{MappingTarget, SyntaxMapping};
54pub use wrapping::WrappingMode;
56#[cfg(feature = "paging")]
57pub use paging::PagingMode;