5 个版本 (3 个重大更新)

1.0.0 2021 年 11 月 9 日
0.3.0 2021 年 12 月 9 日
0.2.0 2021 年 12 月 9 日
0.1.0 2021 年 11 月 15 日
0.0.3 2021 年 11 月 9 日

#1029 in 文本处理

Download history 2/week @ 2024-06-16 56/week @ 2024-07-28

每月 56 次下载
用于 sieve-generator

MIT 许可证

4KB
50

Indentasy

像派对一样缩进

Rust 实现 https://cwestblog.com/2014/01/02/javascript-indenting-text/

示例

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)
    );
}

无运行时依赖