5 releases (3 breaking)

1.0.0 Nov 9, 2021
0.3.0 Dec 9, 2021
0.2.0 Dec 9, 2021
0.1.0 Nov 15, 2021
0.0.3 Nov 9, 2021

#8 in #party

34 downloads per month
Used in sieve-generator

MIT license

4KB
50 lines

Indentasy

Indent like a party

Rust implementation of https://cwestblog.com/2014/01/02/javascript-indenting-text/

Examples

fn hello_newline_world() {
    assert_eq!("    hello\n    world", indentasy::indent("hello\nworld", 1, 4));
}

fn newline_hello_newline_world() {
    assert_eq!(
        "\n    hello\n    world",
        indentasy::indent("\nhello\nworld", 1, 4)
    );
}

fn hello_newline_world_indent_with_tab() {
    assert_eq!("\thello\n\tworld", indentasy::indent("hello\nworld", 1, 0));
}

fn hello_newline_world_with_String() {
    assert_eq!(
        "    hello\n    world",
        indentasy::indent("hello\nworld".to_string(), 1, 4)
    );
}

No runtime deps