writ 0.17.2

A hybrid markdown editor combining raw text editing with live inline rendering
Documentation
[package]
name = "writ"
version = "0.17.2"
description = "A hybrid markdown editor combining raw text editing with live inline rendering"
authors = ["Wilfred Denton <wilfred@hey.com>"]
license = "MIT"
edition = "2024"
repository = "https://github.com/wilfreddenton/writ"
homepage = "https://github.com/wilfreddenton/writ"
documentation = "https://docs.rs/writ"

[package.metadata.docs.rs]
all-features = true

[lints.clippy]
too_many_arguments = "allow"

[lib]
name = "writ"
path = "src/lib.rs"

# The editor: winit + wgpu + Vello + Parley shell (formerly the gpui app).
[[bin]]
name = "writ"
path = "src/bin/writ_next.rs"
required-features = ["app"]

[[bin]]
name = "writd"
path = "src/writd.rs"
required-features = ["ghosttext"]

[features]
default = ["app"]

# internal: shared async + HTTP substrate (underscore = not meant for à-la-carte use)
_net = ["dep:tokio", "dep:reqwest", "dep:rustls", "dep:serde_json"]

git = ["dep:gix"]
github = ["_net"]
watch = ["dep:notify", "dep:notify-debouncer-full"]
remote-images = ["_net"]

# render ```mermaid fences as diagrams (native SVG via mermaid-rs-renderer → writ's resvg)
mermaid = ["dep:mermaid-rs-renderer"]

# render LaTeX math ($…$ / $$…$$) via RaTeX (parse→layout→tiny-skia PNG, embedded fonts)
math = ["dep:ratex-parser", "dep:ratex-layout", "dep:ratex-render", "dep:ratex-types"]

# the full core::Editor orchestration hub (diff-from-HEAD + GitHub + file watch)
editor = ["git", "github", "watch"]

# the desktop editor application (winit shell). implies editor.
app = ["editor", "remote-images", "mermaid", "math", "dep:winit", "dep:arboard", "dep:open", "dep:clap", "dep:toml", "dep:dirs"]

# the GhostText daemon (writd binary)
ghosttext = ["app", "dep:tokio-tungstenite", "dep:futures"]

[dependencies]
anyhow = "1"
clap = { version = "4.5", features = ["derive", "env"], optional = true }
futures = { version = "0.3", optional = true }
imara-diff = "0.2"
gix = { version = "0.84", default-features = false, features = ["sha1"], optional = true }
arboard = { version = "3", default-features = false, features = ["wayland-data-control"], optional = true }
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "gif", "webp"] }
# Native mermaid → SVG. `default-features=false` drops its `png` feature (which pulls
# resvg 0.47, conflicting with our 0.46); we feed its SVG string into our own resvg.
mermaid-rs-renderer = { version = "0.3", default-features = false, optional = true }
# LaTeX math → raster (tiny-skia, embedded KaTeX fonts; no resvg — see `math` feature).
ratex-parser = { version = "0.1.12", optional = true }
ratex-layout = { version = "0.1.12", optional = true }
ratex-render = { version = "0.1.12", features = ["embed-fonts"], optional = true }
ratex-types = { version = "0.1.12", optional = true }
# SVG rasterization (badges etc.); default features pull in text + system-fonts,
# needed to render `<text>` labels in shields.io-style badges.
resvg = "0.46"
# --- Linebender rendering stack (see MIGRATION-PLAN.md). `wgpu` is NOT a direct
# dep — we use `vello::wgpu` so there is a single wgpu in the tree. ---
parley = "0.11"
vello = "0.9"
winit = { version = "0.30", optional = true }
fontique = { version = "0.11", features = ["fontconfig-dlopen"] }
pollster = "0.4"
notify = { version = "8.2", optional = true }
open = { version = "5", optional = true }
regex = "1.12.2"
reqwest = { version = "0.13", default-features = false, features = ["http2", "rustls", "json"], optional = true }
ropey = "1.6"
rustls = { version = "0.23.36", features = ["ring"], optional = true }
unicode-segmentation = "1.13"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", optional = true }
toml = { version = "0.8", optional = true }
dirs = { version = "5", optional = true }
tokio = { version = "1", features = ["full"], optional = true }
tokio-tungstenite = { version = "0.29", optional = true }
tree-sitter = "0.26"
tree-sitter-bash = "0.25"
tree-sitter-highlight = "0.26"
tree-sitter-md = "0.5"
tree-sitter-rust = "0.24"
undo = "0.52"
notify-debouncer-full = { version = "0.5", optional = true }

# Optimize dependencies even in dev/test builds. writ's own code stays unoptimized
# (fast incremental compile + debuggable), but the graphics/parsing stack (wgpu, vello,
# parley/swash, tree-sitter, gix, …) runs at opt-level 2. Without this a debug build shapes
# text ~10× slower and its large unoptimized working set page-faults in over the first ~30s
# of use — making the editor feel sluggish at startup even though release is smooth.
[profile.dev.package."*"]
opt-level = 2

[profile.release]
lto = "thin"
codegen-units = 1

# Fast release builds for development (cargo build --profile release-fast)
[profile.release-fast]
inherits = "release"
lto = false
codegen-units = 16

[dev-dependencies]
vello = "0.9"