@sp-days-framework/create-sp-days 1.0.4 → 1.1.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +14 -0
  2. package/bin/index.js +2 -0
  3. package/docs/advanced-config.mdx +387 -0
  4. package/docs/changelog.mdx +106 -0
  5. package/docs/index.mdx +205 -0
  6. package/docs/install.mdx +199 -0
  7. package/docs/sidebar-sections.mdx +268 -0
  8. package/docs/sp-days-plugin-color-light.svg +53 -0
  9. package/lib/.tsbuildinfo +1 -0
  10. package/lib/.tsbuildinfo-build +1 -0
  11. package/lib/index.d.ts +1 -0
  12. package/lib/index.js +36 -7
  13. package/package.json +31 -7
  14. package/publish-package-docs.js +12 -0
  15. package/templates/addon-resources/resources/api-reference.mdx +132 -0
  16. package/templates/addon-resources/resources/best-practice.mdx +407 -0
  17. package/templates/addon-resources/resources/cheat-sheet.mdx +120 -0
  18. package/templates/addon-resources/resources/cli-reference.mdx +280 -0
  19. package/templates/addon-resources/resources/configuration-guide.mdx +211 -0
  20. package/templates/addon-resources/resources/environment-setup.mdx +317 -0
  21. package/templates/addon-resources/resources/faq.mdx +146 -0
  22. package/templates/addon-resources/resources/glossary.mdx +78 -0
  23. package/templates/addon-resources/resources/index.mdx +67 -16
  24. package/templates/addon-resources/resources/quick-start.mdx +193 -0
  25. package/templates/addon-resources/resources/troubleshooting.mdx +263 -0
  26. package/templates/addon-resources/resources/useful-links.mdx +61 -0
  27. package/templates/page-course/README.md +62 -0
  28. package/templates/page-course/docusaurus.config.ts +59 -11
  29. package/templates/page-course/package.json +12 -2
  30. package/templates/page-course/sidebarSections.js +118 -0
  31. package/tsconfig.base.client.json +10 -0
  32. package/tsconfig.base.json +71 -0
  33. package/tsconfig.build.json +9 -0
  34. package/sp-days-framework-create-sp-days-1.0.3.tgz +0 -0
  35. package/templates/addon-resources/resources/interactive-tasks/creating-tasks.mdx +0 -254
  36. package/templates/addon-resources/resources/interactive-tasks/examples/_category_.yml +0 -3
  37. package/templates/addon-resources/resources/interactive-tasks/examples/advanced-usage.mdx +0 -304
  38. package/templates/addon-resources/resources/interactive-tasks/examples/basic-usage.mdx +0 -128
  39. package/templates/addon-resources/resources/interactive-tasks/index.mdx +0 -93
  40. package/templates/addon-resources/resources/interactive-tasks/setup/advanced-configuration.mdx +0 -273
  41. package/templates/addon-resources/resources/interactive-tasks/setup/index.mdx +0 -120
  42. package/templates/addon-resources/resources/interactive-tasks/task-progression.mdx +0 -140
  43. package/templates/addon-resources/resources/slidev-integration/index.mdx +0 -106
  44. package/templates/addon-resources/resources/slidev-integration/setup/advanced-configuration.mdx +0 -144
  45. package/templates/addon-resources/resources/slidev-integration/setup/index.mdx +0 -200
  46. package/templates/addon-resources/resources/sykehuspartner-theme/index.mdx +0 -105
  47. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/_category_.yml +0 -2
  48. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/_category_.yml +0 -2
  49. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/center.mdx +0 -33
  50. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/default.mdx +0 -59
  51. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/full.mdx +0 -49
  52. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/_category_.yml +0 -2
  53. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-left.mdx +0 -37
  54. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-right.mdx +0 -37
  55. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image.mdx +0 -56
  56. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/_category_.yml +0 -2
  57. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols-header.mdx +0 -49
  58. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols.mdx +0 -47
  59. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols-header.mdx +0 -43
  60. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols.mdx +0 -38
  61. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/_category_.yml +0 -2
  62. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/cover.mdx +0 -43
  63. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/end.mdx +0 -33
  64. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/intro.mdx +0 -49
  65. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/section.mdx +0 -41
  66. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/_category_.yml +0 -2
  67. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/about-me.mdx +0 -92
  68. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/fact.mdx +0 -47
  69. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/quote.mdx +0 -27
  70. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/statement.mdx +0 -28
  71. package/templates/addon-resources/resources/sykehuspartner-theme/setup/advanced-configuration.mdx +0 -79
  72. package/templates/addon-resources/resources/sykehuspartner-theme/setup/index.mdx +0 -104
  73. package/templates/addon-resources/resources/sykehuspartner-theme/syntax-and-icons.mdx +0 -89
  74. package/templates/addon-slidev/package.json +0 -54
package/docs/index.mdx ADDED
@@ -0,0 +1,205 @@
1
+ ---
2
+ title: Create SP Days
3
+ hide_title: true
4
+ sidebar_label: "📦 Create SP Days"
5
+ sidebar_position: 0
6
+ ---
7
+
8
+ import Tabs from "@theme/Tabs";
9
+ import TabItem from "@theme/TabItem";
10
+ import LogoSPDays from './sp-days-plugin-color-light.svg';
11
+
12
+ <div align="center">
13
+ <div style={{ display: 'flex', justifyContent: 'center', margin: '1rem' }}>
14
+ <LogoSPDays width="110" height="110"/>
15
+ </div>
16
+ <div align="center">
17
+ # Create SP Days
18
+ </div>
19
+ <div align="center">
20
+ <p>
21
+ *Scaffolding tool for creating SP Days course websites!*
22
+ </p>
23
+ <h4>
24
+ <a href="./create-sp-days/install/">🔧 Setup</a> ·
25
+ <a href="https://www.npmjs.com/package/@sp-days-framework/create-sp-days">📦 NPM Package</a> ·
26
+ <a href="https://github.com/helse-sorost/sp-days-framework">💻 Source Code</a>
27
+ </h4>
28
+ </div>
29
+ </div>
30
+
31
+ ---
32
+
33
+ ## Features
34
+
35
+ - **Zero-Config Setup** - Get started with a fully configured course website in minutes
36
+ - **Interactive CLI** - Guided setup process with sensible defaults
37
+ - **Flexible Templates** - Base course structure with optional Slidev and Resources addons
38
+ - **TypeScript Ready** - Full TypeScript support out of the box
39
+ - **Multiple Package Managers** - Works with npm, yarn, pnpm, and bun
40
+ - **GitHub Integration** - Pre-configured for GitHub Pages deployment
41
+
42
+ ## Quick Start
43
+
44
+ ### Interactive Mode (Recommended)
45
+
46
+ Run the scaffolding tool and follow the prompts:
47
+
48
+ ```bash
49
+ npx @sp-days-framework/create-sp-days
50
+ ```
51
+
52
+ You'll be asked for:
53
+
54
+ - **Site name** - Directory name for your project
55
+ - **Project details** - Name, GitHub org, repository
56
+ - **Branding** - Site title and tagline
57
+ - **Features** - Enable Slidev presentations and/or Resources documentation
58
+
59
+ ### Quick Create
60
+
61
+ Create a new course with one command:
62
+
63
+ ```bash
64
+ npx @sp-days-framework/create-sp-days my-course
65
+ ```
66
+
67
+ This creates a basic course structure in the `my-course` directory. You can customize it later.
68
+
69
+ ## What You Get
70
+
71
+ ### Base Template (Always Included)
72
+
73
+ Every SP-Days course comes with:
74
+
75
+ - **Docusaurus 3.x** - Modern documentation framework
76
+ - **Interactive Tasks** - Hands-on learning exercises with built-in task tracking
77
+ - **Frontpage Components** - Beautiful landing page components and layouts
78
+ - **Course Structure** - Pre-configured `/course` directory ready for your content
79
+ - **TypeScript** - Full type safety and IntelliSense support
80
+ - **SASS Support** - Custom styling capabilities
81
+ - **Mermaid Diagrams** - Create flowcharts, sequence diagrams, and more
82
+
83
+ ### Optional Addons
84
+
85
+ <Tabs>
86
+ <TabItem value="slidev" label="Slidev Integration" default>
87
+ Add presentation capabilities to your course:
88
+
89
+ ```bash
90
+ npx @sp-days-framework/create-sp-days my-course --addon-slidev
91
+ ```
92
+
93
+ Includes:
94
+
95
+ - Slidev integration plugin
96
+ - Sykehuspartner theme
97
+ - Example presentations
98
+ - `npm run slidev` command
99
+ </TabItem>
100
+ <TabItem value="resources" label="Resources Documentation">
101
+ Add comprehensive documentation:
102
+
103
+ ```bash
104
+ npx @sp-days-framework/create-sp-days my-course --addon-resources
105
+ ```
106
+
107
+ Includes:
108
+
109
+ - Separate documentation instance
110
+ - Component usage guides
111
+ - Setup examples
112
+ - Best practices
113
+ </TabItem>
114
+ <TabItem value="package-docs" label="Package Documentation">
115
+ Add developer documentation for all installed plugins:
116
+
117
+ ```bash
118
+ npx @sp-days-framework/create-sp-days my-course --include-package-docs
119
+ ```
120
+
121
+ Includes:
122
+
123
+ - Plugin API documentation
124
+ - Developer guides
125
+ - Accessible via "Plugin Docs" dropdown
126
+ - Routes: `/package-docs/interactive-tasks`, etc.
127
+
128
+ :::info Package Documentation Feature
129
+ Starting from version 1.1.0, all `@sp-days-framework` packages include their documentation as pre-made Docusaurus MDX files. This feature is useful for package development and easier documentation access, but adds unnecessary dependencies for production builds.
130
+
131
+ **Note:** Enabling package documentation automatically installs the Slidev addon (even if not explicitly requested) because package docs include Slidev theme documentation.
132
+ :::
133
+ </TabItem>
134
+ </Tabs>
135
+
136
+ ## Getting Started
137
+
138
+ ### 1. Create Your Course
139
+
140
+ <Tabs>
141
+ <TabItem value="interactive" label="Interactive Mode" default>
142
+ ```bash
143
+ npx @sp-days-framework/create-sp-days
144
+ ```
145
+
146
+ Follow the prompts to configure your course. The interactive mode guides you through all options with helpful defaults and suggestions.
147
+ </TabItem>
148
+ <TabItem value="cli" label="CLI Mode">
149
+ ```bash
150
+ npx @sp-days-framework/create-sp-days docker-course \
151
+ --title "Docker Fundamentals" \
152
+ --tagline "Master containerization" \
153
+ --addon-slidev
154
+ ```
155
+
156
+ Specify all options upfront. Perfect for scripting or when you know exactly what you want.
157
+ </TabItem>
158
+ </Tabs>
159
+
160
+ ### 2. Add Your Content
161
+
162
+ Create your course content in the generated project:
163
+
164
+ **Main landing page:**
165
+ - Edit `src/pages/index.mdx` to customize your course homepage
166
+
167
+ **Course modules:**
168
+ - Add lessons in `course/` directory
169
+ - Each `.mdx` file becomes a page
170
+
171
+ **Presentations (if `--addon-slidev` enabled):**
172
+ - Create slides in `slidev/` directory
173
+ - Run `npm run slidev ./slidev/your-presentation.md` for live preview
174
+
175
+ **Resources (if `--addon-resources` enabled):**
176
+ - Add documentation in `resources/` directory
177
+
178
+ ### 3. Development
179
+
180
+ Start the development server:
181
+
182
+ ```bash
183
+ npm start
184
+ ```
185
+
186
+ Open `http://localhost:3000` to see your course site. The server will hot-reload as you edit content.
187
+
188
+ See [Installation](./install.mdx) for detailed configuration options.
189
+
190
+ ## Available Commands
191
+
192
+ After creating your course, use these commands:
193
+
194
+ | Command | Description |
195
+ |---------|-------------|
196
+ | `npm start` | Start development server with hot-reload |
197
+ | `npm run build` | Build for production |
198
+ | `npm run serve` | Preview production build locally |
199
+ | `npm run slidev` | Launch Slidev (if `--addon-slidev` enabled) |
200
+ | `npm run typecheck` | Run TypeScript type checking |
201
+
202
+ ## Requirements
203
+
204
+ - **Node.js** >= 20.0
205
+ - **Package Manager** - npm, yarn, pnpm, or bun
@@ -0,0 +1,199 @@
1
+ ---
2
+ sidebar_position: 1.1
3
+ sidebar_custom_props:
4
+ section: "Setup"
5
+ section_position: 1
6
+ ---
7
+
8
+ import Tabs from "@theme/Tabs";
9
+ import TabItem from "@theme/TabItem";
10
+
11
+ # Installation
12
+
13
+ No installation required! Use `npx` to run the latest version:
14
+
15
+ ```bash
16
+ npx @sp-days-framework/create-sp-days
17
+ ```
18
+
19
+ Or install globally if you create courses frequently:
20
+
21
+ <Tabs>
22
+ <TabItem value="npm" label="npm" default>
23
+ ```bash
24
+ npm install -g @sp-days-framework/create-sp-days
25
+ ```
26
+ </TabItem>
27
+ <TabItem value="yarn" label="Yarn">
28
+ ```bash
29
+ yarn global add @sp-days-framework/create-sp-days
30
+ ```
31
+ </TabItem>
32
+ <TabItem value="pnpm" label="pnpm">
33
+ ```bash
34
+ pnpm add -g @sp-days-framework/create-sp-days
35
+ ```
36
+ </TabItem>
37
+ <TabItem value="bun" label="Bun">
38
+ ```bash
39
+ bun add -g @sp-days-framework/create-sp-days
40
+ ```
41
+ </TabItem>
42
+ </Tabs>
43
+
44
+ Then run the tool:
45
+
46
+ ```bash
47
+ create-sp-days my-course
48
+ ```
49
+
50
+ ## Usage Examples
51
+
52
+ ### Interactive Setup (Recommended)
53
+
54
+ The easiest way to get started is interactive mode:
55
+
56
+ ```bash
57
+ npx @sp-days-framework/create-sp-days
58
+ ```
59
+
60
+ **What you'll be asked:**
61
+
62
+ 1. **Site name** - Directory name (e.g., `docs`)
63
+ 2. **Project name** - Package name (defaults to site name)
64
+ 3. **GitHub organization** - Your org (defaults to `helse-sorost`)
65
+ 4. **Repository name** - Repo name (defaults to project name)
66
+ 5. **Site title** - Display title (e.g., `Docker Fundamentals`)
67
+ 6. **Tagline** - Brief description (e.g., `Master containerization`)
68
+ 7. **Add Slidev?** - Enable presentations (yes/no)
69
+ 8. **Add Resources?** - Enable documentation (yes/no)
70
+
71
+ :::tip[Auto-detection]
72
+ The package manager is auto-detected from your system. You can override it by selecting a different option.
73
+ :::
74
+
75
+ ### Minimal Setup
76
+
77
+ Create a basic course with defaults:
78
+
79
+ ```bash
80
+ npx @sp-days-framework/create-sp-days my-course
81
+ ```
82
+
83
+ This creates a project with:
84
+
85
+ - Directory: `my-course`
86
+ - Title: `SP Days Template`
87
+ - Tagline: `Empowered by Docusaurus and Slidev`
88
+ - Organization: `helse-sorost`
89
+ - No addons
90
+
91
+ ### Skip Dependency Installation
92
+
93
+ Create the structure without installing dependencies:
94
+
95
+ ```bash
96
+ npx @sp-days-framework/create-sp-days my-course --skip-install
97
+ cd my-course
98
+ npm install
99
+ ```
100
+
101
+ Useful when:
102
+
103
+ - You want to review the structure first
104
+ - You need to configure proxies or registries
105
+ - You're working offline
106
+
107
+ ## Understanding Addons
108
+
109
+ ### Base Template Features
110
+
111
+ Every course includes:
112
+
113
+ ```json title="package.json" {3-5}
114
+ {
115
+ "dependencies": {
116
+ "@docusaurus/core": "3.9.2",
117
+ "@sp-days-framework/docusaurus-plugin-interactive-tasks": "^1.0.0",
118
+ "@sp-days-framework/docusaurus-frontpage-collection": "^1.0.0"
119
+ }
120
+ }
121
+ ```
122
+
123
+ **Pre-configured:**
124
+
125
+ - Docusaurus preset-classic
126
+ - Interactive task system
127
+ - Frontpage component library
128
+ - TypeScript support
129
+ - SASS/SCSS styling
130
+ - Mermaid diagram support
131
+
132
+ ### Slidev Addon (`--addon-slidev`)
133
+
134
+ Adds presentation capabilities:
135
+
136
+ ```json title="package.json" {6-7}
137
+ {
138
+ "dependencies": {
139
+ "@docusaurus/core": "3.9.2",
140
+ "@sp-days-framework/docusaurus-plugin-interactive-tasks": "^1.0.0",
141
+ "@sp-days-framework/docusaurus-frontpage-collection": "^1.0.0",
142
+ "@sp-days-framework/docusaurus-plugin-slidev": "^1.0.0",
143
+ "@sp-days-framework/slidev-theme-sykehuspartner": "^1.0.0"
144
+ }
145
+ }
146
+ ```
147
+
148
+ **Adds:**
149
+
150
+ - `/slidev` directory with example presentations
151
+ - Slidev plugin configuration
152
+ - `npm run slidev` script
153
+ - Presentation overview page
154
+
155
+ **When to use:**
156
+
157
+ - Course includes lectures or presentations
158
+ - You want slide-based content alongside documentation
159
+ - You need speaker notes and presenter mode
160
+
161
+ ### Resources Addon (`--addon-resources`)
162
+
163
+ Adds comprehensive documentation:
164
+
165
+ **Adds:**
166
+
167
+ - `/resources` directory structure
168
+ - Component usage guides
169
+ - Setup and configuration examples
170
+ - Best practices documentation
171
+
172
+ **When to use:**
173
+
174
+ - Large courses needing separate documentation
175
+ - Multiple instructors needing reference materials
176
+ - Courses with complex component usage
177
+
178
+ ### Package Documentation (`--include-package-docs`)
179
+
180
+ Adds comprehensive developer documentation:
181
+
182
+ **Adds:**
183
+
184
+ - Documentation instances for all installed plugins
185
+ - API references and developer guides
186
+ - "Plugin Docs" dropdown in navbar
187
+ - Routes like `/package-docs/interactive-tasks`
188
+
189
+ **When to use:**
190
+
191
+ - Package development and testing
192
+ - Easier access to plugin documentation
193
+ - Demoing framework capabilities
194
+
195
+ :::warning Production Considerations
196
+ Starting from version 1.1.0, all `@sp-days-framework` packages include their documentation as pre-made Docusaurus MDX files. While useful for development, this feature adds unnecessary dependencies to production builds. Consider removing it before deploying (see generated README for instructions).
197
+
198
+ **Important:** Enabling package documentation automatically installs the Slidev addon because package docs include Slidev theme documentation.
199
+ :::
@@ -0,0 +1,268 @@
1
+ ---
2
+ sidebar_position: 2
3
+ sidebar_label: "Sidebar Sections"
4
+ sidebar_custom_props:
5
+ section: "Components"
6
+ section_position: 2
7
+ ---
8
+
9
+ import Tabs from "@theme/Tabs";
10
+ import TabItem from "@theme/TabItem";
11
+
12
+ # Dynamic Sidebar Sections
13
+
14
+ Group related documentation pages under visual separators in the sidebar without creating static category structures.
15
+
16
+ ## Overview
17
+
18
+ The dynamic sidebar sections feature allows you to organize documentation by adding custom section separators that group related pages together. Pages are grouped based on a `section` property in their frontmatter, and sections appear with visual separators in the sidebar.
19
+
20
+ **Benefits:**
21
+ - Keep files in a flat structure (no nested folders required)
22
+ - Flexible grouping without static `_category_.json` files
23
+ - Multiple sections per documentation instance
24
+ - Visual separation for better navigation
25
+ - Maintains alphabetical or position-based ordering within sections
26
+
27
+ ## Setup
28
+
29
+ The `sidebarSections.js` file is included by default in projects created with `create-sp-days`. Simply configure it in your Docusaurus config:
30
+
31
+ ### Configure Docusaurus
32
+
33
+ Add the `sidebarItemsGenerator` option to your docs plugin configuration:
34
+
35
+ ```typescript title="docusaurus.config.ts"
36
+ {
37
+ plugins: [
38
+ [
39
+ "@docusaurus/plugin-content-docs",
40
+ {
41
+ id: "resources",
42
+ path: "resources",
43
+ routeBasePath: "resources",
44
+ // highlight-next-line
45
+ sidebarItemsGenerator: require('./sidebarSections'),
46
+ },
47
+ ],
48
+ ],
49
+ }
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ ### Add Section to Pages
55
+
56
+ In the frontmatter of any documentation page, add the `sidebar_custom_props.section` field:
57
+
58
+ ```mdx title="api-reference.mdx"
59
+ ---
60
+ sidebar_label: "API Reference"
61
+ sidebar_custom_props:
62
+ section: "Templates"
63
+ section_position: 2
64
+ ---
65
+
66
+ # API Reference Template
67
+
68
+ Your content here...
69
+ ```
70
+
71
+ ```mdx title="quick-start.mdx"
72
+ ---
73
+ sidebar_label: "Quick Start"
74
+ sidebar_custom_props:
75
+ section: "Getting Started"
76
+ section_position: 1
77
+ ---
78
+
79
+ # Quick Start Guide
80
+
81
+ Your content here...
82
+ ```
83
+
84
+ The `section_position` field is optional and controls the order in which sections appear. Sections without a position will be sorted alphabetically after positioned sections.
85
+
86
+ ### Add Section to Categories
87
+
88
+ You can also apply sections to entire directories (categories) using `_category_.yml` or `_category_.json` files:
89
+
90
+ <Tabs>
91
+ <TabItem value="yaml" label="YAML" default>
92
+ ```yaml title="docs/layouts/_category_.yml"
93
+ position: 3
94
+ label: "Layouts"
95
+ customProps:
96
+ section: "Components"
97
+ section_position: 2
98
+ ```
99
+ </TabItem>
100
+ <TabItem value="json" label="JSON">
101
+ ```json title="docs/templates/_category_.json"
102
+ {
103
+ "position": 2,
104
+ "label": "Templates",
105
+ "customProps": {
106
+ "section": "Reference",
107
+ "section_position": 3
108
+ }
109
+ }
110
+ ```
111
+ </TabItem>
112
+ </Tabs>
113
+
114
+ This groups the entire category under the specified section, allowing you to organize both individual pages and directories together.
115
+
116
+ ### Pages Without Sections
117
+
118
+ Pages without a `section` property will appear at the top of the sidebar in their natural order:
119
+
120
+ ```mdx title="introduction.mdx"
121
+ ---
122
+ sidebar_label: "Introduction"
123
+ sidebar_position: 1
124
+ ---
125
+
126
+ # Introduction
127
+
128
+ This page appears before any sections.
129
+ ```
130
+
131
+ ## Example Sidebar Structure
132
+
133
+ With the following pages:
134
+
135
+ - `introduction.mdx` (no section, `sidebar_position: 1`)
136
+ - `best-practices.mdx` (no section, `sidebar_position: 2`)
137
+ - `quick-start.mdx` (`section: "Getting Started"`)
138
+ - `installation.mdx` (`section: "Getting Started"`)
139
+ - `api-reference.mdx` (`section: "Templates"`)
140
+ - `cheat-sheet.mdx` (`section: "Templates"`)
141
+
142
+ The sidebar will display as:
143
+
144
+ ```
145
+ Introduction
146
+ Best Practices
147
+ ───── Getting Started ─────
148
+ Quick Start
149
+ Installation
150
+ ───── Templates ─────
151
+ API Reference
152
+ Cheat Sheet
153
+ ```
154
+
155
+ ## Multiple Sections
156
+
157
+ You can create as many sections as needed. Each unique `section` value creates a new separator:
158
+
159
+ ```mdx
160
+ sidebar_custom_props:
161
+ section: "Advanced Topics"
162
+ ```
163
+
164
+ ```mdx
165
+ sidebar_custom_props:
166
+ section: "Reference"
167
+ ```
168
+
169
+ ```mdx
170
+ sidebar_custom_props:
171
+ section: "Troubleshooting"
172
+ ```
173
+
174
+ ## Ordering
175
+
176
+ ### Within Sections
177
+
178
+ Use `sidebar_position` to control the order of pages within a section:
179
+
180
+ ```mdx
181
+ ---
182
+ sidebar_label: "Basic Usage"
183
+ sidebar_position: 1
184
+ sidebar_custom_props:
185
+ section: "Templates"
186
+ section_position: 2
187
+ ---
188
+ ```
189
+
190
+ ```mdx
191
+ ---
192
+ sidebar_label: "Advanced Usage"
193
+ sidebar_position: 2
194
+ sidebar_custom_props:
195
+ section: "Templates"
196
+ section_position: 2
197
+ ---
198
+ ```
199
+
200
+ ### Section Order
201
+
202
+ Use `section_position` to control the order in which sections appear:
203
+
204
+ - Sections with `section_position: 1` appear first
205
+ - Sections with `section_position: 2` appear second, etc.
206
+ - Sections without `section_position` are sorted alphabetically and appear last
207
+
208
+ **Important:** All pages within the same section must use the same `section_position` value (or all omit it). Mixing different `section_position` values within a section will throw a validation error.
209
+
210
+ ```mdx title="✅ Correct - Same section_position for all pages in section"
211
+ # Page 1
212
+ sidebar_custom_props:
213
+ section: "Templates"
214
+ section_position: 2
215
+
216
+ # Page 2
217
+ sidebar_custom_props:
218
+ section: "Templates"
219
+ section_position: 2
220
+ ```
221
+
222
+ ```mdx title="❌ Incorrect - Different section_position values"
223
+ # Page 1
224
+ sidebar_custom_props:
225
+ section: "Templates"
226
+ section_position: 2
227
+
228
+ # Page 2
229
+ sidebar_custom_props:
230
+ section: "Templates"
231
+ section_position: 3 # ❌ Error!
232
+ ```
233
+
234
+ :::tip
235
+ You only need to add `section_position` to one page in each section - if omitted on other pages in the same section, they'll inherit the behavior. However, adding it to all pages makes the intent clearer.
236
+ :::
237
+
238
+ :::warning Limitations
239
+ - Use only **one** `section` value per page
240
+ - All pages in a section must have the same `section_position` (or none)
241
+ :::
242
+
243
+ ## Styling Customization
244
+
245
+ The separator styling uses CSS custom properties for theming:
246
+
247
+ - `--ifm-color-emphasis-600` - Text color
248
+ - `--ifm-color-emphasis-300` - Border color
249
+
250
+ To customize the separator appearance, edit the inline styles in `sidebarSections.js`:
251
+
252
+ ```javascript title="sidebarSections.js"
253
+ value: `<div style="margin: 1rem 0 0.5rem; padding: 0.25rem 0; font-size: 0.75rem; ...">${sectionName}</div>`,
254
+ ```
255
+
256
+ You can also target the generated class names with CSS:
257
+
258
+ ```css title="custom.css"
259
+ [class*="sidebar-section-"] {
260
+ /* Custom styles for all section separators */
261
+ }
262
+
263
+ .sidebar-section-templates {
264
+ /* Styles specific to "Templates" section */
265
+ }
266
+ ```
267
+
268
+ Class names are auto-generated from section names: `"Templates"` → `sidebar-section-templates`, `"Getting Started"` → `sidebar-section-getting-started`.