pretty_yaml
is a semi-tolerant and configurable YAML formatter.
Basic Usage
You can format source code string by using [format_text
] function.
use ;
let options = default;
assert_eq!;
For detailed documentation of configuration, please refer to Configuration.
If there're syntax errors in source code, it will return Err
:
use ;
let options = default;
assert!;
Print Syntax Tree
If you have already parsed the syntax tree with yaml_parser
,
you can use [print_tree
] to print it.
use ;
use ;
let input = "- a\n- b";
let tree = parse.unwrap;
let root = cast.unwrap;
let options = default;
assert_eq!;