Skip to content

Commit 6819346

Browse files
committed
Refactor documentation templates for consistency and clarity
- Standardize titles and sidebar labels across templates - Update code block formatting for better readability - Improve example structures and explanations - Remove unnecessary markdown syntax for cleaner output
1 parent 9cd9d3e commit 6819346

File tree

5 files changed

+243
-431
lines changed

5 files changed

+243
-431
lines changed

docs/contributing/templates/feature.mdx

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Use feature documentation when:
2828

2929
Copy and adapt this template for your feature documentation:
3030

31-
```markdown
31+
````markdown
3232
---
3333
title: [Feature name]
3434
description: [One-sentence description of what this feature does]
@@ -60,15 +60,23 @@ description: [One-sentence description of what this feature does]
6060

6161
### Basic example
6262

63-
\`\`\`[language] title="[filename]" [Code showing simplest usage] \`\`\`
63+
```[language] title="[filename]"
64+
[Code showing simplest usage]
65+
```
6466

6567
[Explain what this code does and what to expect.]
6668

6769
### Advanced example
6870

71+
```[language] title="[filename]"
72+
[More complex example]
73+
```
74+
6975
[Optional: Show a more complex or real-world usage.]
7076

71-
\`\`\`[language] title="[filename]" [More complex example] \`\`\`
77+
```[language] title="[filename]"
78+
[More complex example]
79+
```
7280

7381
[Explain the additional capabilities demonstrated.]
7482

@@ -83,7 +91,9 @@ description: [One-sentence description of what this feature does]
8391

8492
### Example configuration
8593

86-
\`\`\`json title=".doc-detective.json" { "featureName": { "option1": "value", "option2": 20 } } \`\`\`
94+
```json title=".doc-detective.json"
95+
{ "featureName": { "option1": "value", "option2": 20 } }
96+
```
8797

8898
## Migration guide
8999

@@ -93,13 +103,17 @@ description: [One-sentence description of what this feature does]
93103

94104
[Show how users currently do this.]
95105

96-
\`\`\`[language] [Old way] \`\`\`
106+
```[language]
107+
[Old way]
108+
```
97109

98110
### To new behavior
99111

100112
[Show how users should do this now.]
101113

102-
\`\`\`[language] [New way] \`\`\`
114+
```[language]
115+
[New way]
116+
```
103117

104118
### Breaking changes
105119

@@ -139,7 +153,7 @@ description: [One-sentence description of what this feature does]
139153
- [Related feature or action](link)
140154
- [Configuration reference](link)
141155
- [Tutorial using this feature](link)
142-
```
156+
````
143157

144158
## Writing tips
145159

@@ -231,7 +245,7 @@ If behavior varies by version:
231245

232246
Here's a complete example:
233247

234-
```markdown
248+
````markdown
235249
---
236250
title: Screenshot cropping
237251
description: Capture screenshots of specific elements instead of the entire page.
@@ -263,15 +277,19 @@ When documenting specific features, you often want screenshots that focus on a p
263277

264278
Capture just a specific button:
265279

266-
\`\`\`json title="screenshot-button.spec.json" { "tests": [ { "steps": [ { "action": "goTo", "url": "https://doc-detective.com" }, { "action": "screenshot", "path": "get-started-button.png", "cropTo": { "selector": "a[href='/docs/get-started']" } } ] } ] } \`\`\`
280+
```json title="screenshot-button.spec.json"
281+
{ "tests": [ { "steps": [ { "action": "goTo", "url": "https://doc-detective.com" }, { "action": "screenshot", "path": "get-started-button.png", "cropTo": { "selector": "a[href='/docs/get-started']" } } ] } ] }
282+
```
267283

268284
This captures only the "Get Started" link, not the entire page.
269285

270286
### Advanced example
271287

272288
Crop to an element with padding:
273289

274-
\`\`\`json title="screenshot-with-padding.spec.json" { "tests": [ { "steps": [ { "action": "goTo", "url": "https://doc-detective.com" }, { "action": "screenshot", "path": "navigation-menu.png", "cropTo": { "selector": "nav.navbar", "padding": 20 } } ] } ] } \`\`\`
290+
```json title="screenshot-with-padding.spec.json"
291+
{ "tests": [ { "steps": [ { "action": "goTo", "url": "https://doc-detective.com" }, { "action": "screenshot", "path": "navigation-menu.png", "cropTo": { "selector": "nav.navbar", "padding": 20 } } ] } ] }
292+
```
275293

276294
Adds 20 pixels of padding around the navigation element for context.
277295

@@ -289,19 +307,25 @@ Adds 20 pixels of padding around the navigation element for context.
289307

290308
### Example configuration
291309

292-
\`\`\`json title=".doc-detective.json" { "tests": [ { "steps": [ { "action": "screenshot", "path": "feature.png", "cropTo": { "selector": "#feature-section", "padding": 15 } } ] } ] } \`\`\`
310+
```json title=".doc-detective.json"
311+
{ "tests": [ { "steps": [ { "action": "screenshot", "path": "feature.png", "cropTo": { "selector": "#feature-section", "padding": 15 } } ] } ] }
312+
```
293313

294314
## Migration guide
295315

296316
If you were using full-page screenshots and want to crop:
297317

298318
### From full-page screenshots
299319

300-
\`\`\`json { "action": "screenshot", "path": "page.png", "fullPage": true } \`\`\`
320+
```json
321+
{ "action": "screenshot", "path": "page.png", "fullPage": true }
322+
```
301323

302324
### To element-based cropping
303325

304-
\`\`\`json { "action": "screenshot", "path": "element.png", "cropTo": { "selector": "#target-element" } } \`\`\`
326+
```json
327+
{ "action": "screenshot", "path": "element.png", "cropTo": { "selector": "#target-element" } }
328+
```
305329

306330
### Breaking changes
307331

@@ -345,7 +369,7 @@ None. This is a backward-compatible addition. Existing screenshots continue to w
345369
- [screenshot action reference](/docs/get-started/actions/screenshot)
346370
- [CSS selectors guide](/docs/get-started/selectors/css)
347371
- [Tutorial: Capture screenshots](/docs/get-started/tutorials/capture-screenshot)
348-
```
372+
````
349373

350374
## Checklist before submitting
351375

docs/contributing/templates/how-to.mdx

Lines changed: 9 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: How-To Guide Template
2+
title: How-To guide template
33
description: Template for creating task-oriented documentation.
4-
sidebar_label: How-To Template
4+
sidebar_label: How-To
55
---
66

7-
# How-To Guide Template
7+
# How-To guide template
88

99
Use this template for task-oriented documentation that helps users accomplish a specific goal.
1010

@@ -17,7 +17,7 @@ Use a how-to guide when users:
1717
- Want to complete a specific task
1818
- Already understand basic concepts
1919

20-
**Examples:**
20+
Examples:
2121

2222
- How to configure browser settings
2323
- How to run tests in parallel
@@ -28,7 +28,7 @@ Use a how-to guide when users:
2828

2929
Copy and adapt this template for your how-to guide:
3030

31-
```markdown
31+
````markdown
3232
---
3333
title: How to [accomplish task]
3434
description: [One-sentence description of what users will accomplish]
@@ -52,7 +52,9 @@ description: [One-sentence description of what users will accomplish]
5252

5353
[Provide detailed instructions. Use numbered sub-steps if needed.]
5454

55-
\`\`\`[language] title="[filename if applicable]" [Code example or command] \`\`\`
55+
```[language] title="[filename if applicable]"
56+
[Code example or command]
57+
```
5658

5759
[Explain what this code does or what to expect.]
5860

@@ -93,7 +95,7 @@ description: [One-sentence description of what users will accomplish]
9395
- [Related task 1](link)
9496
- [Related task 2](link)
9597
- [Learn more about X](link)
96-
```
98+
````
9799

98100
## Writing tips
99101

@@ -156,91 +158,6 @@ Before submitting:
156158
3. ✅ Test on a clean environment if possible
157159
4. ✅ Note any assumptions or prerequisites
158160

159-
## Example how-to guide
160-
161-
Here's a complete example:
162-
163-
```markdown
164-
---
165-
title: How to run tests in parallel
166-
description: Speed up test execution by running multiple tests simultaneously.
167-
---
168-
169-
# How to run tests in parallel
170-
171-
Run multiple Doc Detective tests at the same time to reduce total execution time. This is useful when you have many tests or tests that take a long time to complete.
172-
173-
## Before you begin
174-
175-
- Doc Detective installed (`npm install -g doc-detective`)
176-
- At least two test files to run
177-
- Understanding of [test configuration](/docs/references/schemas/config)
178-
179-
## Step 1: Enable parallel execution
180-
181-
Add the `concurrency` option to your Doc Detective configuration file:
182-
183-
\`\`\`json title=".doc-detective.json" { "concurrency": 4 } \`\`\`
184-
185-
This runs up to 4 tests simultaneously. Adjust based on your system resources.
186-
187-
## Step 2: Run your tests
188-
189-
Execute tests as usual:
190-
191-
\`\`\`bash npx doc-detective runTests \`\`\`
192-
193-
Doc Detective automatically distributes tests across parallel workers.
194-
195-
## Step 3: Monitor execution
196-
197-
Watch the output to see parallel execution:
198-
199-
\`\`\` [INFO] Running tests with concurrency: 4 [INFO] Test 1: RUNNING [INFO] Test 2: RUNNING [INFO] Test 3: RUNNING [INFO] Test 4: RUNNING [INFO] Test 1: PASSED [INFO] Test 5: RUNNING \`\`\`
200-
201-
## Verify it works
202-
203-
Compare execution time with and without parallelization:
204-
205-
\`\`\`bash
206-
207-
# Without parallelization
208-
209-
time npx doc-detective runTests --concurrency 1
210-
211-
# With parallelization
212-
213-
time npx doc-detective runTests --concurrency 4 \`\`\`
214-
215-
You should see reduced execution time.
216-
217-
## Troubleshooting
218-
219-
### Tests fail in parallel but pass individually
220-
221-
**Cause:** Tests may have dependencies or shared state
222-
223-
**Solution:** Ensure tests are independent. Avoid:
224-
225-
- Shared files or resources
226-
- Dependencies between tests
227-
- Hardcoded ports or URLs
228-
229-
### System becomes unresponsive
230-
231-
**Cause:** Too many parallel tests for available resources
232-
233-
**Solution:** Reduce concurrency:
234-
235-
\`\`\`json { "concurrency": 2 } \`\`\`
236-
237-
## What's next
238-
239-
- [Optimize test performance](/docs/tutorials/optimize-tests)
240-
- [Configure test contexts](/docs/get-started/config/contexts/)
241-
- [Run tests in CI/CD](/docs/tutorials/ci-cd)
242-
```
243-
244161
## Checklist before submitting
245162

246163
- [ ] Title starts with "How to"

0 commit comments

Comments
 (0)