Frontmatter

@sushindustries/ui

A small frontmatter reader for `key: value` and inline lists. Not YAML, deliberately.

5 min read
View as MarkdownEdit on GitHub

Frontmatter parses a Markdown file's frontmatter block for key: value lines and inline [a, b] lists, nothing more. Reach for it to read a content file's metadata without pulling in a YAML parser for a format that never needs anchors, nesting, or block scalars.

Viewport width
Phone22remthe floor, the narrowest this promises to work at
tanstacktanstack add https://adamjurek.com/r/tanstack/frontmatter.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/frontmatter.json

Why it is built this way

TanStack Markdown hands back the frontmatter block as a raw string and stops there, which is the right call for a Markdown parser, not a YAML one. This covers only the subset content files in this repo actually use. It is deliberately not YAML: no anchors, no nesting, no block scalars. If a file ever needs those, the honest fix is a real YAML parser, not teaching this one another feature at a time until it becomes a worse one.

Install

tanstack add https://adamjurek.com/r/tanstack/frontmatter.json
shell
pnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/frontmatter.json
shell
pnpm add @sushindustries/ui @sushindustries/atoms
shell

What you get

Version0.1.0
Categorycontent · Parsing
Filesfrontmatter.ts
DependenciesNone
Tagsmarkdown, no-deps

No runtime dependencies

It brings nothing with it beyond the stylesheet.