frontmatter
21 cases. Source: tests/frontmatter.json.
#1 canonical theme block from the spec
Source
---
markset: true
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: true
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 declared with true
Source
---
markset: true
---
text
Rendered
text
Downgrade
---
markset: true
---
text
#3 the original form, 0, means the same as true
Source
---
markset: 0
---
text
Rendered
text
Downgrade
---
markset: 0
---
text
#4 theme without the markset key
Source
---
theme:
preset: deck
---
Rendered
Downgrade
---
theme:
preset: deck
---
#5 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
---
#6 short hex accent
Source
---
theme:
accent: "#fff"
---
Rendered
Downgrade
---
theme:
accent: "#fff"
---
#7 no frontmatter leaves the root bare
Source
# Title
---
Rendered
Title
Downgrade
# Title
---
#8 a later --- pair is not frontmatter but a thematic break and a setext heading
Source
text
---
markset: true
---
Rendered
text
markset: true
Downgrade
text
---
## markset: true
#9 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
#10 a block sequence at its key's indentation is read, so the theme after it applies
Source
---
markset: true
audiences:
- engineering
- product
owners:
- name: platform
areas:
- infrastructure
theme:
preset: technical
---
# Title
Rendered
Title
Downgrade
---
markset: true
audiences:
- engineering
- product
owners:
- name: platform
areas:
- infrastructure
theme:
preset: technical
---
# Title
#11 unreadable frontmatter warns and is ignored
Source
---
ok: 1
stray: 2
---
Rendered
Downgrade
---
ok: 1
stray: 2
---
Diagnostics: FRONTMATTER_UNPARSEABLE
#12 a number other than 0 is refused
invalid
Source
---
markset: 1
---
Rendered
Downgrade
---
markset: 1
---
Diagnostics: DOCUMENT_VERSION_UNSUPPORTED
#13 a quoted 0 is not the original form
invalid
Source
---
markset: "0"
---
Rendered
Downgrade
---
markset: "0"
---
Diagnostics: DOCUMENT_VERSION_UNSUPPORTED
#14 a quoted true is not the boolean
invalid
Source
---
markset: "true"
---
Rendered
Downgrade
---
markset: "true"
---
Diagnostics: DOCUMENT_VERSION_UNSUPPORTED
#15 false is refused
invalid
Source
---
markset: false
---
Rendered
Downgrade
---
markset: false
---
Diagnostics: DOCUMENT_VERSION_UNSUPPORTED
#16 yes is not one of YAML's trues here
invalid
Source
---
markset: yes
---
Rendered
Downgrade
---
markset: yes
---
Diagnostics: DOCUMENT_VERSION_UNSUPPORTED
#17 invalid preset
invalid
Source
---
theme:
preset: fancy
---
Rendered
Downgrade
---
theme:
preset: fancy
---
Diagnostics: THEME_INVALID_TOKEN
#18 accent must be a hex color
invalid
Source
---
theme:
accent: blue
---
Rendered
Downgrade
---
theme:
accent: blue
---
Diagnostics: THEME_INVALID_TOKEN
#19 scale out of range
invalid
Source
---
theme:
type:
scale: 3
---
Rendered
Downgrade
---
theme:
type:
scale: 3
---
Diagnostics: THEME_INVALID_TOKEN
#20 theme must be a mapping
invalid
Source
---
theme: dark
---
Rendered
Downgrade
---
theme: dark
---
Diagnostics: THEME_INVALID_TOKEN
#21 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