Documentation

Modes

One page for each of polytypo's four modes (text, html, markdown and yaml), with their options, skip lists and edge cases.

Updated · spec 1.33.0

  • How modes work Why polytypo has modes, what the rules are allowed to see in each, and the three guarantees all four share.
  • 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 A typographer for Markdown: curly quotes, dashes, ellipses and no-break spaces in CommonMark and MDX prose. Code, links, HTML and frontmatter stay 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 dialect 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.