kdl 2.0.1 copy "kdl: ^2.0.1" to clipboard
kdl: ^2.0.1 copied to clipboard

KDL is a small, pleasant document language with XML-like node semantics that looks like you're invoking a bunch of CLI commands!

KDL #

Pub Version Actions Status

This is a Dart implementation of the KDL Document Language

Usage #

import 'package:kdl/kdl.dart';

main() {
  var document = Kdl.parseDocument(someString);
}
copied to clipboard

You can optionally provide your own type annotation handlers:

KDL.parseDocument(someString, typeParsers: {
  'foo': (value, type) {
    return Foo(value.value, type: type)
  },
});
copied to clipboard

The foo function will be called with instances of KdlValue or KdlNode with the type annotation (foo).

Parsers are expected to take the KdlValue or KdlNode, and the type annotation itself, as arguments, and is expected to return either an instance of KdlValue or KdlNode (depending on the input type) or null to return the original value as is. Take a look at the built in parsers as a reference.

Run the tests #

To run the full test suite:

dart test
copied to clipboard

To run a single test file:

dart test test/parser_test.dart
copied to clipboard

Contributing #

Bug reports and pull requests are welcome on GitHub at https://github.com/danini-the-panini/kdl-dart.

License #

The gem is available as open source under the terms of the MIT License.

3
likes
150
points
43
downloads

Publisher

verified publisherdanini.dev

Weekly Downloads

2024.09.21 - 2025.04.05

KDL is a small, pleasant document language with XML-like node semantics that looks like you're invoking a bunch of CLI commands!

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

big_decimal, string_scanner

More

Packages that depend on kdl