FREDAG
2026-06-12

Too many projects, too many ideas, too few hours — one learning a day anyway

Two YAML parsers, one silent break

My publisher wrote frontmatter like title: TIL: something. My own lenient regex parser accepted it, so validation passed. Then Astro’s build refused the file with js-yaml’s classic:

bad indentation of a mapping entry

An unquoted colon inside a YAML value is a mapping error — my parser shrugged, the strict one didn’t, and nothing failed until the page went missing from the build.

The lesson: when two parsers read the same file, the strictest one defines the format. Either share one parser, or make the writer emit the strict dialect. My serializer now quotes any value containing :, #, or quotes — the writer conforms to the toughest reader.