@sp-days-framework/docusaurus-plugin-slidev 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +286 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/lib/plugin/builder.d.ts +31 -0
- package/lib/plugin/builder.d.ts.map +1 -0
- package/lib/plugin/builder.js +421 -0
- package/lib/plugin/builder.js.map +1 -0
- package/lib/plugin/index.d.ts +18 -0
- package/lib/plugin/index.d.ts.map +1 -0
- package/lib/plugin/index.js +148 -0
- package/lib/plugin/index.js.map +1 -0
- package/lib/plugin/scanner.d.ts +12 -0
- package/lib/plugin/scanner.d.ts.map +1 -0
- package/lib/plugin/scanner.js +119 -0
- package/lib/plugin/scanner.js.map +1 -0
- package/lib/theme/SlidevCard/index.d.ts +12 -0
- package/lib/theme/SlidevCard/index.d.ts.map +1 -0
- package/lib/theme/SlidevCard/index.js +74 -0
- package/lib/theme/SlidevCard/index.js.map +1 -0
- package/lib/theme/SlidevCard/styles.module.css +206 -0
- package/lib/theme/SlidevOverview/index.d.ts +6 -0
- package/lib/theme/SlidevOverview/index.d.ts.map +1 -0
- package/lib/theme/SlidevOverview/index.js +165 -0
- package/lib/theme/SlidevOverview/index.js.map +1 -0
- package/lib/theme/SlidevOverview/styles.module.css +283 -0
- package/lib/theme/SlidevPresentation/index.d.ts +6 -0
- package/lib/theme/SlidevPresentation/index.d.ts.map +1 -0
- package/lib/theme/SlidevPresentation/index.js +75 -0
- package/lib/theme/SlidevPresentation/index.js.map +1 -0
- package/lib/theme/SlidevPresentation/styles.module.css +178 -0
- package/lib/types/index.d.ts +171 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +6 -0
- package/lib/types/index.js.map +1 -0
- package/lib/utils/fileSystem.d.ts +19 -0
- package/lib/utils/fileSystem.d.ts.map +1 -0
- package/lib/utils/fileSystem.js +89 -0
- package/lib/utils/fileSystem.js.map +1 -0
- package/lib/utils/icons.d.ts +23 -0
- package/lib/utils/icons.d.ts.map +1 -0
- package/lib/utils/icons.js +37 -0
- package/lib/utils/icons.js.map +1 -0
- package/lib/utils/logger.d.ts +43 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/utils/logger.js +92 -0
- package/lib/utils/logger.js.map +1 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Helse Sør-Øst
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# @sp-days-framework/docusaurus-plugin-slidev
|
|
2
|
+
|
|
3
|
+
Seamlessly integrate Slidev presentations into your Docusaurus site with automatic builds, preview thumbnails, and a beautiful overview page.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Automatic Discovery** - Scans directories for Slidev markdown files and builds them automatically
|
|
8
|
+
- **Interactive Overview Page** - Auto-generated gallery with presentation previews, metadata, and sorting
|
|
9
|
+
- **Zero-Config Setup** - Works out of the box with sensible defaults
|
|
10
|
+
- **Theme Support** - Global or per-presentation theme configuration with automatic validation
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @sp-days-framework/docusaurus-plugin-slidev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### 1. Add to Docusaurus Config
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// docusaurus.config.ts
|
|
24
|
+
import type { Config } from "@docusaurus/types";
|
|
25
|
+
|
|
26
|
+
const config: Config = {
|
|
27
|
+
// Ensure staticDirectories includes 'static'
|
|
28
|
+
staticDirectories: ["static"],
|
|
29
|
+
|
|
30
|
+
plugins: ["@sp-days-framework/docusaurus-plugin-slidev"],
|
|
31
|
+
|
|
32
|
+
themeConfig: {
|
|
33
|
+
navbar: {
|
|
34
|
+
items: [{ to: "/slidev", label: "Presentations", position: "left" }],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default config;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Create Your First Presentation
|
|
43
|
+
|
|
44
|
+
Create `slidev/introduction.md` in your Docusaurus project:
|
|
45
|
+
|
|
46
|
+
```md
|
|
47
|
+
---
|
|
48
|
+
title: Introduction to Our Product
|
|
49
|
+
description: A comprehensive overview of features and benefits
|
|
50
|
+
author: Your Name
|
|
51
|
+
theme: default
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
# Welcome!
|
|
55
|
+
|
|
56
|
+
This is my first slide.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Build and View
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm run build
|
|
65
|
+
npm run serve
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Visit `http://localhost:3000/slidev` to see your presentation overview!
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### Basic Configuration
|
|
73
|
+
|
|
74
|
+
The plugin works with zero configuration, but you can customize it:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import type { PluginOptions } from "@sp-days-framework/docusaurus-plugin-slidev";
|
|
78
|
+
|
|
79
|
+
const config: Config = {
|
|
80
|
+
plugins: [
|
|
81
|
+
[
|
|
82
|
+
"@sp-days-framework/docusaurus-plugin-slidev",
|
|
83
|
+
{
|
|
84
|
+
sourceDir: "./slidev",
|
|
85
|
+
outputDir: "slides",
|
|
86
|
+
overviewPath: "/presentations",
|
|
87
|
+
overviewTitle: "Our Presentations",
|
|
88
|
+
overviewTagline: "Browse our collection of interactive slides",
|
|
89
|
+
download: true,
|
|
90
|
+
buildTimeout: 90,
|
|
91
|
+
} satisfies PluginOptions,
|
|
92
|
+
],
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Organizing Presentations
|
|
98
|
+
|
|
99
|
+
Organize presentations in subdirectories for better structure:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
slidev/
|
|
103
|
+
├── workshop/
|
|
104
|
+
│ ├── introduction.md
|
|
105
|
+
│ └── advanced.md
|
|
106
|
+
├── training/
|
|
107
|
+
│ ├── basics.md
|
|
108
|
+
│ └── best-practices.md
|
|
109
|
+
└── conference/
|
|
110
|
+
└── keynote.md
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Each presentation gets a unique URL based on its path:
|
|
114
|
+
|
|
115
|
+
- `workshop/introduction.md` → `/slides/workshop-introduction/`
|
|
116
|
+
- `training/basics.md` → `/slides/training-basics/`
|
|
117
|
+
|
|
118
|
+
### Per-Presentation Themes
|
|
119
|
+
|
|
120
|
+
Specify a theme in the frontmatter:
|
|
121
|
+
|
|
122
|
+
```md
|
|
123
|
+
---
|
|
124
|
+
title: My Presentation
|
|
125
|
+
theme: "@slidev/theme-seriph"
|
|
126
|
+
---
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Or set a global theme in plugin options:
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
{
|
|
133
|
+
theme: '@slidev/theme-seriph', // Applied to all presentations
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Note:** Make sure to install the theme package:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npm install @slidev/theme-seriph
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Frontmatter Options
|
|
144
|
+
|
|
145
|
+
Slidev plugin support the current frontmatter configuration:
|
|
146
|
+
|
|
147
|
+
```md
|
|
148
|
+
---
|
|
149
|
+
title: Advanced Topics
|
|
150
|
+
description: Deep dive into advanced features
|
|
151
|
+
author: Jane Doe
|
|
152
|
+
---
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
See [Slidev documentation](https://sli.dev/guide/syntax.html#frontmatter) for all available options.
|
|
156
|
+
|
|
157
|
+
## Configuration
|
|
158
|
+
|
|
159
|
+
| Option | Type | Default | Description |
|
|
160
|
+
| ----------------- | --------- | ------------------------------------- | ------------------------------------------------------------------ |
|
|
161
|
+
| `sourceDir` | `string` | `'./slidev'` | Directory to scan for Slidev markdown files |
|
|
162
|
+
| `outputDir` | `string` | `'slides'` | Output directory inside `static/` for built presentations |
|
|
163
|
+
| `theme` | `string` | `undefined` | Global theme override for all presentations |
|
|
164
|
+
| `download` | `boolean` | `false` | Enable PDF download functionality (requires `playwright-chromium`) |
|
|
165
|
+
| `overviewPath` | `string` | `'/slidev'` | URL path for the auto-generated overview page |
|
|
166
|
+
| `overviewTitle` | `string` | `'Slidev Presentations'` | Custom title for the overview page |
|
|
167
|
+
| `overviewTagline` | `string` | `'Interactive presentation overview'` | Custom tagline/description for the overview page |
|
|
168
|
+
| `id` | `string` | `'default'` | Plugin ID for multiple instances |
|
|
169
|
+
| `buildTimeout` | `number` | `60` | Timeout in seconds for building each presentation (10-600) |
|
|
170
|
+
| `verbose` | `boolean` | `false` | Enable verbose logging for Slidev build output |
|
|
171
|
+
|
|
172
|
+
## Advanced Usage
|
|
173
|
+
|
|
174
|
+
### Multiple Plugin Instances
|
|
175
|
+
|
|
176
|
+
Run multiple instances with different configurations:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
{
|
|
180
|
+
plugins: [
|
|
181
|
+
[
|
|
182
|
+
'@sp-days-framework/docusaurus-plugin-slidev',
|
|
183
|
+
{
|
|
184
|
+
id: 'workshops',
|
|
185
|
+
sourceDir: './workshops',
|
|
186
|
+
outputDir: 'workshop-slides',
|
|
187
|
+
overviewPath: '/workshops',
|
|
188
|
+
overviewTitle: 'Workshop Materials',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
'@sp-days-framework/docusaurus-plugin-slidev',
|
|
193
|
+
{
|
|
194
|
+
id: 'training',
|
|
195
|
+
sourceDir: './training',
|
|
196
|
+
outputDir: 'training-slides',
|
|
197
|
+
overviewPath: '/training',
|
|
198
|
+
overviewTitle: 'Training Courses',
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
],
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Development vs Production
|
|
206
|
+
|
|
207
|
+
### Development Mode (`npm run start`)
|
|
208
|
+
|
|
209
|
+
- Presentations are **not built**
|
|
210
|
+
- Overview page shows "Build Required" badges
|
|
211
|
+
- Preview thumbnails show placeholder icons
|
|
212
|
+
- Faster startup time for development
|
|
213
|
+
|
|
214
|
+
### Production Mode (`npm run build`)
|
|
215
|
+
|
|
216
|
+
- All presentations are **automatically built**
|
|
217
|
+
- Overview page shows interactive preview thumbnails
|
|
218
|
+
- Presentations are fully functional
|
|
219
|
+
|
|
220
|
+
## Troubleshooting
|
|
221
|
+
|
|
222
|
+
### "Slidev CLI not found" Error
|
|
223
|
+
|
|
224
|
+
Install Slidev and required dependencies:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
npm install @slidev/cli @slidev/theme-default vue
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Theme Not Found
|
|
231
|
+
|
|
232
|
+
If using a custom theme, install it first:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
npm install @slidev/theme-seriph
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Then reference it in frontmatter or plugin config:
|
|
239
|
+
|
|
240
|
+
```md
|
|
241
|
+
---
|
|
242
|
+
theme: "@slidev/theme-seriph"
|
|
243
|
+
---
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Build Timeout
|
|
247
|
+
|
|
248
|
+
Increase the timeout for complex presentations:
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
{
|
|
252
|
+
buildTimeout: 180, // 3 minutes
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Presentations Not Showing
|
|
257
|
+
|
|
258
|
+
1. Ensure `staticDirectories: ['static']` is in your Docusaurus config
|
|
259
|
+
2. Run `npm run build` (not just `npm start`)
|
|
260
|
+
3. Check that `.md` files are in the correct `sourceDir`
|
|
261
|
+
4. Verify frontmatter is valid YAML
|
|
262
|
+
|
|
263
|
+
### Preview Thumbnails Not Loading
|
|
264
|
+
|
|
265
|
+
Preview thumbnails only work in production mode after building. In development, placeholder icons are shown instead.
|
|
266
|
+
|
|
267
|
+
## How It Works
|
|
268
|
+
|
|
269
|
+
1. **Scan Phase** - Plugin scans `sourceDir` for `.md` files recursively
|
|
270
|
+
2. **Extract Metadata** - Frontmatter is parsed from each file (title, description, theme, author)
|
|
271
|
+
3. **Build Phase** - In production, Slidev builds each presentation to `static/outputDir/`
|
|
272
|
+
4. **Generate Routes** - Overview page route is registered at `overviewPath`
|
|
273
|
+
5. **Render** - Overview page displays all presentations with previews and metadata
|
|
274
|
+
|
|
275
|
+
## TypeScript Support
|
|
276
|
+
|
|
277
|
+
The plugin includes full TypeScript definitions:
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
import type {
|
|
281
|
+
PluginOptions,
|
|
282
|
+
PresentationMetadata,
|
|
283
|
+
PluginContentData,
|
|
284
|
+
SlidevFrontmatter,
|
|
285
|
+
} from "@sp-days-framework/docusaurus-plugin-slidev";
|
|
286
|
+
```
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,mBAAmB,SAAS,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Main entry point for @sp-days-framework/docusaurus-plugin-slidev
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.validateOptions = exports.default = void 0;
|
|
10
|
+
var plugin_1 = require("./plugin");
|
|
11
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
|
|
12
|
+
var plugin_2 = require("./plugin");
|
|
13
|
+
Object.defineProperty(exports, "validateOptions", { enumerable: true, get: function () { return plugin_2.validateOptions; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,mCAAmC;AAA1B,kHAAA,OAAO,OAAA;AAChB,mCAA2C;AAAlC,yGAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder utility for compiling Slidev presentations
|
|
3
|
+
*/
|
|
4
|
+
import type { PresentationMetadata, PluginOptions, BuildResult } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* Builds a single Slidev presentation with real-time output streaming
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Builds a single Slidev presentation with real-time output streaming
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildPresentation(presentation: PresentationMetadata, options: PluginOptions, context: {
|
|
12
|
+
siteDir: string;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
}): Promise<BuildResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Builds all presentations sequentially
|
|
17
|
+
* Returns array of build results
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildAllPresentations(presentations: PresentationMetadata[], options: PluginOptions, context: {
|
|
20
|
+
siteDir: string;
|
|
21
|
+
baseUrl: string;
|
|
22
|
+
}): Promise<BuildResult[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if Slidev CLI is available
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkSlidevInstalled(): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Diagnoses common issues with a presentation
|
|
29
|
+
*/
|
|
30
|
+
export declare function diagnosePresentationIssues(presentation: PresentationMetadata, siteDir?: string): string[];
|
|
31
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/plugin/builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,WAAW,EACZ,MAAM,UAAU,CAAC;AAoHlB;;GAEG;AACH;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,oBAAoB,EAClC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CAAC,WAAW,CAAC,CAwPtB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,oBAAoB,EAAE,EACrC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CAAC,WAAW,EAAE,CAAC,CA8CxB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAU7D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,oBAAoB,EAClC,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,EAAE,CAuGV"}
|