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
//! A Typora-style markdown editor component for GPUI.
//!
//! Writ provides an embeddable markdown editor with live inline rendering—markers
//! like `**`, `#`, and `-` are hidden when the cursor is elsewhere, showing only
//! the styled result.
//!
//! # Features
//!
//! - **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.
//! - **Streaming support**: Append text programmatically for AI chat applications
//!
//! # Quick Start
//!
//! ```ignore
//! use writ::{Editor, EditorConfig};
//!
//! // Create with default config
//! let editor = cx.new(|cx| Editor::new("# Hello", cx));
//!
//! // Or with custom config
//! let config = EditorConfig::default();
//! let editor = cx.new(|cx| Editor::with_config("# Hello", config, cx));
//! ```
//!
//! # Streaming
//!
//! For AI chat or other streaming use cases:
//!
//! ```ignore
//! editor.update(cx, |e, cx| e.begin_streaming(cx));
//! for token in stream {
//! editor.update(cx, |e, cx| e.append(&token, cx));
//! }
//! editor.update(cx, |e, cx| e.end_streaming(cx));
//! ```
pub use ;