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
docs: tighten Getting Started FAQ pages with correct API usage (SD-2873)
- Theming: createTheme returns a className applied via document.documentElement.classList.add, not a constructor option. Adds popover/CSP pitfalls.
- Fonts: modules.toolbar.fonts takes [{ label, key }] objects, not bare strings. Adds dropdown-not-auto-populated pitfall.
- AI: chooser table + three concrete paths with real install command.
- Import/Export: leads with value statement; adds duplicate-download/HTML-base-DOCX pitfalls.
keywords: "ai, mcp, claude, cursor, llm tools, ai agents, document automation, ai sdk"
5
5
---
6
6
7
-
Pick the AI integration that matches what you're building. For the full AI section, see [AI Overview](/ai/overview).
7
+
SuperDoc gives AI models structured access to real Word documents. Use MCP when a coding agent is working on files. Use LLM tools when you're building document editing into your own app. Use the SDK or CLI for backend automation.
8
8
9
-
## Pick your path
9
+
## Pick the path
10
10
11
-
<CardGroupcols={2}>
12
-
<Cardtitle="I want Claude/Cursor to edit DOCX"icon="terminal"href="/ai/mcp/overview">
13
-
**MCP server.** Drop SuperDoc's MCP server into Claude Desktop, Cursor, or any MCP-compatible host. Claude can then open, read, and edit DOCX files locally.
14
-
</Card>
15
-
<Cardtitle="I want AI editing inside my app"icon="bot"href="/ai/agents/llm-tools">
16
-
**LLM tools.** SuperDoc ships pre-typed tool catalogs for OpenAI, Anthropic, Vercel AI SDK, Mastra, and others. Wire them into your existing agent.
17
-
</Card>
18
-
<Cardtitle="I want scripts or CI to edit DOCX"icon="code"href="/document-engine/cli">
19
-
**CLI or SDKs.** Run DOCX operations from a script, GitHub Action, or backend job. No browser needed.
20
-
</Card>
21
-
<Cardtitle="I want LLM-friendly content from DOCX"icon="file-export"href="/getting-started/import-export">
22
-
**Markdown/JSON export.** Pull document content out as Markdown or JSON to feed into your own LLM context.
23
-
</Card>
24
-
</CardGroup>
11
+
| You want to | Use |
12
+
|---|---|
13
+
| Let Claude/Cursor edit DOCX files |[MCP server](/ai/mcp/overview)|
14
+
| Build AI editing into your app |[LLM tools](/ai/agents/llm-tools)|
15
+
| Automate DOCX from scripts or CI |[SDK](/document-engine/sdks) or [CLI](/document-engine/cli)|
16
+
| Stream generated content into the editor | Browser editor + [`editor.doc.insert`](/document-api/overview)|
25
17
26
-
## What ships with SuperDoc
18
+
## Coding agents (MCP)
27
19
28
-
SuperDoc treats AI as a first-class consumer. Three packages, all driven by the same Document API:
20
+
The fastest path. SuperDoc ships an MCP server that any MCP-aware host can use.
29
21
30
-
-**`@superdoc-dev/mcp`** — Model Context Protocol server. Lets MCP-aware hosts (Claude Desktop, Cursor) read and edit DOCX files.
31
-
-**`@superdoc-dev/sdk`** — Node and Python SDKs for server-side automation. Same operations as the browser editor.
32
-
-**`@superdoc-dev/cli`** — Command-line tool for scripts, CI, and one-off operations.
22
+
```bash
23
+
claude mcp add superdoc -- npx @superdoc-dev/mcp
24
+
```
33
25
34
-
All three share the [Document API](/document-api/overview) under the hood — the same `editor.doc.*` operations you use in the browser.
26
+
Then ask Claude to open, read, or edit a DOCX file. The agent calls SuperDoc's typed tools — no HTML wrangling, no re-uploads.
35
27
36
-
## Why this is different
28
+
## App integration (LLM tools)
37
29
38
-
Most editors expose AI via "ask the AI to write something." SuperDoc exposes the document itself: AI can list comments, decide tracked changes, replace text by selection, insert tables, format runs — all as discrete typed operations. No HTML wrangling, no re-uploading the file after each change.
30
+
For agent editing inside your own app, SuperDoc ships pre-typed tool catalogs for OpenAI, Anthropic, Vercel AI SDK, Mastra, and others. Wire them into your existing model loop.
39
31
40
-
For the agent best-practices guide and the full tool catalog, see [AI > Agents](/ai/agents/llm-tools).
32
+
```javascript
33
+
import { tools } from'@superdoc-dev/sdk';
34
+
// pass tools to your model, dispatch tool calls against the SuperDoc SDK
35
+
```
36
+
37
+
## Browser editor + AI output
38
+
39
+
If you're already running the SuperDoc editor in the browser and want AI-generated content to land in the document:
40
+
41
+
```javascript
42
+
consthtml=awaitcallYourLLM(prompt);
43
+
editor.doc.insert({ target: cursor, html });
44
+
```
45
+
46
+
The same Document API the editor uses internally — typed inputs, structured outputs, no string parsing.
47
+
48
+
## Common pitfalls
49
+
50
+
-**MCP server in the wrong host context.** The MCP server runs on the same machine as the agent. Configure it in Claude Desktop / Cursor / your MCP host, not in the SuperDoc browser app.
51
+
-**Tool dispatch with stale schemas.** SDK tool catalogs are versioned with the SDK. Pin both packages together to keep types and runtime in sync.
41
52
42
53
## Where to next
43
54
44
55
-[AI Overview](/ai/overview) — the full AI section
45
-
-[AI > MCP](/ai/mcp/overview) — Model Context Protocol setup
46
-
-[AI > Agents > LLM tools](/ai/agents/llm-tools) — typed tool catalogs for OpenAI, Anthropic, etc.
56
+
-[AI > MCP > Overview](/ai/mcp/overview) — MCP setup for Claude Desktop, Cursor, and other hosts
Copy file name to clipboardExpand all lines: apps/docs/getting-started/fonts.mdx
+22-32Lines changed: 22 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,70 +4,60 @@ sidebarTitle: Font Support
4
4
keywords: "fonts, font loading, calibri, cambria, aptos, font fallback, custom fonts, font dropdown, office fonts"
5
5
---
6
6
7
-
How fonts work in SuperDoc, and what to do when a document looks different from how it looks in Word.
7
+
SuperDoc keeps the font name from the Word document. Rendering that font is the browser's job. If the browser can't find Calibri, Cambria, Aptos, or your brand font, it falls back to another font and the layout shifts.
8
8
9
-
## How SuperDoc handles fonts
9
+
## Load fonts in your app
10
10
11
-
SuperDoc preserves the font names that come from your DOCX. It does **not** load font files for you. Whether `Calibri Light` actually renders as Calibri Light depends on whether that font is available to the browser running your app.
12
-
13
-
Three things you control:
14
-
15
-
1.**Loading font files** — your app's responsibility (CSS `@font-face`, `<link>` tags, font CDNs).
16
-
2.**Toolbar dropdown options** — which fonts users can pick from in the built-in toolbar.
17
-
3.**Font fallbacks** — what happens when the requested font isn't available.
18
-
19
-
## The "why does it look different from Word?" question
20
-
21
-
Most of the time, the document references Microsoft fonts (Calibri, Cambria, Aptos, Times New Roman) that aren't on the user's system or aren't loaded by your host page. The browser falls back to a default font and the layout shifts.
22
-
23
-
Two common fixes:
24
-
25
-
-**License the actual fonts** and load them via `@font-face`. This gives pixel-accurate rendering.
26
-
-**Load free substitutes** with similar metrics. [Carlito](https://fonts.google.com/specimen/Carlito) for Calibri, [Caladea](https://fonts.google.com/specimen/Caladea) for Cambria are common Google Fonts swaps.
11
+
Fonts are your host page's responsibility. `@font-face`, a hosted stylesheet, or a font CDN — anything the browser can resolve.
27
12
28
13
```css
29
-
/* Example: load Carlito as a Calibri substitute */
For Office fonts that aren't free (Calibri, Cambria, Aptos), either license them or alias compatible substitutes — [Carlito](https://fonts.google.com/specimen/Carlito) for Calibri, [Caladea](https://fonts.google.com/specimen/Caladea) for Cambria.
22
+
23
+
## Register fonts in the toolbar
38
24
39
-
The built-in toolbar has a font picker. By default it shows a curated list. To customize the available fonts:
25
+
The toolbar's font dropdown shows whatever you register in `modules.toolbar.fonts`. Each entry is a `{ label, key }` pair where `key` is the CSS `font-family` value:
40
26
41
27
```javascript
42
28
newSuperDoc({
43
29
selector:'#editor',
44
30
document:'contract.docx',
45
31
modules: {
46
32
toolbar: {
47
-
fonts: ['Inter', 'Calibri', 'Times New Roman', 'Custom Brand Font'],
33
+
fonts: [
34
+
{ label:'Calibri', key:'Calibri, sans-serif' },
35
+
{ label:'Inter', key:'Inter, sans-serif' },
36
+
{ label:'Times New Roman', key:'"Times New Roman", serif' },
37
+
],
48
38
},
49
39
},
50
40
});
51
41
```
52
42
53
-
<Note>
54
-
Adding a font to the toolbar dropdown does **not** load the font file. You still need to make the font available to the browser via CSS. The dropdown only controls which fonts the user can select.
55
-
</Note>
43
+
Registering a font makes it **selectable** in the dropdown. It does **not** load the font file. You still need the `@font-face` (or equivalent) on your host page.
56
44
57
-
For the full toolbar font configuration options, see [Built-in UI > Toolbar](/editor/built-in-ui/toolbar#font-configuration).
45
+
## Programmatic font changes
58
46
59
-
## Setting fonts programmatically
60
-
61
-
To set fonts from code (e.g. an AI agent applying a brand font), use the Document API:
For the full font formatting API surface, see [Document API > Available operations](/document-api/available-operations).
53
+
## Common pitfalls
54
+
55
+
-**Font name preserved, browser falls back.** The font name from the DOCX is intact, but the actual file isn't loaded. Add `@font-face`.
56
+
-**Dropdown doesn't show a font.** Imported documents don't auto-populate the toolbar list. If a `.docx` uses Cambria but Cambria isn't in `fonts`, the user can't pick it from the dropdown — even though the current selection indicator may show "Cambria" if that's what the run uses.
57
+
-**Office font licensing.** Calibri, Cambria, and Aptos are licensed Microsoft fonts. Self-hosting requires a license. Free substitutes are common in non-pixel-perfect contexts.
68
58
69
59
## Where to next
70
60
71
-
-[Built-in UI > Toolbar](/editor/built-in-ui/toolbar) — toolbar font configuration
61
+
-[Built-in UI > Toolbar](/editor/built-in-ui/toolbar#font-configuration) — full toolbar font configuration options
72
62
-[Document API > Available operations](/document-api/available-operations) — programmatic font formatting
73
63
-[Editor > Theming](/editor/theming/overview) — set the default font for SuperDoc's UI chrome
Five-minute orientation for getting documents in and out of SuperDoc. For the full reference, see [Editor > SuperDoc > Import/Export](/editor/superdoc/import-export).
7
+
SuperDoc treats DOCX as the real document, not an export target. Load a Word file, edit it in the browser, and export a Word file again — tracked changes, comments, complex tables, all preserved. HTML and Markdown are useful for AI-generated content, but DOCX is the full-fidelity path.
8
+
9
+
For the full reference, see [Editor > SuperDoc > Import/Export](/editor/superdoc/import-export).
Store the **DOCX blob** if you want full fidelity (recommended). Store JSON if you want programmatic search/diff and don't need round-tripping with Word users. Don't store HTML or Markdown unless you accept losing fidelity.
67
69
70
+
## Common pitfalls
71
+
72
+
-**Duplicate downloads.**`superdoc.export()` triggers a browser download by default. If you want to upload to a backend, pass `{ triggerDownload: false }` — otherwise you get the file twice.
73
+
-**HTML import without a base DOCX.** The `html` and `markdown` options need a `document` (a base `.docx`) for styles. Without one, headings and lists fall back to defaults.
74
+
-**HTML round-trips lose styling.** Importing HTML, exporting DOCX, and then importing the resulting HTML back will not produce the original Word styling. For round-tripping, use DOCX or JSON.
75
+
68
76
## Where to next
69
77
70
78
-[Editor > SuperDoc > Import/Export](/editor/superdoc/import-export) — full API reference (every option, every export flag)
Five-minute setup for matching SuperDoc to your brand. For the full token catalog and `createTheme()` reference, see [Editor > Theming](/editor/theming/overview).
7
+
SuperDoc's UI is styled with CSS variables. `createTheme()` generates a class name that sets those variables; you apply the class to `<html>` and every SuperDoc surface picks it up — toolbar, comments, dropdowns, context menu, popovers.
8
8
9
-
## Set your brand colors
9
+
## The fast path
10
10
11
11
```javascript
12
12
import { SuperDoc, createTheme } from'superdoc';
13
13
14
14
consttheme=createTheme({
15
15
colors: {
16
-
action:'#6366f1', // buttons, links, active states
17
-
bg:'#ffffff',// panels, dropdowns
18
-
text:'#1e293b',
19
-
border:'#e2e8f0',
16
+
action:'#1355FF', // buttons, links, active states
The toolbar, comments sidebar, dropdowns, and every other built-in surface pick up the theme automatically.
30
+
`theme` is a className string. Apply it to `<html>` (not the editor container) so popovers, dropdowns, and the comments sidebar — which can render outside the editor element — pick up the same tokens.
31
+
32
+
## What themes affect
33
33
34
-
## Common patterns
34
+
Toolbar buttons, comments sidebar, dropdowns, context menu, search bar, dialog surfaces. Any chrome SuperDoc renders. The document content itself (paragraphs, headings, tables) renders with its own styles from the DOCX.
35
35
36
-
**Dark mode**: pass a different theme when your app's color scheme changes.
36
+
## When to drop to CSS variables
37
+
38
+
`createTheme()` covers the common case. For component-level overrides, use the `vars` option or set raw `--sd-*` variables in your stylesheet:
**Per-instance override**: each `SuperDoc` instance can have its own theme.
50
+
## Common pitfalls
45
51
46
-
**CSS variable escape hatch**: every theme value is a CSS custom property (`--sd-color-action`, `--sd-color-bg`, etc.). You can override individual variables in your stylesheet without rewriting the whole theme.
52
+
-**Theme class on the wrong element.** Add it to `document.documentElement` (the `<html>` tag), not the editor's container. Popovers render at the body level and won't pick up the theme otherwise.
53
+
-**CSP environments.**`createTheme()` injects a `<style>` tag. If you serve with a strict CSP, use `buildTheme()` instead — it returns `{ className, css }` so you can inject the CSS yourself with the right nonce.
0 commit comments