Stedefast

Content

Markdown Pipeline

1 min read

Stedefast processes Markdown through a unified pipeline using remark and rehype plugins.

Pipeline stages

  1. Parseremark-parse converts Markdown source to an mdast (Markdown AST)
  2. Transform — remark plugins transform the mdast (GFM tables, footnotes, etc.)
  3. Convertremark-rehype converts mdast to hast (HTML AST)
  4. Sanitize — HTML is cleaned to remove unsafe elements
  5. Stringifyrehype-stringify converts hast to an HTML string

The resulting HTML string is placed in page.content and available in templates via dangerouslySetInnerHTML.

Supported Markdown features

  • GitHub Flavored Markdown (GFM) — tables, strikethrough, task lists, autolinks
  • Footnotes[^1] syntax
  • Fenced code blocks with language identifiers
  • Front matter — YAML between --- delimiters (parsed separately before the pipeline)

Syntax highlighting

Code blocks are highlighted at build time using Shiki. The default theme is github-light / github-dark (toggled with the dark mode class).

To customise the theme, add a shiki key to your config (coming in a future release).

Reading time

Stedefast estimates reading time from the word count of the parsed content. The result is available as page.readingTimeMinutes in templates.

Excerpt

The first paragraph (up to 160 characters) is extracted as page.excerpt for use in listing pages and RSS descriptions.