[workspace]
members = ["crates/gilt-derive", "crates/gilt-cli", "crates/gilt-vhs"]

[package]
name = "gilt"
version = "2.1.0"
edition = "2021"
exclude = [".claude/", ".review/", "vlc.zip"]
description = "Fast, beautiful terminal formatting for Rust — styles, tables, trees, syntax highlighting, progress bars, markdown."
license = "MIT"
repository = "https://github.com/khalidelborai/gilt"
homepage = "https://github.com/khalidelborai/gilt"
documentation = "https://docs.rs/gilt"
readme = "README.md"
keywords = ["terminal", "rich", "formatting", "ansi", "cli"]
categories = ["command-line-interface", "text-processing"]
rust-version = "1.82.0"

[dependencies]
thiserror = "2"
unicode-width = "0.2"
unicode-segmentation = "1"
regex = "1"
serde = { version = "1", optional = true }
serde_json = { version = "1", optional = true }
pulldown-cmark = { version = "0.12", optional = true }
log = { version = "0.4", features = ["std"], optional = true }
syntect = { version = "5", default-features = false, features = ["default-syntaxes", "default-themes", "regex-fancy"], optional = true }
rpassword = { version = "7", optional = true }
gilt-derive = { version = "2.1.0", path = "crates/gilt-derive", optional = true }
tracing = { version = "0.1", optional = true }
tracing-subscriber = { version = "0.3", features = ["registry"], optional = true }
miette = { version = "7", optional = true }
eyre = { version = "0.6", optional = true }
rustyline = { version = "15", optional = true }
anstyle = { version = "1", optional = true }
csv = { version = "1", optional = true }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "fs", "io-util"], optional = true }
reqwest = { version = "0.12", features = ["json", "stream"], optional = true }
futures-core = { version = "0.3", optional = true }
futures-util = { version = "0.3", optional = true }
bytes = { version = "1", optional = true }
compact_str = "0.8"
lru = "0.12"
arc-swap = "1"
terminal_size = { version = "0.4", optional = true }
image = { version = "0.25", default-features = false, features = ["png", "jpeg"], optional = true }
crossterm = { version = "0.28", optional = true }

[features]
default = ["json", "markdown", "syntax", "interactive", "logging", "terminal-size"]
json = ["dep:serde", "dep:serde_json"]
markdown = ["dep:pulldown-cmark"]
syntax = ["dep:syntect"]
# Opt-in: load .tmTheme files via syntect's plist loader (native only).
# Kept out of the default `syntax` path because `plist` pulls `time`, which
# would bloat the default dep tree and break MSRV 1.82.
syntax-theme-file = ["syntax", "syntect/plist-load"]
interactive = ["dep:rpassword"]
logging = ["dep:log"]
# Real terminal size detection via ioctl on native targets. Enabled by default.
# Disable (e.g. `default-features = false`) for wasm / pure-env-detection builds.
terminal-size = ["dep:terminal_size"]
tracing = ["dep:tracing", "dep:tracing-subscriber"]
derive = ["dep:gilt-derive"]
miette = ["dep:miette"]
eyre = ["dep:eyre"]
readline = ["dep:rustyline"]
anstyle = ["dep:anstyle"]
csv = ["dep:csv"]
async = ["dep:tokio", "dep:futures-core", "dep:futures-util"]
# Opt-in: enable Windows VT processing (ENABLE_VIRTUAL_TERMINAL_PROCESSING).
# Pulls windows-sys only on Windows targets; the cfg(windows) body is excluded
# on non-Windows hosts so the build is always clean without it.
windows-vt = ["dep:windows-sys"]
http = ["dep:reqwest", "dep:bytes", "async", "json"]
asciinema = ["json"]
# Opt-in: inline terminal images via Kitty/Sixel/halfblock protocols.
# Adds the `image` crate (PNG + JPEG decoders) for `Image::from_path` /
# `Image::from_bytes`. The halfblock renderer and `Image::from_rgba` are
# always available even without this feature.
inline-images = ["dep:image"]
# Opt-in: interactive fuzzy/substring single-select with arrow-key navigation.
# Pulls crossterm (raw mode, key events) only when this feature is enabled.
# NOT in default — keeps gilt dep-light for most users.
tty-select = ["dep:crossterm"]
# Opt-in: probe the terminal background colour via OSC 11 (native only).
# Uses crossterm for raw-mode I/O. On non-supporting terminals or on
# timeout, returns ConsoleBackground::Unknown. The pure parsing/luminance
# core (parse_osc11_response, is_dark_background, ConsoleBackground) is
# always available without this feature.
terminal-query = ["dep:crossterm"]

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.59", features = ["Win32_System_Console", "Win32_Foundation"], optional = true }

[dev-dependencies]
pretty_assertions = "1"
criterion = { version = "0.5", features = ["html_reports"] }
proptest = "1"

[[example]]
name = "gen_readme_demos"
required-features = ["markdown", "syntax"]

[[example]]
name = "live_markdown"
required-features = ["markdown"]

[[example]]
name = "text_macro"
required-features = ["derive"]

[[example]]
name = "asciinema_export"
required-features = ["asciinema"]

[[example]]
name = "themed_console"
required-features = ["json"]

[[example]]
name = "form"
required-features = ["interactive"]

[[example]]
name = "auto_theme"
required-features = ["terminal-query"]

[[bench]]
name = "benchmarks"
harness = false

[[bench]]
name = "live_threaded"
harness = false
