You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1f54c50
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,8 @@ This guide contains all the information you need about:
15
15
16
16
We provide built-in scripts to automate screenshot generation and keep images consistent with documentation guidelines:
17
17
18
-
-`bun run screenshots [target]`: Automatically capture documentation screenshots using Playwright.
18
+
-`bun <path/to/screenshot.ts>`: Run an individual co-located screenshot script directly.
19
+
-`bun run screenshots [target]`: Automatically capture all or matching documentation screenshots using Playwright.
19
20
-`bun run screenshots:record [target]`: Open an interactive browser with session mocks to record user clicks for new screenshots.
20
21
-`bun run screenshots:process <input.png> <target>`: Convert and resize external PNG/JPEG captures into standard (`800x450`) and large (`3200x1800`) WebP files with annotations.
Copy file name to clipboardExpand all lines: docs/guides/contribution/index.md
+38-4Lines changed: 38 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,13 +139,47 @@ Image requirements:
139
139
140
140
This repository includes automated tools to capture, record, and format screenshots to meet the requirements above:
141
141
142
+
#### Co-located screenshot scripts
143
+
144
+
Every screenshot has a dedicated `*.screenshot.ts` file placed alongside its `.webp` images in the same folder (for example, `docs/the-editor/overview/editor-overview.screenshot.ts` next to `editor-overview.webp` and `editor-overview-large.webp`).
145
+
146
+
Each script exports a screenshot target using `defineScreenshot`:
description: 'Editor overview showing canvas, panels, and bottom bar',
155
+
setup: async (page:Page) => {
156
+
awaitpage.waitForTimeout(500)
157
+
},
158
+
annotations: [
159
+
{ type: 'badge', x: 550, y: 35, text: '1' },
160
+
{ type: 'badge', x: 450, y: 395, text: '2' },
161
+
],
162
+
})
163
+
```
164
+
165
+
-**Output directory and target name**: Inferred automatically from the script's folder location and filename.
166
+
-**Path alias**: Imports use the `@/scripts/...` alias from `tsconfig.json` so files can be moved between folders without breaking relative imports.
167
+
-**Annotations**: Badges, boxes, highlights, and labels can be added to the `annotations` array using 800×450 reference coordinates. They are automatically scaled and composited onto both the standard and large images.
168
+
142
169
#### Generating screenshots
143
170
144
-
Run the screenshot automation script to generate the dual WebP files (standard `800×450` and large `3200×1800`):
171
+
You can run individual screenshot scripts directly, or run all of them via the batch runner:
145
172
146
173
```bash
147
-
bun run screenshots # Capture all documentation screenshots
148
-
bun run screenshots editor-overview # Capture only a specific target
174
+
# Run a single screenshot directly:
175
+
bun docs/the-editor/overview/editor-overview.screenshot.ts
176
+
177
+
# Capture all configured documentation screenshots:
178
+
bun run screenshots
179
+
180
+
# Capture matching targets by name or section directory:
181
+
bun run screenshots editor-overview
182
+
bun run screenshots the-editor
149
183
```
150
184
151
185
#### Recording interactions for new screenshots
@@ -157,7 +191,7 @@ bun run screenshots:record
157
191
bun run screenshots:record create-a-page
158
192
```
159
193
160
-
This launches a headed Chromium browser with authenticated session mocks pre-applied and opens the **Playwright Inspector** GUI. Click the red **Record** button in the inspector, interact with the editor, and copy the recorded actions into `TARGETS` in `scripts/capture-screenshots.ts`.
194
+
This launches a headed Chromium browser with authenticated session mocks pre-applied and opens the **Playwright Inspector** GUI. Click the red **Record** button in the inspector, interact with the editor, and copy the recorded actions into the `setup` function of your co-located `*.screenshot.ts` file.
0 commit comments