frontmatter
16 cases. Source: tests/frontmatter.json.
#1 canonical theme block from the spec
Source
---
markset: 0
theme:
preset: editorial # editorial | technical | deck | report
accent: "#2563eb"
density: comfortable # compact | comfortable | spacious
radius: md # none | sm | md | lg
type:
body: "Source Serif 4"
heading: "Inter"
scale: 1.25
---
# Title
Rendered
Title
Downgrade
---
markset: 0
theme:
preset: editorial # editorial | technical | deck | report
accent: "#2563eb"
density: comfortable # compact | comfortable | spacious
radius: md # none | sm | md | lg
type:
body: "Source Serif 4"
heading: "Inter"
scale: 1.25
---
# Title
#2 version only
Source
---
markset: 0
---
text
Rendered
text
Downgrade
---
markset: 0
---
text
#3 theme without a version
Source
---
theme:
preset: deck
---
Rendered
Downgrade
---
theme:
preset: deck
---
#4 other keys are the document's business
Source
---
title: Notes
tags: [a, b]
authors:
- name: X
role: y
---
Rendered
Downgrade
---
title: Notes
tags: [a, b]
authors:
- name: X
role: y
---
#5 short hex accent
Source
---
theme:
accent: "#fff"
---
Rendered
Downgrade
---
theme:
accent: "#fff"
---
#6 no frontmatter leaves the root bare
Source
# Title
---
Rendered
Title
Downgrade
# Title
---
#7 a later --- pair is not frontmatter but a thematic break and a setext heading
Source
text
---
markset: 0
---
Rendered
text
markset: 0
Downgrade
text
---
## markset: 0
#8 unknown theme token warns
Source
---
theme:
color: red
type:
weight: 700
---
Rendered
Downgrade
---
theme:
color: red
type:
weight: 700
---
Diagnostics: THEME_UNKNOWN_TOKEN THEME_UNKNOWN_TOKEN
#9 unreadable frontmatter warns and is ignored
Source
---
ok: 1
stray: 2
---
Rendered
Downgrade
---
ok: 1
stray: 2
---
Diagnostics: FRONTMATTER_UNPARSEABLE
#10 unsupported version
invalid
Source
---
markset: 1
---
Rendered
Downgrade
---
markset: 1
---
Diagnostics: DOCUMENT_VERSION_UNSUPPORTED
#11 version must be a number
invalid
Source
---
markset: "0"
---
Rendered
Downgrade
---
markset: "0"
---
Diagnostics: DOCUMENT_VERSION_UNSUPPORTED
#12 invalid preset
invalid
Source
---
theme:
preset: fancy
---
Rendered
Downgrade
---
theme:
preset: fancy
---
Diagnostics: THEME_INVALID_TOKEN
#13 accent must be a hex color
invalid
Source
---
theme:
accent: blue
---
Rendered
Downgrade
---
theme:
accent: blue
---
Diagnostics: THEME_INVALID_TOKEN
#14 scale out of range
invalid
Source
---
theme:
type:
scale: 3
---
Rendered
Downgrade
---
theme:
type:
scale: 3
---
Diagnostics: THEME_INVALID_TOKEN
#15 theme must be a mapping
invalid
Source
---
theme: dark
---
Rendered
Downgrade
---
theme: dark
---
Diagnostics: THEME_INVALID_TOKEN
#16 valid tokens survive next to invalid ones
invalid
Source
---
theme:
preset: report
density: loose
radius: lg
---
Rendered
Downgrade
---
theme:
preset: report
density: loose
radius: lg
---
Diagnostics: THEME_INVALID_TOKEN