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
Final pass over the docs surface to align with brand.md voice and
the new IA terminology.
Terminology:
- 'Bring Your Own UI' / 'BYO UI' to 'Custom UI' across 12+ mdx files,
llms.txt, llms-full.txt, code comments in packages/super-editor and
packages/superdoc.
- Rename the Custom UI demo: demos/bring-your-own-ui to demos/custom-ui.
Update package.json name, playwright port mapping key, README, and
GitHub URL references in mdx.
Brand voice:
- Em-dash sweep across hand-written mdx (skip auto-generated files
under document-api/reference and the gen:docs marker block in
document-engine/sdks.mdx). 'X — Y' becomes 'X. Y' or 'X (Y)' or
'X: Y' depending on context.
- Wrap frontmatter description values that contain colons in double
quotes so YAML parses correctly (caught by mintlify validate).
- Touch up grammatical regressions where the colon substitution read
worse than the em-dash (theming.mdx, document-engine/overview.mdx,
getting-started/{ai,import-export}.mdx).
Legacy hides (kept reachable for inbound links, removed from search):
- document-engine/ai-agents/* (7 pages) and getting-started/ai-agents.mdx
add hidden: true frontmatter. Redirects already point /ai/* and
/getting-started/ai at the new homes; this stops the old pages from
surfacing in search results.
Notes:
- Auto-generated content (Document API reference, sdks.mdx marker
block) still has em-dashes. Filing a follow-up for the generator.
- demos/custom-ui/ folder renamed cleanly (no backward-compat shim
per direction). Old GitHub URLs that pointed at demos/bring-your-own-ui
will 404; trade-off accepted.
Framework-agnostic patterns built on `createHeadlessToolbar()`. Pick the one closest to your stack.
9
9
10
10
<Note>
11
-
**On React?** Reach for [Bring Your Own UI › Toolbar and commands](/editor/custom-ui/toolbar-and-commands) instead. The typed React surface (`useSuperDocCommand`, `ui.commands.register`) re-renders one button per command, ships with selection / comments / track-changes hooks, and works with any design system (shadcn, MUI, Mantine, Tailwind). The headless examples below are for non-React stacks.
11
+
**On React?** Reach for [Custom UI › Toolbar and commands](/editor/custom-ui/toolbar-and-commands) instead. The typed React surface (`useSuperDocCommand`, `ui.commands.register`) re-renders one button per command, ships with selection / comments / track-changes hooks, and works with any design system (shadcn, MUI, Mantine, Tailwind). The headless examples below are for non-React stacks.
12
12
</Note>
13
13
14
14
## Vue + Vuetify
@@ -141,7 +141,7 @@ Replace `<example-name>` with `vue-vuetify`, `svelte-shadcn`, or `vanilla`.
141
141
## Next steps
142
142
143
143
<CardGroupcols={2}>
144
-
<Cardtitle="Bring Your Own UI (React)"icon="atom"href="/editor/custom-ui/toolbar-and-commands">
Copy file name to clipboardExpand all lines: apps/docs/advanced/headless-toolbar.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Build your own toolbar UI. SuperDoc provides the state and commands — you rend
9
9
10
10
## Using React?
11
11
12
-
`superdoc/headless-toolbar` is the framework-agnostic substrate. **For new React apps, reach for `useSuperDocCommand` from `superdoc/ui/react` instead.** It re-renders one button per command (not the whole toolbar) and ships alongside companion hooks for selection, comments, and tracked changes. See [Bring Your Own UI › Toolbar and commands](/editor/custom-ui/toolbar-and-commands).
12
+
`superdoc/headless-toolbar` is the framework-agnostic substrate. **For new React apps, reach for `useSuperDocCommand` from `superdoc/ui/react` instead.** It re-renders one button per command (not the whole toolbar) and ships alongside companion hooks for selection, comments, and tracked changes. See [Custom UI › Toolbar and commands](/editor/custom-ui/toolbar-and-commands).
13
13
14
14
`superdoc/headless-toolbar` stays supported for existing integrations and framework-agnostic toolbar-only use cases. Both paths read from the same internal substrate.
Copy file name to clipboardExpand all lines: apps/docs/advanced/supereditor/overview.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ SuperEditor is the low-level DOCX editing engine that powers SuperDoc. Most apps
9
9
10
10
## Pick the right layer
11
11
12
-
**Use SuperDoc + Bring Your Own UI for custom React UI.**`<SuperDocEditor>` (or `new SuperDoc(...)`) plus `superdoc/ui/react` gives you typed hooks for toolbar, comments, tracked changes, selection, and document control. See [Bring Your Own UI](/editor/custom-ui/overview).
12
+
**Use SuperDoc + Custom UI for custom React UI.**`<SuperDocEditor>` (or `new SuperDoc(...)`) plus `superdoc/ui/react` gives you typed hooks for toolbar, comments, tracked changes, selection, and document control. See [Custom UI](/editor/custom-ui/overview).
13
13
14
14
**Use the Document API for document mutations.**[`editor.doc.*`](/document-api/overview) is the stable, request/response surface that's identical on server, client, and AI agents. It's the recommended path for any insert / replace / format / comment / tracked-change operation.
15
15
@@ -22,7 +22,7 @@ SuperEditor is the low-level DOCX editing engine that powers SuperDoc. Most apps
22
22
- You're building a custom extension that taps into ProseMirror plugins or schemas.
23
23
- You explicitly need engine internals the higher layers don't surface.
24
24
25
-
For a typical React DOCX editor with a custom UI, you don't need this page — start at [Bring Your Own UI](/editor/custom-ui/overview).
25
+
For a typical React DOCX editor with a custom UI, you don't need this page — start at [Custom UI](/editor/custom-ui/overview).
Copy file name to clipboardExpand all lines: apps/docs/ai/agents/best-practices.mdx
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
2
title: Best practices
3
3
sidebarTitle: Best practices
4
-
description: Get better results from LLM document editing — prompting, tool call patterns, and workflow tips
4
+
description: "Get better results from LLM document editing: prompting, tool call patterns, and workflow tips"
5
5
keywords: "llm best practices, ai document editing, prompt engineering, superdoc tools, tool calling, document automation"
6
6
---
7
7
8
8
These patterns help your LLM agent produce reliable, efficient document edits.
9
9
10
10
## Use the bundled system prompt
11
11
12
-
`getSystemPrompt()` returns a tested prompt that teaches the model how to use SuperDoc tools — targeting, workflow order, and multi-action tools. Load it once and pass it as the system message.
12
+
`getSystemPrompt()` returns a tested prompt that teaches the model how to use SuperDoc tools: targeting, workflow order, and multi-action tools. Load it once and pass it as the system message.
@@ -32,15 +32,15 @@ You edit `.docx` files using SuperDoc intent tools. Be efficient and minimize to
32
32
33
33
## Workflow
34
34
35
-
1.**Read** — Use `superdoc_get_content` to understand the document.
36
-
2.**Search** — Use `superdoc_search` to find stable handles or block addresses.
37
-
3.**Edit** — Use the focused tool that matches the job:
35
+
1.**Read**: Use `superdoc_get_content` to understand the document.
36
+
2.**Search**: Use `superdoc_search` to find stable handles or block addresses.
37
+
3.**Edit**: Use the focused tool that matches the job:
38
38
-`superdoc_edit` for insert, replace, delete, undo, redo
39
39
-`superdoc_format` for inline or paragraph formatting
40
40
-`superdoc_create` for paragraphs and headings
41
41
-`superdoc_comment` for comment threads
42
42
-`superdoc_track_changes` for review decisions
43
-
4.**Batch only when useful** — Use `superdoc_mutations` for preview/apply or atomic multi-step edits.
43
+
4.**Batch only when useful**: Use `superdoc_mutations` for preview/apply or atomic multi-step edits.
44
44
45
45
## Rules
46
46
@@ -55,17 +55,17 @@ You edit `.docx` files using SuperDoc intent tools. Be efficient and minimize to
55
55
56
56
A typical edit takes 3-5 tool calls:
57
57
58
-
1.`superdoc_get_content` — understand what's in the document
59
-
2.`superdoc_search` — find the exact location (returns stable handles/addresses)
60
-
3. Edit tool (`superdoc_edit`, `superdoc_format`, etc.) — apply the change using targets from search
58
+
1.`superdoc_get_content`: understand what's in the document
59
+
2.`superdoc_search`: find the exact location (returns stable handles/addresses)
60
+
3. Edit tool (`superdoc_edit`, `superdoc_format`, etc.): apply the change using targets from search
61
61
62
62
This matters because handles from search results point to the exact right location. If the model guesses a block address instead of searching for it, edits land in the wrong place.
63
63
64
64
## Minimize tool calls
65
65
66
66
Instruct the LLM to plan all edits before calling tools. A well-structured prompt like "Find the termination clause and rewrite it to allow 30-day notice" should take 3-5 calls, not 15.
67
67
68
-
Batch multiple changes only when atomic execution is genuinely helpful — use `superdoc_mutations` for that.
68
+
Batch multiple changes only when atomic execution is genuinely helpful: use `superdoc_mutations` for that.
69
69
70
70
## Prefer markdown insert for multi-block creation
71
71
@@ -79,9 +79,9 @@ When you need to create multiple headings and paragraphs in one operation, use `
79
79
}
80
80
```
81
81
82
-
After inserting, apply formatting in a single `superdoc_mutations` batch using `format.apply` steps — one step per block or range. This reduces a workflow that might otherwise take 40+ calls down to 4: read, search, insert, format.
82
+
After inserting, apply formatting in a single `superdoc_mutations` batch using `format.apply` steps: one step per block or range. This reduces a workflow that might otherwise take 40+ calls down to 4: read, search, insert, format.
83
83
84
-
## Use focused tools —`superdoc_mutations` is an escape hatch
84
+
## Use focused tools:`superdoc_mutations` is an escape hatch
85
85
86
86
For straightforward edits, use the focused intent tools (`superdoc_edit`, `superdoc_format`, `superdoc_create`, `superdoc_list`, `superdoc_comment`). They validate arguments, give clear errors, and are easier for models to call correctly.
87
87
@@ -92,14 +92,14 @@ Reach for `superdoc_mutations` only when you need:
92
92
93
93
## Feed errors back
94
94
95
-
`dispatchSuperDocTool` returns structured errors. Pass them back as tool results — most models self-correct on the next turn.
95
+
`dispatchSuperDocTool` returns structured errors. Pass them back as tool results: most models self-correct on the next turn.
96
96
97
97
```typescript
98
98
try {
99
99
const result =awaitdispatchSuperDocTool(doc, toolCall.function.name, JSON.parse(toolCall.function.arguments));
@@ -110,9 +110,9 @@ Don't hardcode formatting values. Read them from the document's existing content
110
110
111
111
**Body text:** Read `fontFamily`, `fontSize`, and `color` from non-empty paragraphs with `alignment: "justify"` or `alignment: "left"`. Set `bold: false` for body paragraphs.
112
112
113
-
Many DOCX documents report `underline: true` on all blocks due to style inheritance. This is a DOCX artifact — not intentional formatting. Do not carry it forward when inserting new paragraphs.
113
+
Many DOCX documents report `underline: true` on all blocks due to style inheritance. This is a DOCX artifact: not intentional formatting. Do not carry it forward when inserting new paragraphs.
114
114
115
-
**Headings:** Read from existing heading blocks in the document. Scale `fontSize` up relative to body text. Headings are typically bold and sometimes centered — confirm against what's already in the document rather than assuming.
115
+
**Headings:** Read from existing heading blocks in the document. Scale `fontSize` up relative to body text. Headings are typically bold and sometimes centered: confirm against what's already in the document rather than assuming.
116
116
117
117
```typescript
118
118
// Get content first, find a representative body paragraph
@@ -173,7 +173,7 @@ These prompts have been tested against the SuperDoc tool set. Use them as inspir
173
173
- "Apply yellow highlight to every sentence that contains an indemnification obligation."
174
174
- "Replace all references to 'Contractor' with 'Service Provider' and make each replacement italic with tracked changes enabled."
175
175
- "Underline every sentence that references payment terms or late fees."
176
-
- "Insert CONFIDENTIAL — DO NOT DISTRIBUTE at the very top of the document and make it bold, red, 14pt."
176
+
- "Insert CONFIDENTIAL: DO NOT DISTRIBUTE at the very top of the document and make it bold, red, 14pt."
177
177
- "Scan the document for inconsistent capitalization of defined terms and fix them with tracked changes enabled."
178
178
179
179
### Formatting and structure
@@ -200,7 +200,7 @@ These prompts have been tested against the SuperDoc tool set. Use them as inspir
200
200
201
201
## Related
202
202
203
-
-[LLM tools](/ai/agents/llm-tools) — tool catalog and SDK functions
204
-
-[How to use](/ai/agents/integrations) — step-by-step integration guide
@@ -13,8 +13,8 @@ Every LLM tool call maps to a [Document API](/document-api/overview) operation u
13
13
14
14
This gives you a clear debugging strategy:
15
15
16
-
1.**Test the Document API directly.** Call the underlying SDK method with the same arguments. If it works, the operation is fine — the problem is in the prompt or the tool schema.
17
-
2.**If the API call fails,** the issue is in the operation itself — check arguments, targets, and document state.
16
+
1.**Test the Document API directly.** Call the underlying SDK method with the same arguments. If it works, the operation is fine: the problem is in the prompt or the tool schema.
17
+
2.**If the API call fails,** the issue is in the operation itself: check arguments, targets, and document state.
18
18
3.**If the API call succeeds but the LLM tool call fails,** the model is calling the tool incorrectly. Fix the prompt, add examples, or check the tool schema.
19
19
20
20
```typescript
@@ -55,29 +55,29 @@ for (const toolCall of choice.message.tool_calls) {
55
55
```
56
56
57
57
What to look for in logs:
58
-
-**Tool name** — is the model calling the right tool?
59
-
-**Arguments** — are required fields present? Is the `action` correct?
60
-
-**Targets** — are handles/addresses from a recent search, or did the model guess?
61
-
-**Result** — did the operation return data or an error?
58
+
-**Tool name**: is the model calling the right tool?
59
+
-**Arguments**: are required fields present? Is the `action` correct?
60
+
-**Targets**: are handles/addresses from a recent search, or did the model guess?
61
+
-**Result**: did the operation return data or an error?
62
62
63
63
## Error shapes
64
64
65
65
`dispatchSuperDocTool` throws errors in two categories:
66
66
67
-
**Validation errors** — bad arguments before the operation runs:
67
+
**Validation errors**: bad arguments before the operation runs:
0 commit comments