mirror of
https://github.com/sharkdp/bat.git
synced 2025-03-14 14:48:39 +00:00
We can't keep `syntect::parsing::SyntaxReference` as part of the public API, because that might prevent us from bumping to syntect 6.0.0 without also bumping bat to v2.0.0, once we reach v1.0.0. So introduce a new stripped down struct `Syntax` and return that instead. Let it be fully owned to make the API simple. It is not going to be in a hot code path anyway. I have looked at all code of our 27 dependents but I can't find a single instance of this method being used, so this change should be safe for v1.0.0.
57 lines
1.4 KiB
Rust
57 lines
1.4 KiB
Rust
//! `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();
|
|
//! ```
|
|
|
|
#![deny(unsafe_code)]
|
|
|
|
mod macros;
|
|
|
|
pub mod assets;
|
|
pub mod assets_metadata {
|
|
pub use super::assets::assets_metadata::*;
|
|
}
|
|
pub mod config;
|
|
pub mod controller;
|
|
mod decorations;
|
|
mod diff;
|
|
pub mod error;
|
|
pub mod input;
|
|
mod less;
|
|
pub mod line_range;
|
|
mod output;
|
|
#[cfg(feature = "paging")]
|
|
mod pager;
|
|
#[cfg(feature = "paging")]
|
|
pub(crate) mod paging;
|
|
mod preprocessor;
|
|
mod pretty_printer;
|
|
pub(crate) mod printer;
|
|
pub mod style;
|
|
pub(crate) mod syntax_mapping;
|
|
mod terminal;
|
|
pub(crate) mod wrapping;
|
|
|
|
pub use pretty_printer::{Input, PrettyPrinter, Syntax};
|
|
pub use syntax_mapping::{MappingTarget, SyntaxMapping};
|
|
pub use wrapping::WrappingMode;
|
|
|
|
#[cfg(feature = "paging")]
|
|
pub use paging::PagingMode;
|