1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-04 19:01:44 +00:00

add sanitize option

This commit is contained in:
curious-rabbit
2026-07-01 07:09:49 +02:00
parent 971f9679da
commit d72163160e
15 changed files with 639 additions and 28 deletions
+12
View File
@@ -192,6 +192,18 @@ impl<'a> PrettyPrinter<'a> {
self
}
/// Whether to sanitize untrusted input for safe display (default: never)
///
/// Implies [`strip_ansi`](Self::strip_ansi) at the same value, and also
/// replaces terminal-active and bidi / zero-width bytes with U+FFFD.
pub fn sanitize(&mut self, mode: StripAnsiMode) -> &mut Self {
self.config.sanitize = mode;
if mode != StripAnsiMode::Never {
self.config.strip_ansi = mode;
}
self
}
/// Text wrapping mode (default: do not wrap)
pub fn wrapping_mode(&mut self, mode: WrappingMode) -> &mut Self {
self.config.wrapping_mode = mode;