#delta #editor #format #quill #attributes #documentation #refer

quill-delta-rs

Implementation of Quill editor Delta format in Rust

3 stable releases

1.1.1 Apr 17, 2024
1.1.0 Apr 13, 2024
1.0.0 Apr 4, 2024

#3 in #refer

Download history 83/week @ 2024-04-03 167/week @ 2024-04-10 154/week @ 2024-04-17

404 downloads per month

MIT license

89KB
2K SLoC

Build codecov

Implementation of Quill editor Delta format in Rust. Refer to official documentation for more details.

Usage

use quill_delta_rs::{
    attributes::{attributes, AttributesMap}, 
    delta::Delta
};

fn main() {
    let mut doc = Delta::new();
    doc.insert("Hello world\n", Some(attributes!("h" => "1")));
    let mut change = Delta::new();
    change
        .retain(6, None)
        .delete(6)
        .insert("Earth\n", None);
    let result = doc.compose(&change);
    println!("Original document:\n{}\n", doc);
    println!("Change:\n{}\n", change);
    println!("Updated document:\n{}\n", result);

    // Prints:
    //
    //  Original document:
    //  ins(Hello world⏎) + {h: 1}}
    //      
    //      
    //  Change:
    //  ret(6)
    //  ins(Earth⏎)
    //  del(6)
    //      
    //      
    //  Updated document:
    //  ins(Hello ) + {h: 1}}
    //  ins(Earth⏎)
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Dependencies

~0.7–1.4MB
~33K SLoC