| 1 | --- |
| 2 | relates: |
| 3 | - features/frontmatter-merging |
| 4 | tags: [syntax] |
| 5 | description: | |
| 6 | Split your `slides.md` into multiple files for better reusability and organization. |
| 7 | --- |
| 8 | |
| 9 | # Importing Slides |
| 10 | |
| 11 | You can split your `slides.md` into multiple files for better reusability and organization. To do this, you can use the `src` frontmatter option to specify the path to the external markdown file. For example: |
| 12 | |
| 13 | ::: code-group |
| 14 | |
| 15 | <!-- eslint-skip --> |
| 16 | |
| 17 | ```md [./slides.md] |
| 18 | # Title |
| 19 | |
| 20 | This is a normal page |
| 21 | |
| 22 | --- |
| 23 | src: ./pages/toc.md // [!code highlight] |
| 24 | --- |
| 25 | |
| 26 | <!-- this page will be loaded from './pages/toc.md' --> |
| 27 | |
| 28 | Contents here are ignored |
| 29 | |
| 30 | --- |
| 31 | |
| 32 | # Page 4 |
| 33 | |
| 34 | Another normal page |
| 35 | |
| 36 | --- |
| 37 | src: ./pages/toc.md # Reuse the same file // [!code highlight] |
| 38 | --- |
| 39 | ``` |
| 40 | |
| 41 | ```md [./pages/toc.md] |
| 42 | # Table of Contents |
| 43 | |
| 44 | Part 1 |
| 45 | |
| 46 | --- |
| 47 | |
| 48 | # Table of Contents |
| 49 | |
| 50 | Part 2 |
| 51 | ``` |
| 52 | |
| 53 | ::: |
| 54 | |
| 55 | ## Importing Specific Slides |
| 56 | |
| 57 | To reuse some of the slides inside another Markdown file, you can use the hash part of the import path: |
| 58 | |
| 59 | ```md |
| 60 | --- |
| 61 | src: ./another-presentation.md#2,5-7 |
| 62 | --- |
| 63 | ``` |
| 64 | |
| 65 | This will import the slides 2, 5, 6, and 7 from `./another-presentation.md`. |
| 66 | |
| 67 | ## Frontmatter Merging |
| 68 | |
| 69 | <LinkCard link="features/frontmatter-merging" /> |
| 70 |