@sp-days-framework/create-sp-days 1.0.4 → 1.1.0-beta2
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/README.md +14 -0
- package/bin/index.js +2 -0
- package/docs/advanced-config.mdx +412 -0
- package/docs/changelog.mdx +129 -0
- package/docs/index.mdx +206 -0
- package/docs/install.mdx +199 -0
- package/docs/sidebar-sections.mdx +268 -0
- package/docs/sp-days-plugin-color-light.svg +53 -0
- package/lib/.tsbuildinfo +1 -0
- package/lib/.tsbuildinfo-build +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +36 -7
- package/package.json +31 -7
- package/publish-package-docs.js +12 -0
- package/templates/addon-resources/resources/api-reference.mdx +132 -0
- package/templates/addon-resources/resources/best-practice.mdx +407 -0
- package/templates/addon-resources/resources/cheat-sheet.mdx +120 -0
- package/templates/addon-resources/resources/cli-reference.mdx +280 -0
- package/templates/addon-resources/resources/configuration-guide.mdx +211 -0
- package/templates/addon-resources/resources/environment-setup.mdx +317 -0
- package/templates/addon-resources/resources/faq.mdx +146 -0
- package/templates/addon-resources/resources/glossary.mdx +78 -0
- package/templates/addon-resources/resources/index.mdx +67 -16
- package/templates/addon-resources/resources/quick-start.mdx +193 -0
- package/templates/addon-resources/resources/troubleshooting.mdx +263 -0
- package/templates/addon-resources/resources/useful-links.mdx +61 -0
- package/templates/page-course/README.md +87 -0
- package/templates/page-course/docusaurus.config.ts +103 -10
- package/templates/page-course/package.json +12 -2
- package/templates/page-course/sidebarSections.js +118 -0
- package/templates/page-course/src/css/sp-days-theme.scss +428 -211
- package/tsconfig.base.client.json +10 -0
- package/tsconfig.base.json +71 -0
- package/tsconfig.build.json +9 -0
- package/sp-days-framework-create-sp-days-1.0.3.tgz +0 -0
- package/templates/addon-resources/resources/interactive-tasks/creating-tasks.mdx +0 -254
- package/templates/addon-resources/resources/interactive-tasks/examples/_category_.yml +0 -3
- package/templates/addon-resources/resources/interactive-tasks/examples/advanced-usage.mdx +0 -304
- package/templates/addon-resources/resources/interactive-tasks/examples/basic-usage.mdx +0 -128
- package/templates/addon-resources/resources/interactive-tasks/index.mdx +0 -93
- package/templates/addon-resources/resources/interactive-tasks/setup/advanced-configuration.mdx +0 -273
- package/templates/addon-resources/resources/interactive-tasks/setup/index.mdx +0 -120
- package/templates/addon-resources/resources/interactive-tasks/task-progression.mdx +0 -140
- package/templates/addon-resources/resources/slidev-integration/index.mdx +0 -106
- package/templates/addon-resources/resources/slidev-integration/setup/advanced-configuration.mdx +0 -144
- package/templates/addon-resources/resources/slidev-integration/setup/index.mdx +0 -200
- package/templates/addon-resources/resources/sykehuspartner-theme/index.mdx +0 -105
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/center.mdx +0 -33
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/default.mdx +0 -59
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/content/full.mdx +0 -49
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-left.mdx +0 -37
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image-right.mdx +0 -37
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/image/image.mdx +0 -56
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols-header.mdx +0 -49
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/three-cols.mdx +0 -47
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols-header.mdx +0 -43
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/multi-column/two-cols.mdx +0 -38
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/cover.mdx +0 -43
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/end.mdx +0 -33
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/intro.mdx +0 -49
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/section/section.mdx +0 -41
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/_category_.yml +0 -2
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/about-me.mdx +0 -92
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/fact.mdx +0 -47
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/quote.mdx +0 -27
- package/templates/addon-resources/resources/sykehuspartner-theme/layouts/special/statement.mdx +0 -28
- package/templates/addon-resources/resources/sykehuspartner-theme/setup/advanced-configuration.mdx +0 -79
- package/templates/addon-resources/resources/sykehuspartner-theme/setup/index.mdx +0 -104
- package/templates/addon-resources/resources/sykehuspartner-theme/syntax-and-icons.mdx +0 -89
- package/templates/addon-slidev/package.json +0 -54
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"rootDir": "${configDir}/src",
|
|
4
|
+
"outDir": "${configDir}/lib",
|
|
5
|
+
"composite": true,
|
|
6
|
+
"incremental": true,
|
|
7
|
+
"tsBuildInfoFile": "${configDir}/lib/.tsbuildinfo",
|
|
8
|
+
"erasableSyntaxOnly": true,
|
|
9
|
+
/* Emit */
|
|
10
|
+
"target": "ES2020",
|
|
11
|
+
"lib": ["ESNext"],
|
|
12
|
+
"declaration": true,
|
|
13
|
+
// These two options will be selectively overridden in each project.
|
|
14
|
+
// Utility libraries will have source maps on, but plugins will not.
|
|
15
|
+
"declarationMap": false,
|
|
16
|
+
"sourceMap": false,
|
|
17
|
+
"jsx": "react-native",
|
|
18
|
+
"importHelpers": true,
|
|
19
|
+
"noEmitHelpers": true,
|
|
20
|
+
// Will be overridden in client projects
|
|
21
|
+
"module": "NodeNext",
|
|
22
|
+
// Avoid accidentally using this config to build
|
|
23
|
+
"noEmit": true,
|
|
24
|
+
|
|
25
|
+
/* Strict Type-Checking Options */
|
|
26
|
+
"allowUnreachableCode": false,
|
|
27
|
+
// Too hard to turn on
|
|
28
|
+
"exactOptionalPropertyTypes": false,
|
|
29
|
+
"noFallthroughCasesInSwitch": true,
|
|
30
|
+
"noImplicitOverride": true,
|
|
31
|
+
"noImplicitReturns": true,
|
|
32
|
+
// `process.env` is usually accessed as property
|
|
33
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
34
|
+
"noUncheckedIndexedAccess": true,
|
|
35
|
+
/* strict family */
|
|
36
|
+
"strict": true,
|
|
37
|
+
"alwaysStrict": true,
|
|
38
|
+
"noImplicitAny": true,
|
|
39
|
+
"noImplicitThis": true,
|
|
40
|
+
"strictBindCallApply": true,
|
|
41
|
+
"strictFunctionTypes": true,
|
|
42
|
+
"strictNullChecks": true,
|
|
43
|
+
"strictPropertyInitialization": true,
|
|
44
|
+
"useUnknownInCatchVariables": true,
|
|
45
|
+
/* Handled by ESLint */
|
|
46
|
+
"noUnusedLocals": false,
|
|
47
|
+
"noUnusedParameters": false,
|
|
48
|
+
"importsNotUsedAsValues": "remove",
|
|
49
|
+
|
|
50
|
+
/* Module Resolution */
|
|
51
|
+
"moduleResolution": "NodeNext",
|
|
52
|
+
"resolveJsonModule": true,
|
|
53
|
+
"allowSyntheticDefaultImports": true,
|
|
54
|
+
"esModuleInterop": true,
|
|
55
|
+
"forceConsistentCasingInFileNames": true,
|
|
56
|
+
"isolatedModules": true,
|
|
57
|
+
"allowJs": true,
|
|
58
|
+
"skipLibCheck": true // @types/webpack and webpack/types.d.ts are not the same thing
|
|
59
|
+
},
|
|
60
|
+
"include": ["./**/*", "./**/.eslintrc.js"],
|
|
61
|
+
"exclude": [
|
|
62
|
+
"node_modules",
|
|
63
|
+
"coverage/**",
|
|
64
|
+
"**/lib/**/*",
|
|
65
|
+
"website/**",
|
|
66
|
+
"**/__mocks__/**/*",
|
|
67
|
+
"**/__fixtures__/**/*",
|
|
68
|
+
"examples/**",
|
|
69
|
+
"packages/create-docusaurus/templates/**"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
Binary file
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 2
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import Tabs from "@theme/Tabs";
|
|
6
|
-
import TabItem from "@theme/TabItem";
|
|
7
|
-
import Mermaid from '@theme/Mermaid';
|
|
8
|
-
|
|
9
|
-
# Task Component
|
|
10
|
-
|
|
11
|
-
Learn how to create interactive tasks with various features including hints, solutions, and non-persistent examples.
|
|
12
|
-
|
|
13
|
-
## Syntax Reference
|
|
14
|
-
|
|
15
|
-
| Element | Directive | Requirement | Notes |
|
|
16
|
-
|---------|-----------|-------------|-------|
|
|
17
|
-
| **Task Container** | `::::task[Task Name]` (4+ colons) | Required | Tasks are auto-numbered sequentially per page |
|
|
18
|
-
| **Hint Section** | `:::hint` (3+ colons) | Optional | Max one per task; additional hints ignored with warning. Can appear anywhere inside task container |
|
|
19
|
-
| **Solution Section** | `:::solution` (3+ colons) | Optional | Max one per task; additional solutions ignored with warning. Can appear anywhere inside task container |
|
|
20
|
-
| **Task Example** | `::::task-example[Example Name]` (4+ colons) | Required | Same as regular tasks but non-persistent; uses "Example N" numbering |
|
|
21
|
-
|
|
22
|
-
## Basic Task
|
|
23
|
-
|
|
24
|
-
A simple task without hints or solutions.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```md
|
|
28
|
-
::::task[Create a Component]
|
|
29
|
-
|
|
30
|
-
Create a new React component in `src/components/MyComponent.tsx`.
|
|
31
|
-
|
|
32
|
-
::::
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
::::task-example[Create a Component]
|
|
36
|
-
|
|
37
|
-
Create a new React component in `src/components/MyComponent.tsx`.
|
|
38
|
-
|
|
39
|
-
::::
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Task with Hint
|
|
45
|
-
|
|
46
|
-
Add a hint to guide users through the task.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```mdx
|
|
50
|
-
::::task[Configure TypeScript]
|
|
51
|
-
|
|
52
|
-
Set up TypeScript configuration for strict mode.
|
|
53
|
-
|
|
54
|
-
:::hint
|
|
55
|
-
Look for the `tsconfig.json` file in your project root.
|
|
56
|
-
:::
|
|
57
|
-
|
|
58
|
-
::::
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
::::task-example[Configure TypeScript]
|
|
62
|
-
|
|
63
|
-
Set up TypeScript configuration for strict mode.
|
|
64
|
-
|
|
65
|
-
:::hint
|
|
66
|
-
Look for the `tsconfig.json` file in your project root.
|
|
67
|
-
:::
|
|
68
|
-
|
|
69
|
-
::::
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Task with Solution
|
|
74
|
-
|
|
75
|
-
Provide a complete solution for the task.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```mdx
|
|
79
|
-
::::task[Create Package JSON]
|
|
80
|
-
|
|
81
|
-
Initialize a new Node.js project with npm.
|
|
82
|
-
|
|
83
|
-
:::solution
|
|
84
|
-
Run `npm init -y` in your project directory.
|
|
85
|
-
:::
|
|
86
|
-
|
|
87
|
-
::::
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
::::task-example[Create Package JSON]
|
|
91
|
-
|
|
92
|
-
Initialize a new Node.js project with npm.
|
|
93
|
-
|
|
94
|
-
:::solution
|
|
95
|
-
Run `npm init -y` in your project directory.
|
|
96
|
-
:::
|
|
97
|
-
|
|
98
|
-
::::
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Task with Hint and Solution
|
|
103
|
-
|
|
104
|
-
Combine both hint and solution for comprehensive guidance.
|
|
105
|
-
|
|
106
|
-
````mdx
|
|
107
|
-
::::task[Add API Route]
|
|
108
|
-
|
|
109
|
-
Create a new API endpoint for user authentication.
|
|
110
|
-
|
|
111
|
-
:::hint
|
|
112
|
-
API routes in Next.js go in the `app/api` directory.
|
|
113
|
-
:::
|
|
114
|
-
|
|
115
|
-
:::solution
|
|
116
|
-
Create `app/api/auth/route.ts`:
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
export async function POST(request: Request) {
|
|
120
|
-
const body = await request.json();
|
|
121
|
-
// Authentication logic here
|
|
122
|
-
return Response.json({ success: true });
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
:::
|
|
126
|
-
|
|
127
|
-
::::
|
|
128
|
-
````
|
|
129
|
-
|
|
130
|
-
::::task-example[Add API Route]
|
|
131
|
-
|
|
132
|
-
Create a new API endpoint for user authentication.
|
|
133
|
-
|
|
134
|
-
:::hint
|
|
135
|
-
API routes in Next.js go in the `app/api` directory.
|
|
136
|
-
:::
|
|
137
|
-
|
|
138
|
-
:::solution
|
|
139
|
-
Create `app/api/auth/route.ts`:
|
|
140
|
-
|
|
141
|
-
```typescript
|
|
142
|
-
export async function POST(request: Request) {
|
|
143
|
-
const body = await request.json();
|
|
144
|
-
// Authentication logic here
|
|
145
|
-
return Response.json({ success: true });
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
:::
|
|
149
|
-
|
|
150
|
-
::::
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Using Markdown Features
|
|
156
|
-
|
|
157
|
-
Tasks fully support standard Docusaurus markdown features like the [admonitions feature](https://docusaurus.io/docs/markdown-features/admonitions).
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
````mdx
|
|
161
|
-
::::task[Setup Development Environment]
|
|
162
|
-
|
|
163
|
-
Follow these steps to configure your workspace.
|
|
164
|
-
|
|
165
|
-
:::note
|
|
166
|
-
Make sure you have Node.js 18+ installed before proceeding.
|
|
167
|
-
:::
|
|
168
|
-
|
|
169
|
-
**Installation Steps:**
|
|
170
|
-
|
|
171
|
-
1. Install dependencies:
|
|
172
|
-
```bash
|
|
173
|
-
npm install
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
2. Start the development server:
|
|
177
|
-
```bash
|
|
178
|
-
npm run dev
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
:::warning
|
|
182
|
-
Do not commit your `.env` file to version control!
|
|
183
|
-
:::
|
|
184
|
-
|
|
185
|
-
:::hint
|
|
186
|
-
Check the README.md for environment variable examples.
|
|
187
|
-
:::
|
|
188
|
-
|
|
189
|
-
::::
|
|
190
|
-
````
|
|
191
|
-
|
|
192
|
-
::::task-example[Setup Development Environment]
|
|
193
|
-
|
|
194
|
-
Follow these steps to configure your workspace.
|
|
195
|
-
|
|
196
|
-
:::note
|
|
197
|
-
Make sure you have Node.js 18+ installed before proceeding.
|
|
198
|
-
:::
|
|
199
|
-
|
|
200
|
-
**Installation Steps:**
|
|
201
|
-
|
|
202
|
-
1. Install dependencies:
|
|
203
|
-
```bash
|
|
204
|
-
npm install
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
2. Start the development server:
|
|
208
|
-
```bash
|
|
209
|
-
npm run dev
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
:::warning
|
|
213
|
-
Do not commit your `.env` file to version control!
|
|
214
|
-
:::
|
|
215
|
-
|
|
216
|
-
:::hint
|
|
217
|
-
Check the README.md for environment variable examples.
|
|
218
|
-
:::
|
|
219
|
-
|
|
220
|
-
::::
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
## Nesting
|
|
224
|
-
|
|
225
|
-
The `::::task` directive supports nesting [admonitions](https://docusaurus.io/docs/markdown-features/admonitions) and other markdown features by using colon count to determine hierarchy. Each parent container must use **more colons** than its children to prevent premature closure.
|
|
226
|
-
|
|
227
|
-
**Nesting rules:**
|
|
228
|
-
- Task container: `::::task` (4+ colons)
|
|
229
|
-
- Hint/Solution: `:::hint` or `:::solution` (3+ colons)
|
|
230
|
-
- Nested admonition: `:::note`, `:::tip`, etc. (3+ colons)
|
|
231
|
-
- For deeper nesting, add more colons to parent containers
|
|
232
|
-
|
|
233
|
-
Each level needs more colons than its children to avoid premature closure.
|
|
234
|
-
|
|
235
|
-
### Nesting Example
|
|
236
|
-
|
|
237
|
-
```mdx
|
|
238
|
-
::::::task[Nested Example]
|
|
239
|
-
(Layer 1)
|
|
240
|
-
|
|
241
|
-
:::::hint
|
|
242
|
-
(Layer 2)
|
|
243
|
-
|
|
244
|
-
::::note
|
|
245
|
-
(Layer 3)
|
|
246
|
-
|
|
247
|
-
:::warning
|
|
248
|
-
(Layer 4)
|
|
249
|
-
:::
|
|
250
|
-
|
|
251
|
-
:::::
|
|
252
|
-
|
|
253
|
-
::::::
|
|
254
|
-
```
|
|
@@ -1,304 +0,0 @@
|
|
|
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
|
-
::::
|