Rust parser for KDL
Go to file
Kat Marchán a1555949ed refactor: clean up parser/FromStr toplevel stuff and add one for KdlIdentifier 2022-04-23 01:21:28 -07:00
.github feat(api): complete rewrite into document-oriented parser (#29) 2022-04-22 02:20:30 -07:00
examples feat(tests): add test for kdl-schema.kdl (#30) 2022-04-22 02:26:52 -07:00
src refactor: clean up parser/FromStr toplevel stuff and add one for KdlIdentifier 2022-04-23 01:21:28 -07:00
.editorconfig feat(api): complete rewrite into document-oriented parser (#29) 2022-04-22 02:20:30 -07:00
.gitignore initial commit 2020-12-10 18:42:50 -08:00
CHANGELOG.md doc: update changelog 2021-09-16 01:31:50 -07:00
CODE_OF_CONDUCT.md add coc 2020-12-14 20:30:58 -08:00
Cargo.toml feat(errors): improve parsing errors and fix some bugs (#33) 2022-04-22 19:41:28 -07:00
LICENSE feat(license): change license to Apache-2.0 2021-09-15 23:59:34 -07:00
Makefile.toml meta: add publishing bits 2021-09-15 23:59:15 -07:00
README.md feat(api): complete rewrite into document-oriented parser (#29) 2022-04-22 02:20:30 -07:00
cliff.toml meta: fix changelog gen 2021-09-16 00:01:34 -07:00

README.md

kdl is a "document-oriented" parser and API. That means that, unlike serde-based implementations, it's meant to preserve formatting when editing, as well as inserting values with custom formatting. This is useful when working with human-maintained KDL files.

You can think of this crate as toml_edit, but for KDL.

Example

use kdl::KdlDocument;

let doc: KdlDocument = r#"
hello 1 2 3
world prop="value" {
    child 1
    child 2
}
"#.parse().expect("failed to parse KDL");

assert_eq!(doc.get_args("hello"), vec![&1.into(), &2.into(), &3.into()]);
assert_eq!(doc.get("world").map(|node| &node["prop"]), Some(&"value".into()));

License

The code in this repository is covered by the Apache-2.0 License.