@sp-days-framework/create-sp-days 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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +318 -0
  3. package/bin/index.js +86 -0
  4. package/lib/index.d.ts +20 -0
  5. package/lib/index.js +454 -0
  6. package/package.json +41 -0
  7. package/sp-days-framework-create-sp-days-1.0.0.tgz +0 -0
  8. package/templates/addon-resources/resources/frontpage-collection/components/Columns.mdx +191 -0
  9. package/templates/addon-resources/resources/frontpage-collection/components/ContentBlock.mdx +126 -0
  10. package/templates/addon-resources/resources/frontpage-collection/components/CourseFeature.mdx +147 -0
  11. package/templates/addon-resources/resources/frontpage-collection/components/FancyHeader.mdx +76 -0
  12. package/templates/addon-resources/resources/frontpage-collection/components/GetStarted.mdx +222 -0
  13. package/templates/addon-resources/resources/frontpage-collection/components/HeroBanner.mdx +205 -0
  14. package/templates/addon-resources/resources/frontpage-collection/components/IconContainer.mdx +249 -0
  15. package/templates/addon-resources/resources/frontpage-collection/components/Iconify.mdx +228 -0
  16. package/templates/addon-resources/resources/frontpage-collection/components/_category_.yml +2 -0
  17. package/templates/addon-resources/resources/frontpage-collection/index.mdx +85 -0
  18. package/templates/addon-resources/resources/frontpage-collection/setup/index.mdx +185 -0
  19. package/templates/addon-resources/resources/index.mdx +35 -0
  20. package/templates/addon-resources/resources/interactive-tasks/creating-tasks.mdx +292 -0
  21. package/templates/addon-resources/resources/interactive-tasks/examples/_category_.yml +3 -0
  22. package/templates/addon-resources/resources/interactive-tasks/examples/advanced-usage.mdx +304 -0
  23. package/templates/addon-resources/resources/interactive-tasks/examples/basic-usage.mdx +128 -0
  24. package/templates/addon-resources/resources/interactive-tasks/index.mdx +93 -0
  25. package/templates/addon-resources/resources/interactive-tasks/setup/advanced-configuration.mdx +150 -0
  26. package/templates/addon-resources/resources/interactive-tasks/setup/index.mdx +174 -0
  27. package/templates/addon-resources/resources/interactive-tasks/task-progression.mdx +140 -0
  28. package/templates/addon-resources/resources/slidev-integration/index.mdx +106 -0
  29. package/templates/addon-resources/resources/slidev-integration/setup/advanced-configuration.mdx +144 -0
  30. package/templates/addon-resources/resources/slidev-integration/setup/index.mdx +200 -0
  31. package/templates/addon-resources/resources/sykehuspartner-theme/index.mdx +105 -0
  32. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/_category_.yml +2 -0
  33. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/_category_.yml +2 -0
  34. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/center.mdx +33 -0
  35. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/default.mdx +59 -0
  36. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/full.mdx +49 -0
  37. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/_category_.yml +2 -0
  38. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-left.mdx +37 -0
  39. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-right.mdx +37 -0
  40. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image.mdx +56 -0
  41. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/_category_.yml +2 -0
  42. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols-header.mdx +49 -0
  43. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols.mdx +47 -0
  44. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols-header.mdx +43 -0
  45. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols.mdx +38 -0
  46. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/_category_.yml +2 -0
  47. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/cover.mdx +43 -0
  48. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/end.mdx +33 -0
  49. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/intro.mdx +49 -0
  50. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/section.mdx +41 -0
  51. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/_category_.yml +2 -0
  52. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/about-me.mdx +92 -0
  53. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/fact.mdx +47 -0
  54. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/quote.mdx +27 -0
  55. package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/statement.mdx +28 -0
  56. package/templates/addon-resources/resources/sykehuspartner-theme/setup/advanced-configuration.mdx +79 -0
  57. package/templates/addon-resources/resources/sykehuspartner-theme/setup/index.mdx +104 -0
  58. package/templates/addon-resources/resources/sykehuspartner-theme/syntax-and-icons.mdx +89 -0
  59. package/templates/addon-slidev/package.json +54 -0
  60. package/templates/addon-slidev/slidev/creating-your-first-slidev.md +301 -0
  61. package/templates/addon-slidev/slidev/slidev-theme-sykehuspartner.md +403 -0
  62. package/templates/page-course/README.md +152 -0
  63. package/templates/page-course/course/index.mdx +7 -0
  64. package/templates/page-course/course/placeholder-advanced-usage.mdx +304 -0
  65. package/templates/page-course/course/placeholder-basic-usage.mdx +128 -0
  66. package/templates/page-course/docusaurus.config.ts +171 -0
  67. package/templates/page-course/example-github-pages.yml +66 -0
  68. package/templates/page-course/gitignore +20 -0
  69. package/templates/page-course/package.json +51 -0
  70. package/templates/page-course/src/css/sp-days-theme.scss +297 -0
  71. package/templates/page-course/src/pages/index.mdx +165 -0
  72. package/templates/page-course/static/.nojekyll +0 -0
  73. package/templates/page-course/static/img/favicon-navbar/github.svg +3 -0
  74. package/templates/page-course/static/img/favicon-navbar/sorost-logo-dark.svg +24 -0
  75. package/templates/page-course/static/img/favicon-navbar/sorost-logo-light.svg +24 -0
  76. package/templates/page-course/static/img/footer/sykehuspartner-dark.svg +37 -0
  77. package/templates/page-course/static/img/footer/sykehuspartner-light.svg +37 -0
  78. package/templates/page-course/static/img/sidebar/docusaurus.svg +17 -0
  79. package/templates/page-course/static/img/sidebar/slidev.svg +22 -0
  80. package/templates/page-course/static/img/sp-days-logo-color-dark.svg +70 -0
  81. package/templates/page-course/static/img/sp-days-logo-color-light.svg +70 -0
  82. package/templates/page-course/static/img/sp-days-logo-filled-invert.svg +11 -0
  83. package/templates/page-course/static/img/sp-days-logo-filled.svg +11 -0
  84. package/templates/page-course/static/img/sp-days-logo-outline.svg +19 -0
  85. package/templates/page-course/static/img/sp-days-plugin-color-dark.svg +57 -0
  86. package/templates/page-course/static/img/sp-days-plugin-color-light.svg +53 -0
  87. package/templates/page-course/tsconfig.json +8 -0
@@ -0,0 +1,304 @@
1
+ ---
2
+ sidebar_position: 2
3
+ task_section_name: "Demo Module 2"
4
+ ---
5
+
6
+ import { useState } from 'react';
7
+
8
+ # Advanced Task Page
9
+
10
+ Discover how to leverage advanced Docusaurus markdown features within interactive tasks to create rich, engaging learning experiences.
11
+
12
+ <TaskProgression path="." />
13
+
14
+ ---
15
+
16
+ ::::task[Add Syntax Highlighting to Code Blocks]
17
+
18
+ Practice adding syntax-highlighted code blocks to your documentation:
19
+
20
+ 1. Create a code block using triple backticks (```)
21
+ 2. Add the language identifier immediately after the opening backticks
22
+ 3. Write your code inside the block
23
+ 4. Close with triple backticks
24
+
25
+ **Bash example:**
26
+ ```bash
27
+ docker run -d -p 8080:80 nginx
28
+ npm install express
29
+ ```
30
+
31
+ **YAML example:**
32
+ ```yaml
33
+ version: '3.8'
34
+ services:
35
+ web:
36
+ image: nginx:latest
37
+ ports:
38
+ - "8080:80"
39
+ ```
40
+
41
+ **JSON example:**
42
+ ```json
43
+ {
44
+ "name": "my-app",
45
+ "version": "1.0.0",
46
+ "dependencies": {
47
+ "react": "^18.0.0"
48
+ }
49
+ }
50
+ ```
51
+
52
+ :::hint
53
+ Docusaurus supports 30+ languages out of the box. Check the [Prism language list](https://prismjs.com/#supported-languages) for all available options. You can add more languages in `docusaurus.config.ts` - see the [Docusaurus documentation](https://docusaurus.io/docs/markdown-features/code-blocks#supported-languages).
54
+ :::
55
+
56
+ ::::
57
+
58
+ ---
59
+
60
+ ::::task[Add File Names to Code Blocks]
61
+
62
+ Add descriptive file names to your code blocks for better context:
63
+
64
+ 1. After the language identifier, add a space and `title="filename.ext"`
65
+ 2. The filename will appear as a header above the code block
66
+ 3. This helps readers know exactly where code should be placed
67
+
68
+ ```json title="tsconfig.json"
69
+ {
70
+ "compilerOptions": {
71
+ "target": "ES2020",
72
+ "strict": true,
73
+ "strictNullChecks": true,
74
+ "skipLibCheck": true
75
+ }
76
+ }
77
+ ```
78
+
79
+ :::hint
80
+ Use this feature to show exactly where code should be placed in a project structure. It's especially helpful in tutorials with multiple files.
81
+ :::
82
+
83
+ ::::
84
+
85
+ ---
86
+
87
+ ::::task[Highlight Important Code Lines]
88
+
89
+ Learn two methods for highlighting specific lines in code blocks:
90
+
91
+ **Method 1: Inline comments** (best when actively developing)
92
+
93
+ Use `highlight-next-line`, `highlight-start`, and `highlight-end` comments to mark important lines:
94
+
95
+ ```js
96
+ function HighlightSomeText(highlight) {
97
+ if (highlight) {
98
+ // highlight-next-line
99
+ return 'This text is highlighted!';
100
+ }
101
+
102
+ return 'Nothing highlighted';
103
+ }
104
+
105
+ function HighlightMoreText(highlight) {
106
+ // highlight-start
107
+ if (highlight) {
108
+ return 'This range is highlighted!';
109
+ }
110
+ // highlight-end
111
+
112
+ return 'Nothing highlighted';
113
+ }
114
+ ```
115
+
116
+ **Method 2: Meta string** (cleaner for published docs)
117
+
118
+ Add line numbers after the language identifier. Separate multiple lines with commas or use ranges:
119
+
120
+ ```jsx {1,4-6,11}
121
+ import React from 'react';
122
+
123
+ function MyComponent(props) {
124
+ if (props.isBar) {
125
+ return <div>Bar</div>;
126
+ }
127
+
128
+ return <div>Foo</div>;
129
+ }
130
+
131
+ export default MyComponent;
132
+ ```
133
+
134
+ :::hint
135
+
136
+ Supported commenting syntax:
137
+
138
+ | Style | Syntax |
139
+ | ---------- | ------------------------ |
140
+ | C-style | `/* ... */` and `// ...` |
141
+ | JSX-style | `{/* ... */}` |
142
+ | Bash-style | `# ...` |
143
+ | HTML-style | `<!-- ... -->` |
144
+
145
+ Choose inline comments when actively developing, and meta strings for final published documentation.
146
+
147
+ :::
148
+
149
+ ::::
150
+
151
+ ---
152
+
153
+ :::::task[Nest Admonitions in Tasks]
154
+
155
+ Practice nesting admonitions inside tasks by using the correct number of colons:
156
+
157
+ 1. Task containers use 4+ colons: `::::task`
158
+ 2. Hints/solutions use 3+ colons: `:::hint`
159
+ 3. Nested admonitions also use 3+ colons: `:::note`
160
+ 4. For deeper nesting inside hints/solutions, use 4+ colons for the admonition
161
+
162
+ **Rule:** Parent containers always need **more colons** than their children to prevent the parser from prematurely closing containers.
163
+
164
+ :::note
165
+
166
+ This is a note at the task level (3 colons).
167
+
168
+ :::
169
+
170
+ :::warning
171
+
172
+ This is a warning at the task level (3 colons).
173
+
174
+ :::
175
+
176
+ ::::hint
177
+
178
+ This hint contains a nested admonition (4 colons for hint, since it needs to contain a 3-colon admonition):
179
+
180
+ :::note
181
+
182
+ This note is nested inside the hint (3 colons).
183
+
184
+ :::
185
+
186
+ ::::
187
+
188
+ :::::
189
+
190
+ ---
191
+
192
+ ::::task[Use React Components in Tasks]
193
+
194
+ Import and use React components within your task content to create interactive experiences:
195
+
196
+ 1. Import React and any hooks you need at the top of the file: `import { useState } from 'react';`
197
+ 2. Define your component using `export const`
198
+ 3. Use the component anywhere in your MDX content
199
+
200
+ **Example - Interactive Counter:**
201
+
202
+ export const Counter = () => {
203
+ const [count, setCount] = useState(0);
204
+ return (
205
+ <div style={{
206
+ padding: '1rem',
207
+ border: '2px solid var(--ifm-color-primary)',
208
+ borderRadius: '8px',
209
+ textAlign: 'center',
210
+ margin: '1rem 0'
211
+ }}>
212
+ <p style={{ fontSize: '1.5rem', margin: '0.5rem 0' }}>
213
+ Count: <strong>{count}</strong>
214
+ </p>
215
+ <button
216
+ onClick={() => setCount(count + 1)}
217
+ style={{
218
+ marginRight: '0.5rem',
219
+ padding: '0.5rem 1rem',
220
+ fontSize: '1rem',
221
+ cursor: 'pointer'
222
+ }}
223
+ >
224
+ Increment
225
+ </button>
226
+ <button
227
+ onClick={() => setCount(0)}
228
+ style={{
229
+ padding: '0.5rem 1rem',
230
+ fontSize: '1rem',
231
+ cursor: 'pointer'
232
+ }}
233
+ >
234
+ Reset
235
+ </button>
236
+ </div>
237
+ );
238
+ };
239
+
240
+ <Counter />
241
+
242
+ :::hint
243
+
244
+ Tasks support all Docusaurus MDX features, including:
245
+ - React component imports and usage (useState, useEffect, etc.)
246
+ - Tabs, admonitions, and other built-in components
247
+ - Custom CSS and styling with theme-aware variables
248
+ - Interactive JavaScript functionality
249
+
250
+ This makes tasks perfect for interactive tutorials and hands-on learning experiences!
251
+
252
+ :::
253
+
254
+ :::solution
255
+
256
+ Here is the React code running in the task:
257
+
258
+ ```ts
259
+ import { useState } from 'react';
260
+
261
+ export const Counter = () => {
262
+ const [count, setCount] = useState(0);
263
+ return (
264
+ <div style={{
265
+ padding: '1rem',
266
+ border: '2px solid var(--ifm-color-primary)',
267
+ borderRadius: '8px',
268
+ textAlign: 'center',
269
+ margin: '1rem 0'
270
+ }}>
271
+ <p style={{ fontSize: '1.5rem', margin: '0.5rem 0' }}>
272
+ Count: <strong>{count}</strong>
273
+ </p>
274
+ <button
275
+ onClick={() => setCount(count + 1)}
276
+ style={{
277
+ marginRight: '0.5rem',
278
+ padding: '0.5rem 1rem',
279
+ fontSize: '1rem',
280
+ cursor: 'pointer'
281
+ }}
282
+ >
283
+ Increment
284
+ </button>
285
+ <button
286
+ onClick={() => setCount(0)}
287
+ style={{
288
+ padding: '0.5rem 1rem',
289
+ fontSize: '1rem',
290
+ cursor: 'pointer'
291
+ }}
292
+ >
293
+ Reset
294
+ </button>
295
+ </div>
296
+ );
297
+ };
298
+
299
+ <Counter />
300
+ ```
301
+
302
+ :::
303
+
304
+ ::::
@@ -0,0 +1,128 @@
1
+ ---
2
+ sidebar_position: 1
3
+ task_section_name: "Demo Module 1"
4
+ ---
5
+
6
+ # Basic Task Page
7
+
8
+ See interactive tasks in action with real-world examples. This page demonstrates how tasks work in a documentation environment.
9
+
10
+ <TaskProgression path="."/>
11
+
12
+ ---
13
+
14
+ ::::task[Install the Plugin]
15
+
16
+ Follow these steps to add Interactive Tasks to your Docusaurus project:
17
+
18
+ 1. Open your terminal in the project root directory
19
+ 2. Run the installation command for your package manager
20
+ 3. Verify the package appears in your `package.json` dependencies
21
+
22
+
23
+ :::hint
24
+
25
+ If you created your project with `@sp-days-framework/create-sp-days`, this plugin is already installed and you can skip this task.
26
+
27
+ :::
28
+
29
+ ::::
30
+
31
+ ---
32
+
33
+ ::::task[Configure Docusaurus]
34
+
35
+ Add the plugin and remark plugin to your Docusaurus configuration:
36
+
37
+ 1. Open `docusaurus.config.js` in your project root
38
+ 2. Add the plugin to the `plugins` array
39
+ 3. Add the remark plugin to your preset's docs configuration
40
+ 4. Save the file
41
+
42
+ :::solution
43
+
44
+ The plugin needs to be registered in two places: the `plugins` array for the main functionality, and the `remarkPlugins` array to transform task directives in your markdown files.
45
+
46
+ **Verify Configuration:**
47
+
48
+ - The file should have both entries as shown below
49
+ - No syntax errors when running `npm run start`
50
+
51
+ Add to your `docusaurus.config.js`:
52
+
53
+ ```js title="docusaurus.config.js"
54
+ module.exports = {
55
+ plugins: ["@sp-days-framework/docusaurus-plugin-interactive-tasks"],
56
+
57
+ presets: [
58
+ [
59
+ "classic",
60
+ {
61
+ docs: {
62
+ remarkPlugins: [
63
+ require("@sp-days-framework/docusaurus-plugin-interactive-tasks")
64
+ .remarkTaskDirective,
65
+ ],
66
+ },
67
+ },
68
+ ],
69
+ ],
70
+ };
71
+ ```
72
+
73
+ :::
74
+
75
+ ::::
76
+
77
+ ---
78
+
79
+ ::::task[Add Progress Tracking]
80
+
81
+ Display task completion progress on your documentation pages:
82
+
83
+ 1. Import the `TaskProgression` component in your MDX file
84
+ 2. Add the component where you want to show progress
85
+ 3. Provide the path to the document you want to track
86
+
87
+ Add to your MDX file:
88
+
89
+ ```mdx
90
+ import TaskProgression from "@theme/TaskProgression";
91
+
92
+ <TaskProgression path="." />
93
+ ```
94
+
95
+ Reference other pages:
96
+
97
+ ```mdx
98
+ <TaskProgression path="/docs/tutorial/first-task" />
99
+ <TaskProgression path="../module-02/introduction" />
100
+ ```
101
+
102
+ :::hint
103
+
104
+ Use `path="."` to reference the current page, or provide an absolute/relative path to track other pages. The component shows a visual progress bar and completion count.
105
+
106
+ :::
107
+
108
+ ::::
109
+
110
+ ---
111
+
112
+ ::::task[Test Auto-Collapse Feature]
113
+
114
+ Learn how the auto-collapse feature helps you focus on incomplete tasks:
115
+
116
+ 1. Complete at least one task on this page by clicking "Mark as Done"
117
+ 2. Look for the collapse icon button in the navbar
118
+ 3. Click the collapse icon to enable auto-collapse mode
119
+ 4. Observe how completed tasks automatically collapse
120
+ 5. Click the collapse icon again to disable the feature
121
+
122
+ :::hint
123
+
124
+ The auto-collapse setting is saved to your browser's localStorage and syncs across all tabs. This feature is especially useful when working through long tutorial pages with many tasks.
125
+
126
+ :::
127
+
128
+ ::::
@@ -0,0 +1,93 @@
1
+ ---
2
+ title: Interactive Tasks
3
+ sidebar_custom_props:
4
+ sidebar_task_hide_progress: true
5
+ sidebar_class_name: sidebar-logo-docusaurus
6
+ ---
7
+
8
+ import { Iconify } from "@sp-days-framework/docusaurus-frontpage-collection";
9
+
10
+ <div align="center">
11
+ <div className="resourceLandingPage">
12
+ <Iconify icon="logos:docusaurus" width="105px"/>
13
+ </div>
14
+ <div align="center">
15
+ # Docusaurus Interactive Tasks
16
+ </div>
17
+ <div align="center">
18
+ <p>
19
+ *A Docusaurus plugin that transforms documentation into interactive learning experiences!*
20
+ </p>
21
+ <h4>
22
+ [Setup](./setup/index.mdx)
23
+ ·
24
+ [NPM Package](https://www.npmjs.com/package/@sp-days-framework/docusaurus-plugin-interactive-tasks)
25
+ ·
26
+ [Source Code](https://github.com/helse-sorost/sp-days-framework)
27
+ </h4>
28
+ </div>
29
+ </div>
30
+
31
+ ---
32
+
33
+ ## Features
34
+
35
+ - **Interactive Tasks** - Collapsible task components with completion tracking
36
+ - **Hints & Solutions** - Optional toggleable hints and solutions for each task
37
+ - **Auto-Numbering** - Automatic task numbering per page
38
+ - **Persistent Progress** - Completion status saved to localStorage
39
+ - **Progress Tracking** - Visual progress indicators in sidebar and task progression components
40
+ - **Sidebar Badges** - Automatic completion badges (e.g., "2/5") in sidebar navigation
41
+ - **Auto-Collapse Toggle** - Navbar button to enable/disable auto-collapsing of completed tasks
42
+
43
+ ## Getting Started
44
+
45
+ Create interactive tasks using simple markdown directives:
46
+
47
+ ````mdx
48
+ ::::task[Install the Plugin]
49
+
50
+ Install the Interactive Tasks plugin using npm or yarn.
51
+
52
+ :::hint
53
+ Use npm install or yarn add to install the package.
54
+ :::
55
+
56
+ :::solution
57
+ ```bash
58
+ npm install @sp-days-framework/docusaurus-plugin-interactive-tasks
59
+ ```
60
+ :::
61
+
62
+ ::::
63
+ ````
64
+
65
+ <div className="preview">
66
+ <div className="container" style={{ width: '-webkit-fill-available' }}>
67
+ ::::task-example[Install the Plugin]
68
+
69
+ Install the Interactive Tasks plugin using npm or yarn.
70
+
71
+ :::hint
72
+ Use npm install or yarn add to install the package.
73
+ :::
74
+
75
+ :::solution
76
+ ```bash
77
+ npm install @sp-days-framework/docusaurus-plugin-interactive-tasks
78
+ ```
79
+ :::
80
+
81
+ ::::
82
+ </div>
83
+ </div>
84
+ <br>
85
+ </br>
86
+
87
+ Tasks are automatically numbered, track completion in localStorage, and sync across browser tabs. See [Setup](./setup/index.mdx) for installation and configuration.
88
+
89
+ ## Documentation
90
+
91
+ - **[Creating Tasks](./creating-tasks.mdx)** - Learn the task directive syntax
92
+ - **[Task Progression](./task-progression.mdx)** - Display progress with components
93
+ - **[Advanced Configuration](./setup/advanced-configuration.mdx)** - Detailed options and internals
@@ -0,0 +1,150 @@
1
+ ---
2
+ title: Advanced
3
+ sidebar_position: 2
4
+ ---
5
+
6
+ import Tabs from "@theme/Tabs";
7
+ import TabItem from "@theme/TabItem";
8
+
9
+ # Advanced Configuration
10
+
11
+ ## Frontmatter Options Reference
12
+
13
+ | Property | Type | Default | Description |
14
+ | ------------------------------- | --------- | ------- | -------------------------------------------------- |
15
+ | `sidebar_task_hide_progress` | `boolean` | `false` | Hide the task progress badge entirely |
16
+ | `sidebar_task_disable_icon` | `boolean` | `false` | Show "5/5" instead of checkmark icon when complete |
17
+ | `sidebar_task_badge_colors` | `object` | - | Badge color configuration (see below) |
18
+
19
+ ### Badge Colors Structure
20
+
21
+ ```yaml
22
+ sidebar_task_badge_colors:
23
+ completed:
24
+ lightmode: "#4caf50" # Background color when all tasks completed (light mode)
25
+ darkmode: "#66bb6a" # Background color when all tasks completed (dark mode)
26
+ incomplete:
27
+ lightmode: "#2196f3" # Background color when tasks incomplete (light mode)
28
+ darkmode: "#42a5f5" # Background color when tasks incomplete (dark mode)
29
+ font:
30
+ lightmode: "#ffffff" # Text color (light mode)
31
+ darkmode: "#000000" # Text color (dark mode)
32
+ ```
33
+
34
+ **Supported Color Formats:**
35
+
36
+ - Hex: `#ff6b6b`, `#f00`
37
+ - RGB/RGBA: `rgb(255, 107, 107)`, `rgba(255, 107, 107, 0.8)`
38
+ - HSL/HSLA: `hsl(0, 100%, 71%)`
39
+ - Named colors: `red`, `blue`, `green`
40
+ - CSS variables: `var(--ifm-color-primary)`
41
+
42
+ ## How It Works
43
+
44
+ ### Task Registry
45
+
46
+ During the build process, the plugin:
47
+
48
+ 1. **Scans** all MDX files in the docs directory for task directives
49
+ 2. **Extracts** metadata from each task (name, number, document info)
50
+ 3. **Reads** frontmatter for document-level badge customization
51
+ 4. **Generates** a registry file (`task-registry.json`) containing:
52
+ - Total task count per document
53
+ - Task names and sequential numbers
54
+ - Document metadata (title, section, permalink)
55
+ - Badge customization settings from frontmatter
56
+ - Sidebar position information
57
+
58
+ The registry powers features like the TaskProgression component and sidebar badges.
59
+
60
+ ### Completion Tracking
61
+
62
+ Task completion is tracked using browser localStorage:
63
+
64
+ - **Storage Keys** - Format: `task-{pluginId}-{docId}-{taskNumber}-{encodedName}`
65
+ - **Real-time Updates** - Progress updates immediately when tasks are completed
66
+ - **Cross-tab Sync** - Changes sync across browser tabs via storage events
67
+ - **Persistence** - Completion state persists across browser sessions
68
+
69
+ ### Path Resolution
70
+
71
+ The TaskProgression component uses intelligent path resolution:
72
+
73
+ 1. **Normalizes** the provided path (handles `@site/` prefix, file extensions)
74
+ 2. **Resolves** relative paths (`.`, `./`, `../`) based on current document
75
+ 3. **Searches** the task registry for matching document source
76
+ 4. **Returns** document metadata and task information
77
+
78
+ This allows flexible path references:
79
+
80
+ ```mdx
81
+ <!-- Absolute paths -->
82
+ <TaskProgression path="/docs/module1/tasks" />
83
+
84
+ <!-- Relative paths -->
85
+ <TaskProgression path="./sibling-page" />
86
+ <TaskProgression path="../parent-page" />
87
+
88
+ <!-- Current page -->
89
+ <TaskProgression path="." />
90
+ ```
91
+
92
+ ## Multiple Docs Instances
93
+
94
+ The plugin automatically works with [multiple docs instances](https://docusaurus.io/docs/docs-multi-instance). Each instance is tracked independently:
95
+
96
+ ```js title="docusaurus.config.js"
97
+ module.exports = {
98
+ presets: [
99
+ [
100
+ '@docusaurus/preset-classic',
101
+ {
102
+ docs: {
103
+ path: 'docs',
104
+ remarkPlugins: [
105
+ require('@sp-days-framework/docusaurus-plugin-interactive-tasks').remarkTaskDirective,
106
+ ],
107
+ },
108
+ },
109
+ ],
110
+ ],
111
+ plugins: [
112
+ '@sp-days-framework/docusaurus-plugin-interactive-tasks',
113
+ [
114
+ '@docusaurus/plugin-content-docs',
115
+ {
116
+ id: 'community',
117
+ path: 'community',
118
+ routeBasePath: 'community',
119
+ remarkPlugins: [
120
+ require('@sp-days-framework/docusaurus-plugin-interactive-tasks').remarkTaskDirective,
121
+ ],
122
+ },
123
+ ],
124
+ ],
125
+ };
126
+ ```
127
+
128
+ The `TaskProgression` component auto-detects the instance. To reference a different instance explicitly:
129
+
130
+ ```mdx
131
+ <!-- Auto-detects parent doc's instance -->
132
+ <TaskProgression path="./intro" />
133
+
134
+ <!-- Explicitly reference a different instance -->
135
+ <TaskProgression path="/docs/intro" pluginId="default" />
136
+ <TaskProgression path="/community/getting-started" pluginId="community" />
137
+ ```
138
+
139
+ ### Configuring `TaskProgression`
140
+
141
+ | Prop | Type | Default | Description |
142
+ | ---------- | -------- | ----------- | ---------------------------------------------- |
143
+ | `path` | `string` | **Required** | Path to the document (absolute or relative) |
144
+ | `pluginId` | `string` | *Auto-detected* | [Docs Multi-instance](https://docusaurus.io/docs/docs-multi-instance) instance ID. Auto-detects from parent doc if not provided. |
145
+
146
+ ### Configuring `TaskProgressionOverview`
147
+
148
+ | Prop | Type | Default | Description |
149
+ | ---------- | -------- | ----------- | ---------------------------- |
150
+ | `pluginId` | `string` | *Auto-detected* | [Docs Multi-instance](https://docusaurus.io/docs/docs-multi-instance) instance ID. Auto-detects from parent doc if not provided. |