Skip to content

flying-swallow/quill-delta-rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Implementation of Quill editor Delta format in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%