Documentation

Modes

The four ways polytypo reads a document: text, html, markdown and yaml, and what each treats as prose.

Updated · spec 1.12.0

  • Modes The four ways polytypo reads a document, what each one treats as prose, and how to choose between them.
  • Text mode The default mode. The whole string is prose, there is no parser and no skip list, so everything in it is typeset.
  • HTML mode Typeset the prose in an HTML document or fragment while tags, attributes, code, scripts and character references come back byte for byte.
  • Markdown mode Typeset the prose of a CommonMark or MDX document, leaving code, links, HTML and frontmatter exactly as written.
  • Markdown dialects Why markdown mode requires an explicit dialect, what commonmark and mdx each mean, and what happens when the document does not parse.
  • Markdown skip list Exactly which parts of a Markdown document markdown mode leaves untouched, and which parts it typesets.
  • Frontmatter How markdown mode treats a YAML or TOML frontmatter block, how to typeset named fields with frontmatterKeys, and how the block is located.
  • MDX How markdown mode handles MDX: JSX elements and attributes, expressions, ESM statements, and documents that fail to parse.
  • YAML mode Typeset the prose values of named keys in a YAML file, with a specified scan instead of a parser, and everything else returned byte for byte.
  • YAML keys How the keys option selects values in yaml mode: exact matching, any depth, no paths or globs, and which lines the scan reads as keys.
  • Quoting and scalar forms Which YAML value forms yaml mode typesets, which it leaves untouched, and why a colon or hash inside a plain scalar is treated as a boundary.

Already using polytypo? Add our badge

Two lines: a script tag and a span. No per-embed network call. Pick a language and a theme, then copy the code into your footer or credits. Embedding notes cover Content Security Policy. Sites with the badge are listed on Sites using polytypo.

<script async src="https://polytypo.dev/badge.js"></script>
<span data-polytypo-lang="en" data-polytypo-theme="light"></span>

Search runs in your browser. Nothing is sent anywhere.