September 22, 2024 8.32PM
Switched to TOML.
Previously I was using a pseudo-YAML for document frontmatter and JSON for the asset manifests. I’ve switched both to TOML, partly for it’s simpler parsing but really entirely because I much prefer its readability.
Now every document and asset is contained in TOML documents. A blog post is itself a completely valid TOML document that easily serialises into a Python struct. This has the advantage of bringing stricter validation to all data, and also opens up opportunities to build documents from structured data — something I’ve been wanting to do with data for the walk among other things.
The only issue I have with TOML is that there is no spec compliant way to have multiple TOML documents in a single file. Eventually this limitation may drive me back to YAML, but I don’t regret the migration at all. Now that I’m using a strict schema it will be trivial to migrate to JSON5, YAML, or even XML in the future if I wanted to.