Foundation / tool
KatanA Language Editor
A framework-neutral Rust editor interface for text, cursor positions, and selections. The public version is still in its foundation stage.
Developers working on KatanA editing experiences and language features
01
Implemented capabilities
02
Getting started
- Get the repository and review the public development status and structure in the README.
- Run just check, then review the LanguageEditor and TextContent contracts before integrating them.
Prepare Rust and the required development tools, then check the linked README for environment requirements before installing. Examples show an entry point and do not guarantee operation in every environment.
Evidenceuse katana_language_editor::{LanguageEditor, TextContent};
pub fn set_markdown(editor: &mut impl LanguageEditor, markdown: &str) {
editor.set_content(TextContent {
text: markdown.to_owned(),
language: Some("markdown".to_owned()),
});
}01 / KLE
Where it fits
Separate editor contracts from UI frameworks
The neutral crate provides TextContent, CursorPosition, Selection, EditorEvent, and LanguageEditor, creating a boundary where KatanA does not expose egui types directly. A host can replace its input surface while preserving the trait contract it depends on.
Try the egui MVP connection
katana-language-editor-egui accepts EditorConfig, draws an egui TextEdit, and queues ContentChanged when the response changes. The public release is scaffolding, and the Floem crate is a dependency and trait-implementation skeleton rather than a completed editor backend.
02 / KLE
Input to output
Set content and configuration
Set the text and optional language identifier in TextContent, then choose font size, line numbers, word wrap, and tab size in EditorConfig. EguiLanguageEditor::set_content replaces the current content held by the egui implementation.
Convert UI input to events
When the egui TextEdit response.changed() method reports a change, the implementation queues the current TextContent as EditorEvent::ContentChanged in its pending event queue. The neutral crate receives the event type without exposing egui's Response type in the public contract.
Poll events in the host
The host calls LanguageEditor::poll_events() to collect events and content() to read the current text. The public egui MVP returns a default CursorPosition from cursor(), so real cursor synchronization and selection integration must not be treated as completed features.
03 / KLE
Key APIs and CLI
TextContent- Stores the document text and an optional arbitrary language identifier as framework-neutral editor data. It carries content such as Markdown without binding the host to a UI framework.
CursorPosition and Selection- CursorPosition represents line and column, while Selection represents start and end positions. These public types exist, but the egui MVP still returns a default cursor and does not report a real cursor position.
EditorConfig- EditorConfig exposes font_size, line_numbers, word_wrap, and tab_size for font size, line numbers, word wrapping, and tab width. The egui implementation uses these settings for its visible-row calculation, but they do not represent a complete set of editing features.
LanguageEditor and EditorEvent- The host contract includes content, set_content, cursor, and poll_events, while EditorEvent defines ContentChanged, CursorMoved, and SelectionChanged. The contract exposes these event types without promising that the MVP emits every one of them.
04 / KLE
Concrete example
Set Markdown content in the egui MVP
Create EditorConfig, set TextContent on EguiLanguageEditor, and read the content. A real host must call show(ui) every frame to draw the TextEdit and call poll_events() after input to collect ContentChanged; the standalone snippet itself only sets and reads content.
use katana_language_editor::{EditorConfig, LanguageEditor, TextContent};
use katana_language_editor_egui::EguiLanguageEditor;
fn main() {
let mut editor = EguiLanguageEditor::new(EditorConfig {
font_size: Some(14.0),
line_numbers: true,
word_wrap: true,
tab_size: 4,
});
editor.set_content(TextContent {
text: "# KatanA\n".to_owned(),
language: Some("markdown".to_owned()),
});
println!("{}", editor.content().text);
}05 / KLE
Integration boundaries
Depend on the neutral crate first
KatanA or another host should depend on katana-language-editor's traits and DTOs and keep UI-specific crates behind adapters. If the host changes from egui to a custom input surface, it should retain the neutral dependency and replace only the adapter.
Accept the scaffolding boundary
The public README marks the project Scaffolding and describes Floem as a compilable skeleton in v0.1.0. Initially integrate text setup and ContentChanged, and treat cursor, selection, and full editing operations as unfinished risks at the adoption boundary.
Evidence
This overview is based on the public repositories at the time of review. Verify implementation and usage in the linked pinned commits.