gpui-flowtext is a GPUI rich text editor component and document engine for applications that need high-performance, heavily customized document editing.
It provides the editor, document model, virtualization, layout, rendering, selection, editing operations, persistence, and host integration hooks. It does not ship an application-specific style system. Host applications define their own paragraph styles, inline semantic styles, highlight styles, labels, shortcuts, file extensions, and export behavior.
This repository contains the library implementation. Full API guides and examples will live on the external documentation site.
This project is early and actively being extracted from a production GPUI application. Public API names are being shaped around real integration use cases and may still change before a stable release.
- GPUI rich text editor element and editor state
- Virtualized document rendering for large documents
- Paragraph, inline, highlight, table, image, and equation document primitives
- Selection, clipboard, history, formatting, and edit operation support
- Native binary document persistence
- Host hooks for styles, assets, export, events, and document-specific behavior
- A default app style set
- Product-specific paragraph names such as headings, tags, citations, or analysis styles
- DOCX/PDF exporters by default
- A prescribed file extension for host applications
The default native extension is gptx, but applications can use their own extension when exporting or saving native documents.
The crate exposes grouped modules so applications can depend on the smallest practical surface:
gpui_flowtext::preludefor common editor and document typesgpui_flowtext::stylefor style slots, style catalogs, and theme typesgpui_flowtext::editor_apifor editor configuration, commands, events, and stategpui_flowtext::persistence_apifor native document read/write helpersgpui_flowtext::hostfor host adapters such as export and asset integrationgpui_flowtext::advancedfor lower-level collaboration and edit operation APIs
The root module also re-exports the full API for convenience.
gpui-flowtext uses generic style slots:
ParagraphStyle::NormalParagraphStyle::Custom(slot)RunSemanticStyle::PlainRunSemanticStyle::Custom(slot)HighlightStyle::Custom(slot)
Applications own the meaning of those slots. A host app can map slot 0 to a heading, slot 1 to a warning, slot 2 to a transcript speaker, or anything else. The library only stores, lays out, renders, and edits the styles according to the DocumentTheme and style catalog the host provides.
Native documents can be read and written with:
use gpui_flowtext::persistence_api::{read_document, write_document};The built-in native extension is:
use gpui_flowtext::persistence_api::DEFAULT_DOCUMENT_EXTENSION;Host applications can use their own extension with DocumentExportFormat::NativeWithExtension(...).
Run the library tests:
cargo testRun a type check:
cargo checkOptional instrumentation features are available for hotpath profiling:
cargo check --features hotpathSee LICENSE.