Expand description
§yaml-repair
Repair messy YAML emitted by LLMs into something a real YAML parser will accept.
Fixes applied:
- Strip
yaml /fences and surrounding prose. - Normalize CRLF and CR line endings to LF.
- Convert leading tabs to 2 spaces (YAML forbids leading tabs in indentation).
- Dedent so the shallowest non-empty line is at column 0.
- Trim trailing whitespace on each line.
§Example
use yaml_repair::repair;
let raw = "Sure:\n```yaml\n name: Claude\n tools:\n - read\n - write\n```";
let fixed = repair(raw);
assert!(fixed.starts_with("name: Claude"));
assert!(!fixed.contains("```"));Functions§
- repair
- Clean
rawand return YAML-parser-ready text.