canvist 0.2.2

The canvist rich-text editor engine in one crate: the document model, editing engine, extensions, and headless engine, with layout, collaboration, and the canvas behind features
Documentation

canvist

The canvist rich-text editor engine in one crate. Add canvist and reach the document model, the editing engine, the extensions, and the headless engine through its modules; layout, collaboration, and the design canvas are a feature away.

cargo add canvist

The default features, headless and starter-kit, are what a server, a script, or a test needs: load and export ProseMirror/TipTap JSON, HTML, Markdown, and plain text, and run typed commands against explicit selections.

use canvist::headless::Engine;
use canvist::headless::Format;
use canvist::headless::Position;

let engine = Engine::starter_kit();
let kit = engine.handles();
let mut doc = engine.parse(Format::Markdown, "Hello world")?;

doc.select_range(&Position::new([0], 6), &Position::new([0], 11))?;
doc.run(&kit.bold.toggle())?;

assert_eq!(doc.export(Format::Html), "<p>Hello <strong>world</strong></p>");
# Ok::<(), canvist::headless::HeadlessError>(())

Each module is the crate it names, so canvist::headless::Engine is canvist_headless::Engine and every crate's documentation applies unchanged.

Module Crate Feature
canvist::model canvist_model always
canvist::core canvist_core always
canvist::extensions canvist_extensions always; starter-kit, extras, full
canvist::headless canvist_headless headless; journal, ssr, headless-scene
canvist::collab canvist_collab collab
canvist::layout canvist_layout layout; parley for real font measurement
canvist::scene canvist_scene canvas
canvist::canvas canvist_canvas canvas
canvist::paint canvist_paint paint; png (CPU), gpu (vello on wgpu)
  • collab: Yjs collaboration. With headless, a document is a Yjs peer and a y-sync endpoint; with canvas, so is a scene.
  • ssr: server-side HTML and SVG, laid out exactly as the canvas editor paints them.
  • headless-scene: load, edit, and export canvas scenes as SVG and PNG on a server.

The desktop editor, canvist_desktop, is a separate crate: add it next to canvist.