Implementing Jekyll-Inspired Frontmatter Parser in Pure C

How we built a YAML frontmatter parser that supports nested objects like hero.title without libyaml.

Implementing Jekyll-Inspired Frontmatter Parser in Pure C

The Challenge

We wanted Jekyll DX:

hero:
  title: Blog - CAX SSG
  info: Editorial

But in C. No libyaml, no dependencies.

Solution: Indent Stack

We implemented a stack-based parser:

  • Track indent level
  • hero: -> push new CAXObject
  • title: -> set string in top object
CAXObject *stack[16];
int indent_stack[16];
while(line){ if(indent>stack[top]) push(); }

Now {{hero.title}} works in *.cax templates. Zero dependency, 200 lines.