1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! A hybrid markdown editor: raw text editing with live inline rendering (markers
//! like `**`, `#`, and `-` are hidden when the cursor is elsewhere) plus an inline
//! git diff against HEAD, rendered on winit + wgpu + Vello + Parley.
//!
//! writ ships as both a desktop application (the `writ` binary) and a library. The
//! library's centerpiece is [`MarkdownView`] — a headless, render-only markdown
//! renderer you can embed in your own winit/wgpu/Vello app.
//!
//! # The application
//!
//! - **Live inline rendering**: Markdown syntax is hidden when not editing
//! - **Syntax highlighting**: Code blocks with tree-sitter based highlighting
//! - **Smart continuation**: Shift+Enter continues lists, blockquotes, etc.
//! - **Inline git diff**: Renders the working file's diff against git HEAD, refreshed
//! live as the file *or* HEAD changes (an external commit updates the diff too)
//!
//! ```ignore
//! // `writ --file notes.md` — the shell reads the path from the CLI and runs the app.
//! writ::shell::run()?;
//! ```
//!
//! # Using writ as a library
//!
//! [`MarkdownView`] turns markdown into a Vello [`Scene`](vello::Scene) (a CPU display
//! list) with no window, GPU device, editor, or diff machinery — the consumer owns its
//! surface and rasterizes the scene however it likes. It supports **streaming**: feed
//! content incrementally with [`MarkdownView::push_str`] (e.g. tokens from an LLM) and
//! re-render.
//!
//! ```ignore
//! use vello::Scene;
//! use writ::MarkdownView;
//!
//! let mut view = MarkdownView::new();
//! view.push_str("# Streaming\n\n");
//! view.push_str("More text arrives later.\n");
//!
//! let mut scene = Scene::new();
//! view.render(&mut scene, 800.0, 600.0, 1.0); // scene is now a display list
//! // ... hand `scene` to a vello::Renderer to rasterize onto your own surface.
//! ```
//!
//! See `examples/streaming_markdown.rs` for an end-to-end headless render to PNG (via
//! [`rasterize_scene_to_png`]). For image support the component stays IO-free: it lists
//! referenced URLs via [`MarkdownView::image_urls`] and you push decoded bytes back in
//! with [`MarkdownView::set_image_bytes`].
//!
//! # Feature flags
//!
//! Depend on writ with `default-features = false` to get just the renderer without the
//! app's editor/git/GitHub/networking stack:
//!
//! ```toml
//! writ = { version = "0.16", default-features = false }
//! ```
//!
//! - **(none)** — the render-only base: [`MarkdownView`], [`rasterize_scene_to_png`],
//! the diff algorithm, layout, and syntax highlighting. Pulls no winit/tokio/reqwest/
//! gix/notify.
//! - **`editor`** — the headless `Editor` orchestration hub (git diff vs HEAD, GitHub
//! ref validation, file watching). Enables the `core` module.
//! - **`app`** (default) — the full desktop application: the winit `shell`, clipboard,
//! config file, mermaid + math + remote images. Implies `editor`.
//! - Individual toggles: `git`, `github`, `watch`, `remote-images`, `mermaid`, `math`.
pub use Editor;
pub use ;
pub use RepaintSignal;
pub use MarkdownView;
pub use rasterize_scene_to_png;