返回 slidev
block-frontmatter.md
根目录 / docs / features / block-frontmatter.md
1 ---
2 depends:
3 - guide/syntax
4 relates:
5 - features/prettier-plugin
6 tags: [syntax]
7 description: |
8 Use a YAML code block as the frontmatter.
9 ---
10
11 # Block Frontmatter
12
13 The usual way to define frontmatters of slides is concise, but may lack of highlighting and formatter support. To solve this, you can use a YAML block at the very beginning of the slide content as the frontmatter of the slide:
14
15 ````md
16 ---
17 theme: default
18 ---
19
20 # Slide 1
21
22 ---
23
24 ```yaml
25 layout: quote
26 ```
27
28 # Slide 2
29
30 ---
31
32 # Slide 3
33 ````
34
35 ::: warning About headmatter
36
37 Headmatter in Slidev is exactly the usual called "frontmatter" of the a Markdown file, which is supported by most of the Markdown editors and formatters. So you can't use a YAML block as the headmatter of the whole slide deck.
38
39 :::
40
40 lines MARKDOWN