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
Copy file name to clipboardExpand all lines: AGENTS.md
+45-38Lines changed: 45 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,32 @@
1
1
# Operational Guidelines for Gotenberg Documentation
2
2
3
-
You are working on **gotenberg.dev**, the official documentation website for [Gotenberg](https://github.com/gotenberg/gotenberg) — a Docker-based API for converting documents to PDF. This is a Docusaurus 3.x site serving the public-facing docs at https://gotenberg.dev. Accuracy and clarity are paramount: users rely on this documentation to integrate Gotenberg into production systems.
3
+
You are working on **gotenberg.dev**, the official documentation website for [Gotenberg](https://github.com/gotenberg/gotenberg), a Docker-based API for converting documents to PDF. This is a Docusaurus 3.x site serving the public-facing docs at https://gotenberg.dev. Accuracy and clarity are paramount: users rely on this documentation to integrate Gotenberg into production systems.
4
4
5
5
## Mandatory Workflow
6
6
7
7
Every task follows these five steps **in order**. Do not skip or reorder them.
8
8
9
-
### Step 1 — Plan
9
+
### Step 1: Plan
10
10
11
11
Before writing any code or content:
12
12
13
13
1. State the problem or request.
14
14
2. Propose a solution.
15
15
3. List alternatives when pertinent.
16
-
4. Define scope — which files will be created, modified, or deleted.
16
+
4. Define scope: which files will be created, modified, or deleted.
17
17
5. Describe the verification strategy.
18
18
19
19
**Wait for user approval before proceeding.**
20
20
21
-
### Step 2 — Implement
21
+
### Step 2: Implement
22
22
23
23
Execute the approved plan. After implementation, verify the site builds cleanly:
24
24
25
25
```bash
26
26
npm run build
27
27
```
28
28
29
-
### Step 3 — Test
29
+
### Step 3: Test
30
30
31
31
Verify the changes:
32
32
@@ -36,31 +36,36 @@ Verify the changes:
36
36
- Components render correctly at desktop (1440px), laptop (1024px), and tablet (768px) widths.
37
37
- No console errors or React warnings in the browser.
38
38
39
-
### Step 4 — Review
39
+
### Step 4: Review
40
40
41
41
Self-review against this checklist, then present findings to the user:
42
42
43
43
-[ ]**Accuracy.** Every endpoint path, form field name, code sample, and configuration flag matches the actual Gotenberg API.
44
44
-[ ]**Backward compatibility.** No broken links, no removed content without replacement, no changed URLs.
45
45
-[ ]**Consistency.** Follows established page structure, component usage, and terminology.
46
46
-[ ]**Code quality.** Formatted with Prettier (`npm run format`), no linting errors, no unused imports.
47
-
-[ ]**Documentation.** Shared partials used where appropriate — no duplicated content across pages.
47
+
-[ ]**Documentation.** Shared partials used where appropriate. No duplicated content across pages.
48
48
-[ ]**Build.**`npm run build` passes without errors or warnings.
49
49
50
-
### Step 5 — Commit
50
+
### Step 5: Commit
51
51
52
52
**Only after explicit user approval.**
53
53
54
54
- Use [Conventional Commits](https://www.conventionalcommits.org/) (e.g., `docs:`, `feat:`, `fix:`, `style:`).
55
-
- Stage specific files only — never`git add -A` or `git add .`.
55
+
- Stage specific files only. Never`git add -A` or `git add .`.
56
56
- Write a concise commit message that explains _why_, not just _what_.
57
57
58
58
---
59
59
60
60
## Core Principles
61
61
62
62
-**Accuracy is law.** Every code sample, form field name, endpoint path, and configuration flag must match the actual Gotenberg API. When in doubt, cross-reference with the [Gotenberg source](https://github.com/gotenberg/gotenberg).
63
-
-**User-first writing.** Write for developers who want to get things done. Lead with the most common use case, then cover edge cases.
63
+
-**Direct, confident tone.** Short declarative sentences. No filler words, no hedging ("you might want to", "please feel free to"). Say what something does, not what it is. Lead with the action or outcome.
64
+
-**No robotic patterns.** Never start with "This endpoint...", "This route...", or "Use the X form field to...". Describe what it does for the user, not what the object is.
65
+
-**Inline over admonitions.** Integrate warnings and notes into prose. Reserve `:::info`, `:::warning`, `:::danger` for genuinely critical information that must stand out. Most pages should have zero or one admonition.
66
+
-**No "we" hedging.** Avoid "We do not recommend...", "We offer...", "We have...". Speak directly: "Don't expose...", "There's a dedicated image...".
67
+
-**One sentence, not two.** If the second sentence restates the first with more words, delete it.
68
+
-**No em dashes.** Never use `—` in any markdown file. Use a period, colon, or comma instead.
64
69
-**Consistency.** Follow established patterns for page structure, component usage, and terminology. Every API doc page uses the same layout and components.
65
70
-**No broken builds.** The site must build cleanly (`npm run build`) before any change is considered complete.
66
71
@@ -78,13 +83,13 @@ Self-review against this checklist, then present findings to the user:
78
83
79
84
All API endpoint documentation uses the `<ApiEndpoint>` React component (`src/components/documentation/ApiEndpoint.js`). It accepts:
7.**`<Sponsors />`** — Sponsor component at the bottom
128
+
1.**Frontmatter:**`id` and `title` fields
129
+
2.**Imports:** Shared MDX partials and React components
130
+
3.**Intro line:** One direct sentence saying what the endpoint does
131
+
4.**Configuration link:** Links to the configuration page for related flags (Chromium/LibreOffice pages)
132
+
5.**`## Basics`:** The `<ApiEndpoint>` component with method, path, headers, form fields/files, cURL example, and responses. Only used on pages with multiple sections; single-section pages skip this heading.
133
+
6.**Feature sections:**Each sub-section owns its form fields directly (no summary-then-detail duplication). Shared partials with `showFormFields={true}` render their own field definitions.
134
+
7.**`<Sponsors />`:** Sponsor component at the bottom
130
135
131
-
Do not deviate from this structure. New pages must follow existing pages as templates.
136
+
New pages must follow existing pages as templates.
132
137
133
138
### Writing Style
134
139
135
-
-**Be direct.**Lead with what the endpoint does, not background context.
136
-
-**Use second person.** "You can", "your files", not "the user can".
137
-
-**Keep paragraphs short.**Two to four sentences maximum.
140
+
-**Short, declarative sentences.**Say what it does, then stop. No filler, no hedging.
141
+
-**Lead with the action.** "Merges multiple PDF files" not "This endpoint allows you to merge multiple PDF files".
142
+
-**Use second person sparingly.**"your files", "your HTML", but don't overuse "you can".
138
143
-**Prefer active voice.** "Gotenberg converts the file" not "The file is converted by Gotenberg".
144
+
-**Inline over admonitions.** Integrate caveats into prose. Only use `:::info`, `:::warning`, `:::danger` for genuinely critical information.
145
+
-**No "Use the X form field to..." pattern.** Describe the outcome directly: "Inject XMP metadata into the PDF" not "Use the `metadata` form field to inject XMP metadata".
139
146
-**Use inline code** for all technical terms: form field names (`url`), header names (`Gotenberg-Trace`), endpoint paths (`/forms/chromium/convert/url`), file names (`index.html`), CLI flags (`--api-port`), and environment variables.
140
147
141
148
### ApiEndpoint Component Usage
@@ -187,10 +194,10 @@ Key rules:
187
194
188
195
Reusable documentation blocks live in `_shared/` directories:
-`docs/_shared/`: PDF engine features (attachments, encryption, flatten, metadata, PDF/A-UA, syntax validation)
192
199
193
-
When a feature applies to multiple endpoints, it MUST be a shared partial. Never duplicate content across pages — import the partial instead.
200
+
When a feature applies to multiple endpoints, it MUST be a shared partial. Never duplicate content across pages. Import the partial instead.
194
201
195
202
### Admonitions
196
203
@@ -226,7 +233,7 @@ When adding a new page, update `sidebars.js`:
226
233
227
234
### Versioning
228
235
229
-
The site supports versioned documentation (`versioned_docs/`, `versions.json`). Current docs live in `docs/`. Do not modify versioned docs unless explicitly asked — changes to `docs/` apply to the current (next) version only.
236
+
The site supports versioned documentation (`versioned_docs/`, `versions.json`). Current docs live in `docs/`. Do not modify versioned docs unless explicitly asked. Changes to `docs/` apply to the current (next) version only.
230
237
231
238
---
232
239
@@ -238,7 +245,7 @@ Content for modifying site design, React components, styles, or layout (CSS, the
238
245
239
246
-**Framework:** Docusaurus 3.8.1 (React 18)
240
247
-**Styling:** CSS Modules (`.module.css`) for components, global CSS (`src/css/custom.css`) for theme overrides
241
-
-**Fonts:** Inter (body, headings), JetBrains Mono (code) — loaded via Google Fonts
248
+
-**Fonts:** Inter (body, headings), JetBrains Mono (code), loaded via Google Fonts
242
249
-**Icons:** Inline SVGs in React components (no icon library)
243
250
-**Images:**`@docusaurus/plugin-ideal-image` for optimized images
244
251
@@ -275,7 +282,7 @@ HTTP method badge colors:
275
282
- Max content width: 840px (`.theme-doc-markdown`)
276
283
- Container width: 1366px
277
284
- Navbar height: 4rem
278
-
- Light mode only — dark mode switch is disabled
285
+
- Light mode only (dark mode switch is disabled)
279
286
280
287
### Component Architecture
281
288
@@ -307,7 +314,7 @@ Renders sponsor logos at the bottom of documentation pages.
307
314
308
315
### Theme Overrides
309
316
310
-
-`src/theme/DocSidebar/index.js` — Custom sidebar with HTTP method badges via CSS pseudo-elements
317
+
-`src/theme/DocSidebar/index.js`: Custom sidebar with HTTP method badges via CSS pseudo-elements
311
318
- Sidebar badges are implemented purely in CSS using `::before` pseudo-elements on `.sidebar-method-*` classes
312
319
313
320
### CSS Conventions
@@ -321,10 +328,10 @@ Renders sponsor logos at the bottom of documentation pages.
321
328
322
329
### Docusaurus Integration
323
330
324
-
- Respect Docusaurus's Infima CSS framework — override with specificity, not `!important` (except documented exceptions)
331
+
- Respect Docusaurus's Infima CSS framework. Override with specificity, not `!important` (except documented exceptions).
325
332
- Use `@docusaurus/Link` for internal navigation, not `<a>` tags
326
333
- Use `useBaseUrl` for static asset paths
327
-
- Swizzled components live in `src/theme/` — be cautious when upgrading Docusaurus
334
+
- Swizzled components live in `src/theme/`. Be cautious when upgrading Docusaurus.
Use the `embeds` form field to attach external files directly inside the PDF container.
4
-
5
-
**Common Use Case:**
6
-
This is essential for e-invoicing standards like **[ZUGFeRD / Factur-X](https://fnfe-mpe.org/factur-x/)**, which require a human-readable PDF to
7
-
carry a machine-readable XML invoice as an attachment.
3
+
Attach external files directly inside the PDF container. Commonly used for e-invoicing standards like **[ZUGFeRD / Factur-X](https://fnfe-mpe.org/factur-x/)**, which require a machine-readable XML invoice as an attachment.
Secure your PDF by setting passwords that control access and permissions.
3
+
Set passwords to control PDF access. The **user password** is required to open the PDF; the **owner password** controls permissions (printing, copying, editing).
4
4
5
-
-**User Password:** Required to **open** and view the PDF.
Use the `metadata` form field to inject XMP metadata into the generated PDF. This allows you to set properties like
4
-
**Author**, **Title**, **Copyright**, and **Keywords** by passing a **JSON-formatted object**.
3
+
Inject XMP metadata (Author, Title, Copyright, Keywords, etc.) into the PDF as a JSON object.
5
4
6
-
:::info Valid Keys
7
-
8
-
Not all metadata tags are writable. Gotenberg relies on ExifTool for this operation.
9
-
[See the XMP Tag Name documentation](https://exiftool.org/TagNames/XMP.html#pdf) for a list of potential keys.
10
-
11
-
:::
12
-
13
-
:::caution Compliance Warning
14
-
15
-
Writing metadata involves modifying the PDF structure and usually breaks **PDF/A** compliance.
16
-
17
-
:::
5
+
Not all tags are writable. Gotenberg uses ExifTool under the hood. See the [XMP Tag Name documentation](https://exiftool.org/TagNames/XMP.html#pdf) for valid keys. Writing metadata usually breaks **PDF/A** compliance.
Use the `pdfa` and `pdfua` form fields to convert the result into a standardized PDF format during _post-processing_.
3
+
Converts to PDF/A (archival) or PDF/UA (accessibility) during post-processing using LibreOffice. Slower than native conversion (requires a second pass).
4
4
5
-
-**Process:** Gotenberg generates the result, then re-processes it using LibreOffice (the only engine supporting these standards).
6
-
-**Performance:** Slower (requires a second conversion pass).
7
-
-**Result:** A compliant PDF/A (Archival) or PDF/UA (Universal Accessibility) document.
5
+
PDF/A and encryption are mutually exclusive: requesting both returns `400 Bad Request`. PDF/A-1b and PDF/A-2b don't support file attachments; use PDF/A-3b if you need both.
8
6
9
-
:::danger
10
-
11
-
PDF/A and encryption are mutually exclusive — requesting both returns a `400 Bad Request`.
12
-
13
-
:::
14
-
15
-
:::warning
16
-
17
-
PDF/A-1b and PDF/A-2b do not support file attachments. Use PDF/A-3b if you need both archival compliance and embedded files.
18
-
19
-
:::
20
-
21
-
:::info Metadata Limitation
22
-
23
-
When PDF/A conversion runs alongside other post-processing features, LibreOffice overwrites certain XMP metadata fields during the compliance pass. The `CreateDate`, `ModDate`, and `Keywords` fields are not reliably user-controllable in these scenarios. Other metadata fields (`Author`, `Copyright`, `Creator`, `Producer`, `Subject`, `Title`, `Trapped`, `Marked`) are correctly preserved.
24
-
25
-
:::
7
+
When PDF/A runs alongside other post-processing, LibreOffice overwrites `CreateDate`, `ModDate`, and `Keywords`. Other metadata fields are preserved.
0 commit comments