@@ -11,12 +11,14 @@ Use this template to document new features or significant changes to existing fe
1111## When to use this template
1212
1313Use feature documentation when:
14+
1415- A new feature has been added
1516- An existing feature has changed significantly
1617- Users need to understand what changed and how to use it
1718- Migration from old to new behavior is needed
1819
1920** Examples:**
21+
2022- New action type added to Doc Detective
2123- Configuration options changed
2224- New integration or plugin
@@ -26,7 +28,7 @@ Use feature documentation when:
2628
2729Copy and adapt this template for your feature documentation:
2830
29- ```` markdown
31+ ``` markdown
3032---
3133title: [Feature name]
3234description: [One-sentence description of what this feature does]
@@ -58,41 +60,30 @@ description: [One-sentence description of what this feature does]
5860
5961### Basic example
6062
61- \`\`\`[language] title="[filename]"
62- [Code showing simplest usage]
63- \`\`\`
63+ \`\`\`[language] title="[filename]" [Code showing simplest usage] \`\`\`
6464
6565[Explain what this code does and what to expect.]
6666
6767### Advanced example
6868
6969[Optional: Show a more complex or real-world usage.]
7070
71- \`\`\`[language] title="[filename]"
72- [More complex example]
73- \`\`\`
71+ \`\`\`[language] title="[filename]" [More complex example] \`\`\`
7472
7573[Explain the additional capabilities demonstrated.]
7674
7775## Configuration options
7876
7977[If the feature has configuration, document each option.]
8078
81- | Option | Type | Required | Default | Description |
82- |--------| ------| ----------| ---------| -------------|
83- | option1 | string | Yes | - | What this option does |
84- | option2 | number | No | 10 | What this option does |
79+ | Option | Type | Required | Default | Description |
80+ | ------- | ------ | -------- | -- ----- | --------------------- |
81+ | option1 | string | Yes | - | What this option does |
82+ | option2 | number | No | 10 | What this option does |
8583
8684### Example configuration
8785
88- \`\`\`json title=".doc-detective.json"
89- {
90- "featureName": {
91- "option1": "value",
92- "option2": 20
93- }
94- }
95- \`\`\`
86+ \`\`\`json title=".doc-detective.json" { "featureName": { "option1": "value", "option2": 20 } } \`\`\`
9687
9788## Migration guide
9889
@@ -102,17 +93,13 @@ description: [One-sentence description of what this feature does]
10293
10394[Show how users currently do this.]
10495
105- \`\`\`[language]
106- [Old way]
107- \`\`\`
96+ \`\`\`[language] [Old way] \`\`\`
10897
10998### To new behavior
11099
111100[Show how users should do this now.]
112101
113- \`\`\`[language]
114- [New way]
115- \`\`\`
102+ \`\`\`[language] [New way] \`\`\`
116103
117104### Breaking changes
118105
@@ -141,6 +128,7 @@ description: [One-sentence description of what this feature does]
141128**Cause:** [Why this happens]
142129
143130**Solution:**
131+
1441321. [Step 1]
1451332. [Step 2]
146134
@@ -151,7 +139,7 @@ description: [One-sentence description of what this feature does]
151139- [Related feature or action](link)
152140- [Configuration reference](link)
153141- [Tutorial using this feature](link)
154- ````
142+ ```
155143
156144## Writing tips
157145
@@ -160,22 +148,27 @@ description: [One-sentence description of what this feature does]
160148Start with why users should care:
161149
162150✅ Good:
151+
163152> The ` parallel ` option lets you run tests simultaneously, reducing execution time by up to 70% for large test suites.
164153
165154⛔ Too technical:
155+
166156> The ` parallel ` option implements concurrent test execution using worker threads.
167157
168158### Show before and after
169159
170160For changes, show both the old and new way:
171161
172162✅ Good:
163+
173164> ** Before:** You had to manually specify each test file
165+ >
174166> ``` bash
175167> doc-detective test1.spec.json test2.spec.json test3.spec.json
176168> ` ` `
177169>
178170> ** Now:** Use glob patterns to match multiple files
171+ >
179172> ` ` ` bash
180173> doc-detective " tests/**/*.spec.json"
181174> ` ` `
@@ -185,6 +178,7 @@ For changes, show both the old and new way:
185178Examples should be copy-pasteable and work as-is:
186179
187180✅ Complete:
181+
188182` ` ` json
189183{
190184 " tests" : [
@@ -199,47 +193,45 @@ Examples should be copy-pasteable and work as-is:
199193 }
200194 ]
201195}
202- ````
196+ ```
203197
204198⛔ Incomplete:
199+
205200``` json
206201{
207202 "screenshot" : {
208203 "fullPage" : true
209204 }
210205}
211- ` ` ` `
206+ ```
212207
213208### Document breaking changes clearly
214209
215210Be explicit about what breaks:
216211
217212✅ Clear:
213+
218214> ** Breaking change:** The ` timeout ` option now accepts milliseconds instead of seconds.
219- >
220- > ** Before:** ` " timeout" : 30` (30 seconds)
221- > ** After:** ` " timeout" : 30000` (30 seconds in milliseconds)
222- >
215+ >
216+ > ** Before:** ` "timeout": 30 ` (30 seconds) ** After:** ` "timeout": 30000 ` (30 seconds in milliseconds)
217+ >
223218> ** To update:** Multiply all timeout values by 1000.
224219
225220### Version your examples
226221
227222If behavior varies by version:
228223
229- ` ` ` ` markdown
230- :::info Version differences
231- This feature works differently depending on your Doc Detective version:
224+ ``` markdown
225+ :::info Version differences This feature works differently depending on your Doc Detective version:
232226
233- ** v2.x:** Uses ` oldOption`
234- ** v3.x and later:** Uses ` newOption`
235- :::
236- ` ` ` `
227+ **v2.x:** Uses `oldOption` **v3.x and later:** Uses `newOption` :::
228+ ```
237229
238230## Example feature documentation
239231
240232Here's a complete example:
241233
242- ```` markdown
234+ ``` markdown
243235---
244236title: Screenshot cropping
245237description: Capture screenshots of specific elements instead of the entire page.
@@ -271,117 +263,45 @@ When documenting specific features, you often want screenshots that focus on a p
271263
272264Capture just a specific button:
273265
274- \`\`\` json title=" screenshot-button.spec.json"
275- {
276- " tests" : [
277- {
278- " steps" : [
279- {
280- " action" : " goTo" ,
281- " url" : " https://doc-detective.com"
282- },
283- {
284- " action" : " screenshot" ,
285- " path" : " get-started-button.png" ,
286- " cropTo" : {
287- " selector" : " a[href='/docs/get-started']"
288- }
289- }
290- ]
291- }
292- ]
293- }
294- \`\`\`
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']" } } ] } ] } \`\`\`
295267
296268This captures only the "Get Started" link, not the entire page.
297269
298270### Advanced example
299271
300272Crop to an element with padding:
301273
302- \`\`\` json title=" screenshot-with-padding.spec.json"
303- {
304- " tests" : [
305- {
306- " steps" : [
307- {
308- " action" : " goTo" ,
309- " url" : " https://doc-detective.com"
310- },
311- {
312- " action" : " screenshot" ,
313- " path" : " navigation-menu.png" ,
314- " cropTo" : {
315- " selector" : " nav.navbar" ,
316- " padding" : 20
317- }
318- }
319- ]
320- }
321- ]
322- }
323- \`\`\`
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 } } ] } ] } \`\`\`
324275
325276Adds 20 pixels of padding around the navigation element for context.
326277
327278## Configuration options
328279
329280| Option | Type | Required | Default | Description |
330- | -------- | ------ | ---------- | --------- | ------------- |
281+ | --- | --- | --- | --- | --- |
331282| path | string | Yes | - | Where to save the screenshot |
332283| cropTo | object | No | - | Element to crop to (see below) |
333- | cropTo.selector | string | Yes* | - | CSS selector or XPath of element |
284+ | cropTo.selector | string | Yes\ * | - | CSS selector or XPath of element |
334285| cropTo.padding | number | No | 0 | Pixels of padding around element |
335286| fullPage | boolean | No | false | Ignored if cropTo is specified |
336287
337- * Required if ` cropTo` is used
288+ \ *Required if `cropTo` is used
338289
339290### Example configuration
340291
341- \`\`\` json title=" .doc-detective.json"
342- {
343- " tests" : [
344- {
345- " steps" : [
346- {
347- " action" : " screenshot" ,
348- " path" : " feature.png" ,
349- " cropTo" : {
350- " selector" : " #feature-section" ,
351- " padding" : 15
352- }
353- }
354- ]
355- }
356- ]
357- }
358- \`\`\`
292+ \`\`\`json title=".doc-detective.json" { "tests": [ { "steps": [ { "action": "screenshot", "path": "feature.png", "cropTo": { "selector": "#feature-section", "padding": 15 } } ] } ] } \`\`\`
359293
360294## Migration guide
361295
362296If you were using full-page screenshots and want to crop:
363297
364298### From full-page screenshots
365299
366- \`\`\` json
367- {
368- " action" : " screenshot" ,
369- " path" : " page.png" ,
370- " fullPage" : true
371- }
372- \`\`\`
300+ \`\`\`json { "action": "screenshot", "path": "page.png", "fullPage": true } \`\`\`
373301
374302### To element-based cropping
375303
376- \`\`\` json
377- {
378- " action" : " screenshot" ,
379- " path" : " element.png" ,
380- " cropTo" : {
381- " selector" : " #target-element"
382- }
383- }
384- \`\`\`
304+ \`\`\`json { "action": "screenshot", "path": "element.png", "cropTo": { "selector": "#target-element" } } \`\`\`
385305
386306### Breaking changes
387307
@@ -402,6 +322,7 @@ None. This is a backward-compatible addition. Existing screenshots continue to w
402322**Cause:** The selector doesn't match any element on the page
403323
404324**Solution:**
325+
4053261. Verify the element exists on the page
4063272. Use browser dev tools to test your selector
4073283. Add a `wait` action before screenshot if element loads slowly
@@ -414,6 +335,7 @@ None. This is a backward-compatible addition. Existing screenshots continue to w
414335**Cause:** Element is smaller than expected or padding is insufficient
415336
416337**Solution:**
338+
4173391. Increase the `padding` value
4183402. Select a parent element that includes more context
4193413. Verify you're selecting the correct element
@@ -423,7 +345,7 @@ None. This is a backward-compatible addition. Existing screenshots continue to w
423345- [screenshot action reference](/docs/get-started/actions/screenshot)
424346- [CSS selectors guide](/docs/get-started/selectors/css)
425347- [Tutorial: Capture screenshots](/docs/get-started/tutorials/capture-screenshot)
426- ` ` ` `
348+ ```
427349
428350## Checklist before submitting
429351
0 commit comments