FMD — Fenceless Markdown

A plain key: value header for Markdown documents: no YAML, no fence, every value a string.

author: ada
category: notes
date: 2026-08-31
tags: markdown, metadata, parsing

# Title

The body starts here.

The header sits at the very top of the document, where YAML frontmatter would go, but without the fence. It is the first run of key: value lines, up to the first blank line. A blank line ends it, and everything after it is body, the H1 included.

A Markdown parser that has never heard of FMD sees the header as an ordinary paragraph. Nothing breaks, no stray horizontal rule appears, and nothing leaks into the rendered page.

This page is the FMD specification. The npm package fenceless is its reference implementation, in TypeScript.


Why

YAML frontmatter works, but it is borrowed weight. A full YAML parser runs before the document gets to be itself, and it brings baggage that has nothing to do with what frontmatter is for:

  • The Norway Problem: NO silently becomes false under YAML 1.1.
  • Numbers lose trailing zeros (1.20 becomes 1.2).
  • Dates are cast into Date objects when a plain string was wanted.
  • A --- block renders unpredictably in plain Markdown viewers.

None of these is a metadata problem. They are type-inference problems, inherited by choosing YAML as the container. FMD has no type inference to get wrong: every value is a string, always. Whether date becomes a Date or tags becomes an array is up to the application that reads it, not the format.

Constraint does the rest. YAML's expressiveness is exactly what lets the same data drift into five valid encodings. FMD has one way to write a value: flat, on one line, as a string.


Rules

  • Keys: [a-z0-9_]+ only. No camelCase, no kebab-case, no question of which convention wins.
  • Separator: key: value. The space after the colon is required, so parsing is one deterministic split rather than a tolerant guess.
  • Values: always strings. Only the first colon splits, so link: https://example.com/post keeps its value intact.
  • No nesting. Flat key-value pairs only.
  • No folding, no multi-line values. One line, one value. Long text belongs in the body.
  • Termination: a blank line ends the header.

An FMD header has the same shape as an HTTP or email header, key: value lines ended by a blank line, but its own rules: restricted keys, a required space, no continuation lines, and a repeated key overrides the earlier one.


Behavior

  • Positional detection. The header is the document's first non-blank run of lines. Leading blank lines are skipped; nothing else is. A run of key: value lines further down is prose.
  • All or nothing. One line that doesn't match disqualifies the whole header; there is no partial capture. A document with no valid header has no metadata, and its whole text is body.
  • Parsing never fails. Malformed input is simply a document without metadata.
  • Line endings are preserved. CRLF is tolerated when matching header lines, but the body is taken from the original text, so parsing never rewrites a document.
  • A leading BOM is stripped. For duplicate keys, the last one wins. Values are trimmed at the end only.
  • Writing refuses what wouldn't read back. A key outside [a-z0-9_]+ or a value containing a newline is an error, not a document that would reparse differently. Empty values are skipped.
  • Round trips hold. Writing a header and body, then parsing the result, gives back the same header and body.

Two things to know before adopting it:

  • A body that opens with key: value lines becomes metadata if the document has no header of its own. That follows from having no fence, and the format accepts it. Written output always carries at least one key, so it only affects hand-written input.
  • Lists are the reader's business. FMD has no array type. The usual convention is comma-joined (tags: markdown, metadata, parsing), so a value that contains a comma cannot round-trip. Refuse it when writing rather than splitting it silently.

Using it

The reference implementation is the npm package fenceless: TypeScript, ESM, zero dependencies, no Node or browser APIs.

npm install fenceless
import { parseFmd, stringifyFmd } from 'fenceless';

const { meta, markdown } = parseFmd(document);
//    meta     → { author: 'ada', category: 'notes', date: '2026-08-31', … }
//    markdown → '# Title\n\nThe body starts here.'

const text = stringifyFmd(markdown, meta);
type FmdResult = { meta: Record<string, string>; markdown: string };

function parseFmd(text: string): FmdResult;
function stringifyFmd(markdown: string, meta: Record<string, string>): string;

parseFmd never throws. stringifyFmd throws a TypeError on a bad key or a multi-line value, and skips null, undefined and empty-string values.


What FMD Is Not

FMD does not compete with YAML as a general-purpose data format. It has no ambition toward nested structures, types or schemas. It exists for a narrower and more common case: a small, flat set of facts about a document, written with the least machinery necessary, in a shape that never needs a special parser to look right, and never needs a fence.

A heading is a heading. A fact is a line.


Versions

  • v1.1 (current): the header sits at the top of the document.
  • v1.0: briefly placed the header after the H1, so a document read straight into its title. Reverted the same day: metadata is edited far more often than it is admired, and reaching it without scrolling won. The fence stayed gone.

License

The specification (the Rules and Behavior sections of this page) is CC BY 4.0, with an explicit grant to implement it freely in any language, under any license, without attribution in the resulting software. The reference implementation is MIT.


FMD is one of the formats by L. C. Maren.