Expand description
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
ⓘ
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:
ⓘ
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));Re-exports§
pub use editor::Direction;pub use editor::Editor;pub use editor::EditorAction;pub use editor::EditorConfig;pub use editor::EditorTheme;