Expand description
§toml-repair
Repair messy TOML emitted by LLMs into something a real TOML parser will accept.
Fixes applied:
- Strip
toml /fences and surrounding prose. - Normalize CRLF and CR line endings to LF.
- Trim trailing whitespace.
- Convert smart quotes (
“ ”) on string values to ASCII". - Strip trailing commas inside inline tables / arrays (TOML permits them in arrays only; we play it safe by leaving valid ones alone).
§Example
use toml_repair::repair;
let raw = "```toml\nname = “Claude”\nversion = \"4.5\"\n```";
let fixed = repair(raw);
assert!(fixed.contains("name = \"Claude\""));Functions§
- repair
- Clean
rawand return TOML-parser-ready text.