返回 slidev
syntax-block-frontmatter.md
根目录 / skills / slidev / references / syntax-block-frontmatter.md
1 ---
2 name: block-frontmatter
3 description: Using YAML code blocks as slide frontmatter for syntax highlighting
4 ---
5
6 # Block Frontmatter
7
8 Use a YAML code block as the frontmatter for slides when you need syntax highlighting and formatter support.
9
10 ## Usage
11
12 Instead of traditional frontmatter `---`, use a yaml code block at the start of a slide:
13
14 ````md
15 ---
16 theme: default
17 ---
18
19 # Slide 1
20
21 ---
22
23 ```yaml
24 layout: quote
25 ```
26
27 # Slide 2
28
29 ---
30
31 # Slide 3
32 ````
33
34 ## Key Points
35
36 - Works for per-slide frontmatter only
37 - Cannot use for headmatter (first frontmatter of the deck)
38 - Provides syntax highlighting in editors
39 - Compatible with prettier-plugin-slidev
40
40 lines MARKDOWN