Skip to content

Support TOML format in frontmatter and block props #344

Description

@caelyreth

Description

Add support for TOML as an alternative format for document frontmatter and component block props, alongside the existing YAML support.

This would allow authors to use either format interchangeably (or mix them across files/components) without changing Comark’s core data model.

Motivation

Many users (myself included) come from ecosystems where TOML is a first-class citizen for configuration and frontmatter — most notably Hugo, which has long supported TOML via the +++ delimiter.

TOML offers several practical advantages for content authors:

  • It is largely indentation-insensitive, reducing friction when editing nested structures.
  • Nested tables and arrays are explicit and readable without relying on significant whitespace.
  • It is already widely used in modern tooling (Cargo, pyproject.toml, many static-site generators, etc.), so the mental model is familiar to a large group of developers.

Supporting TOML as a complementary format would lower the barrier for users migrating from Hugo or other TOML-centric workflows, while keeping YAML as the default for those who prefer it.

Proposed solution

I propose adding TOML support as a sibling path to the existing YAML handling:

  1. Use the lightweight, well-maintained smol-toml package.
  2. Follow the established community convention of +++ (as used by Hugo and others).

Example frontmatter:

+++
date = 2024-02-02T04:14:54-08:00
draft = false
title = "Example"
weight = 10

[params]
author = "John Smith"
+++

If the you are open to this feature, I’m happy to open a PR that implements TOML parsing as a parallel path next to the existing YAML implementation.

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions