@clidey/dory 1.0.7 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/bin/chat-server.ts +270 -0
- package/bin/dist/analytics-server.d.ts +11 -0
- package/bin/dist/analytics-server.d.ts.map +1 -0
- package/bin/dist/analytics-server.js +121 -0
- package/bin/dist/analytics-server.js.map +1 -0
- package/bin/dist/automation.d.ts +35 -0
- package/bin/dist/automation.d.ts.map +1 -0
- package/bin/dist/automation.js +259 -0
- package/bin/dist/automation.js.map +1 -0
- package/bin/dist/chat-server.d.ts +8 -0
- package/bin/dist/chat-server.d.ts.map +1 -0
- package/bin/dist/chat-server.js +322 -0
- package/bin/dist/chat-server.js.map +1 -0
- package/bin/dist/check.d.ts +16 -0
- package/bin/dist/check.d.ts.map +1 -0
- package/bin/dist/check.js +247 -0
- package/bin/dist/check.js.map +1 -0
- package/bin/dist/dory.js +252 -402
- package/bin/dist/dory.js.map +1 -1
- package/bin/dist/i18n-init.d.ts +6 -0
- package/bin/dist/i18n-init.d.ts.map +1 -0
- package/bin/dist/i18n-init.js +56 -0
- package/bin/dist/i18n-init.js.map +1 -0
- package/bin/dist/mcp-http.d.ts +8 -0
- package/bin/dist/mcp-http.d.ts.map +1 -0
- package/bin/dist/mcp-http.js +72 -0
- package/bin/dist/mcp-http.js.map +1 -0
- package/bin/dist/mcp.d.ts +2 -0
- package/bin/dist/mcp.d.ts.map +1 -0
- package/bin/dist/mcp.js +81 -0
- package/bin/dist/mcp.js.map +1 -0
- package/bin/dist/preview-entry.d.ts +2 -0
- package/bin/dist/preview-entry.d.ts.map +1 -0
- package/bin/dist/preview-entry.js +6 -0
- package/bin/dist/preview-entry.js.map +1 -0
- package/bin/dist/preview-server.d.ts +5 -0
- package/bin/dist/preview-server.d.ts.map +1 -0
- package/bin/dist/preview-server.js +159 -0
- package/bin/dist/preview-server.js.map +1 -0
- package/bin/dist/project-config.d.ts +22 -0
- package/bin/dist/project-config.d.ts.map +1 -0
- package/bin/dist/project-config.js +44 -0
- package/bin/dist/project-config.js.map +1 -0
- package/dist/index.html +57 -0
- package/dist/runtime/dory-runtime.css +2 -0
- package/dist/runtime/dory-runtime.html +14 -0
- package/dist/runtime/dory-runtime.js +5490 -0
- package/docs/api-playground-demo.mdx +119 -0
- package/docs/api-reference/asyncapi.json +324 -0
- package/docs/api-reference/openapi.json +366 -0
- package/docs/api-reference/operations/create.mdx +5 -0
- package/docs/api-reference/operations/delete.mdx +5 -0
- package/docs/api-reference/operations/get.mdx +5 -0
- package/docs/api-reference/operations/update.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-chat-message.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-notifications.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-presence-update.mdx +5 -0
- package/docs/api-reference/websocket-operations/send-chat-message.mdx +5 -0
- package/docs/api-reference/websocket-operations/send-presence-update.mdx +5 -0
- package/docs/assets/dory.jpeg +0 -0
- package/docs/components/accordion.mdx +145 -0
- package/docs/components/callouts.mdx +134 -0
- package/docs/components/cards.mdx +153 -0
- package/docs/components/code-blocks.mdx +281 -0
- package/docs/components/expandable.mdx +189 -0
- package/docs/components/icons.mdx +71 -0
- package/docs/components/images.mdx +82 -0
- package/docs/components/latex.mdx +148 -0
- package/docs/components/layout.mdx +175 -0
- package/docs/components/lists.mdx +134 -0
- package/docs/components/mermaid.mdx +149 -0
- package/docs/components/overview.mdx +81 -0
- package/docs/components/source.mdx +130 -0
- package/docs/components/steps.mdx +122 -0
- package/docs/components/tables.mdx +114 -0
- package/docs/components/tags.mdx +179 -0
- package/docs/components/typography.mdx +185 -0
- package/docs/configuration/analytics.mdx +45 -0
- package/docs/configuration/chat.mdx +59 -0
- package/docs/configuration/dory-json.mdx +278 -0
- package/docs/configuration/embed.mdx +73 -0
- package/docs/configuration/fonts.mdx +86 -0
- package/docs/configuration/internationalization.mdx +61 -0
- package/docs/configuration/navigation.mdx +217 -0
- package/docs/configuration/theming.mdx +166 -0
- package/docs/dory.json +129 -0
- package/docs/embed-example.html +176 -0
- package/docs/favicon.svg +18 -0
- package/docs/features.mdx +440 -0
- package/docs/getting-started/automation.mdx +76 -0
- package/docs/getting-started/configuration.mdx +95 -0
- package/docs/getting-started/installation.mdx +88 -0
- package/docs/getting-started/quick-start.mdx +53 -0
- package/docs/getting-started/whodb-ee-apps.mdx +122 -0
- package/docs/introduction.mdx +50 -0
- package/docs/logo/logo.svg +18 -0
- package/docs/playgrounds/api-playground.mdx +122 -0
- package/docs/playgrounds/websocket-playground.mdx +98 -0
- package/docs/social-card.png +0 -0
- package/docs/social-card.svg +17 -0
- package/docs/websocket-playground-demo.mdx +135 -0
- package/package.json +23 -17
- package/scripts/verify-runtime-parity.mjs +146 -0
- package/src/app.css +19 -1
- package/src/assets/fonts/HankenGrotesk.ttf +0 -0
- package/src/assets/fonts/OFL.txt +94 -0
- package/src/components/chat-assistant.tsx +229 -0
- package/src/components/dropdown.tsx +3 -3
- package/src/components/error-boundary.tsx +2 -2
- package/src/components/hooks.tsx +20 -1
- package/src/components/navigation.tsx +82 -51
- package/src/components/notification.tsx +2 -3
- package/src/components/routes.tsx +17 -19
- package/src/components/search-index.test.ts +15 -0
- package/src/components/search-index.ts +49 -48
- package/src/components/search.tsx +208 -104
- package/src/components/store.ts +27 -9
- package/src/config/mdx-common.ts +11 -0
- package/src/config/mdx.ts +10 -11
- package/src/embed/loader.ts +0 -3
- package/src/embed/types.ts +0 -2
- package/src/embed/widget-iframe.ts +19 -21
- package/src/embedded-runtime/config.ts +138 -0
- package/src/embedded-runtime/index.tsx +680 -0
- package/src/embedded-runtime/runtime.html +14 -0
- package/src/entry-server.tsx +46 -124
- package/src/main.tsx +16 -4
- package/src/mdx/accordion.tsx +3 -3
- package/src/mdx/api-playground.tsx +18 -16
- package/src/mdx/async-api.tsx +2 -2
- package/src/mdx/card.tsx +3 -2
- package/src/mdx/code.tsx +11 -9
- package/src/mdx/fence.tsx +6 -5
- package/src/mdx/icon-grid.tsx +4 -1
- package/src/mdx/icon-names.test.ts +15 -0
- package/src/mdx/icon-names.ts +60 -0
- package/src/mdx/icon-source-variants.ts +102 -0
- package/src/mdx/icon.tsx +12 -73
- package/src/mdx/latex.tsx +3 -2
- package/src/mdx/mdx.tsx +1 -1
- package/src/mdx/mermaid.tsx +12 -6
- package/src/mdx/open-api.tsx +130 -74
- package/src/mdx/preprocess.test.ts +16 -0
- package/src/mdx/preprocess.ts +61 -0
- package/src/mdx/processor.ts +4 -96
- package/src/mdx/source.tsx +5 -4
- package/src/mdx/specimen.tsx +38 -6
- package/src/mdx/tabs.tsx +29 -21
- package/src/mdx/text.tsx +9 -9
- package/src/mdx/try-it-panel.tsx +284 -0
- package/src/mdx/type-scale.tsx +4 -4
- package/src/mdx/websocket-playground.tsx +21 -14
- package/src/plugins/analytics-injector.ts +8 -0
- package/src/plugins/chat-dev-server.ts +32 -0
- package/src/plugins/docs-assets.test.ts +25 -0
- package/src/plugins/docs-assets.ts +6 -2
- package/src/plugins/frontmatter-dev-server.ts +2 -2
- package/src/plugins/frontmatter-generator.ts +1 -1
- package/src/plugins/html-files-middleware.test.ts +21 -1
- package/src/plugins/html-files-middleware.ts +26 -6
- package/src/plugins/html-metadata-injector.ts +24 -4
- package/src/plugins/llm-txt-dev-server.ts +2 -2
- package/src/plugins/llm-txt-generator.ts +21 -4
- package/src/plugins/prerender.ts +47 -20
- package/src/plugins/robots-generator.ts +1 -1
- package/src/plugins/sanitize.ts +1 -1
- package/src/plugins/shared.ts +6 -18
- package/src/plugins/sitemap-generator.ts +1 -1
- package/src/plugins/social-preview.test.ts +71 -0
- package/src/plugins/social-preview.ts +87 -0
- package/src/plugins/unified-mdx-plugin.ts +1 -1
- package/src/theme.scss +630 -207
- package/src/types/config.ts +53 -1
- package/src/ui/breadcrumb.tsx +17 -0
- package/src/ui/docs-header-view.tsx +32 -0
- package/src/ui/docs-navigation-view.tsx +69 -0
- package/src/ui/docs-page-frame.tsx +50 -0
- package/src/ui/dory-mark.tsx +9 -0
- package/src/ui/header.tsx +33 -90
- package/src/ui/layout.tsx +99 -153
- package/src/ui/mobile-navigation.tsx +10 -8
- package/src/ui/page-actions.tsx +67 -0
- package/src/ui/page-feedback.tsx +50 -0
- package/src/ui/page-footer.tsx +23 -0
- package/src/ui/prev-next-link.tsx +15 -69
- package/src/ui/prev-next-view.tsx +27 -0
- package/src/ui/table-of-content-view.tsx +167 -0
- package/src/ui/table-of-content.tsx +25 -183
- package/src/utils/analytics.test.ts +36 -0
- package/src/utils/analytics.ts +35 -0
- package/src/utils/colors.ts +7 -0
- package/src/utils/content-scope.test.ts +26 -0
- package/src/utils/content-scope.ts +39 -0
- package/src/utils/search-content.ts +12 -0
- package/src/utils/theme.ts +1 -7
- package/vite.config.ssr.ts +3 -3
- package/vite.config.ts +21 -15
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'dory.json Reference'
|
|
3
|
+
description: 'Complete reference for all fields in the dory.json configuration file.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# dory.json Reference
|
|
7
|
+
|
|
8
|
+
The `dory.json` file is the single configuration file for your Dory documentation site. It controls navigation, branding, analytics, and more.
|
|
9
|
+
|
|
10
|
+
## Full Example
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"name": "My Docs",
|
|
15
|
+
"title": "My Docs — Developer Reference",
|
|
16
|
+
"description": "The official developer documentation.",
|
|
17
|
+
"url": "https://docs.example.com",
|
|
18
|
+
"image": "/og-card.png",
|
|
19
|
+
"twitter": "@yourhandle",
|
|
20
|
+
"favicon": "./favicon.svg",
|
|
21
|
+
"colors": {
|
|
22
|
+
"primary": "#6366f1",
|
|
23
|
+
"light": "#818cf8",
|
|
24
|
+
"dark": "#4f46e5",
|
|
25
|
+
"background": "#1a1a2e",
|
|
26
|
+
"surface": "#242440",
|
|
27
|
+
"surfaceElevated": "#2e2e4a",
|
|
28
|
+
"foreground": "#f5f5f7",
|
|
29
|
+
"mutedForeground": "#a0a0b0",
|
|
30
|
+
"border": "rgba(255, 255, 255, 0.1)",
|
|
31
|
+
"accent": "#60a5fa"
|
|
32
|
+
},
|
|
33
|
+
"fonts": {
|
|
34
|
+
"family": "Inter",
|
|
35
|
+
"source": "https://fonts.gstatic.com/s/inter/v19/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hiJ-Ek-_EeA.woff2",
|
|
36
|
+
"format": "woff2",
|
|
37
|
+
"heading": {
|
|
38
|
+
"family": "Fraunces",
|
|
39
|
+
"source": "https://fonts.gstatic.com/s/fraunces/v31/...",
|
|
40
|
+
"format": "woff2",
|
|
41
|
+
"weight": "300 900"
|
|
42
|
+
},
|
|
43
|
+
"mono": {
|
|
44
|
+
"family": "JetBrains Mono",
|
|
45
|
+
"source": "https://fonts.gstatic.com/s/jetbrainsmono/v18/...",
|
|
46
|
+
"format": "woff2"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"theme": {
|
|
50
|
+
"mode": "dark",
|
|
51
|
+
"radius": "0.5rem"
|
|
52
|
+
},
|
|
53
|
+
"logo": {
|
|
54
|
+
"light": "./logo/logo.svg",
|
|
55
|
+
"dark": "./logo/logo-dark.svg"
|
|
56
|
+
},
|
|
57
|
+
"navigation": {
|
|
58
|
+
"tabs": [
|
|
59
|
+
{
|
|
60
|
+
"tab": "Documentation",
|
|
61
|
+
"groups": [
|
|
62
|
+
{
|
|
63
|
+
"group": "Getting Started",
|
|
64
|
+
"pages": ["introduction", "installation"]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"analytics": {
|
|
71
|
+
"posthog": {
|
|
72
|
+
"token": "phc_your_token",
|
|
73
|
+
"apiHost": "https://us.i.posthog.com"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"embed": {
|
|
77
|
+
"enabled": true,
|
|
78
|
+
"defaults": {
|
|
79
|
+
"position": "bottom-right",
|
|
80
|
+
"width": 400,
|
|
81
|
+
"height": 600,
|
|
82
|
+
"theme": "system"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Site Identity
|
|
89
|
+
|
|
90
|
+
| Field | Required | Description |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `name` | **Yes** | Site name shown in the header and browser tab. |
|
|
93
|
+
| `title` | No | Custom title override. Defaults to `name`. |
|
|
94
|
+
| `description` | No | Meta description for SEO and social sharing. |
|
|
95
|
+
| `url` | No | Origin the site is published at, e.g. `"https://example.com"`. Used for canonical links, the sitemap and `llms.txt`. |
|
|
96
|
+
| `basePath` | No | Path prefix the site is served under, e.g. `"/docs"` when it lives at `https://example.com/docs`. Asset URLs, navigation, generated JSON and the dev/preview servers all honour it. Defaults to the root. |
|
|
97
|
+
| `image` | No | Preview image shown when links are shared on social media. |
|
|
98
|
+
| `twitter` | No | Your Twitter/X handle (e.g. `"@yourhandle"`). |
|
|
99
|
+
| `favicon` | **Yes** | Path to favicon file. Supports SVG and PNG. |
|
|
100
|
+
| `version` | No | Text in the sidebar version card, e.g. `"1.0.8 · Latest"`. |
|
|
101
|
+
| `versions` | No | Other published versions as `[{ "label": "1.0.7", "url": "https://…" }]`. When set, the version card opens a picker that goes to the chosen URL. |
|
|
102
|
+
| `copyright` | No | Name in the footer copyright line. Defaults to `name`. |
|
|
103
|
+
|
|
104
|
+
## Repository
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
"repository": {
|
|
108
|
+
"url": "https://github.com/clidey/dory",
|
|
109
|
+
"branch": "main",
|
|
110
|
+
"path": "docs"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
When set, the "On this page" rail shows **Edit this page** and **Report an issue** links. URLs follow the GitHub format.
|
|
115
|
+
|
|
116
|
+
| Field | Required | Description |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| `url` | **Yes** | Repository URL. |
|
|
119
|
+
| `branch` | No | Branch the edit link opens. Defaults to `main`. |
|
|
120
|
+
| `path` | No | Folder holding the docs inside the repository. Defaults to the repository root. |
|
|
121
|
+
|
|
122
|
+
## Colors
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
"colors": {
|
|
126
|
+
"primary": "#6366f1",
|
|
127
|
+
"light": "#818cf8",
|
|
128
|
+
"dark": "#4f46e5"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
| Field | Description |
|
|
133
|
+
| --- | --- |
|
|
134
|
+
| `primary` | Main brand color. Used for links, active states, and accents. |
|
|
135
|
+
| `light` | Lighter variant used in light mode. |
|
|
136
|
+
| `dark` | Darker variant used in dark mode. |
|
|
137
|
+
|
|
138
|
+
See [Theming](/configuration/theming) for more detail.
|
|
139
|
+
|
|
140
|
+
## Fonts
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
"fonts": {
|
|
144
|
+
"family": "Inter",
|
|
145
|
+
"source": "https://fonts.gstatic.com/...",
|
|
146
|
+
"format": "woff2"
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
| Field | Description |
|
|
151
|
+
| --- | --- |
|
|
152
|
+
| `family` | The font name (e.g. `"Inter"`, `"Montserrat"`). |
|
|
153
|
+
| `source` | Direct URL to the font file. |
|
|
154
|
+
| `format` | Font format — use `"woff2"` for best compatibility. |
|
|
155
|
+
|
|
156
|
+
See [Fonts](/configuration/fonts) for more detail.
|
|
157
|
+
|
|
158
|
+
## Theme
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
"theme": {
|
|
162
|
+
"mode": "dark",
|
|
163
|
+
"radius": "0.5rem"
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| Field | Description |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `mode` | `"dark"`, `"light"`, or `"system"` (default). Forces the site into a specific color scheme. |
|
|
170
|
+
| `radius` | Base border-radius for UI elements. |
|
|
171
|
+
|
|
172
|
+
See [Theming](/configuration/theming) for full theming documentation.
|
|
173
|
+
|
|
174
|
+
## Logo
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
"logo": {
|
|
178
|
+
"light": "./logo/logo.svg",
|
|
179
|
+
"dark": "./logo/logo-dark.svg"
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| Field | Description |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| `light` | Path to logo for light mode. |
|
|
186
|
+
| `dark` | Path to logo for dark mode. Can be the same as `light` if your logo works on both backgrounds. |
|
|
187
|
+
|
|
188
|
+
## Navigation
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
"navigation": {
|
|
192
|
+
"tabs": [
|
|
193
|
+
{
|
|
194
|
+
"tab": "Documentation",
|
|
195
|
+
"groups": [
|
|
196
|
+
{
|
|
197
|
+
"group": "Getting Started",
|
|
198
|
+
"pages": ["introduction", "installation"]
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
See [Navigation](/configuration/navigation) for the full structure reference.
|
|
207
|
+
|
|
208
|
+
## Analytics
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
"analytics": {
|
|
212
|
+
"posthog": {
|
|
213
|
+
"token": "phc_your_token",
|
|
214
|
+
"apiHost": "https://us.i.posthog.com"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
See [Analytics](/configuration/analytics) for setup instructions.
|
|
220
|
+
|
|
221
|
+
## Embed
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
"embed": {
|
|
225
|
+
"enabled": true,
|
|
226
|
+
"defaults": {
|
|
227
|
+
"position": "bottom-right",
|
|
228
|
+
"width": 400,
|
|
229
|
+
"height": 600,
|
|
230
|
+
"theme": "system",
|
|
231
|
+
"showOverlay": true,
|
|
232
|
+
"closeOnEscape": true,
|
|
233
|
+
"closeOnOverlayClick": true
|
|
234
|
+
},
|
|
235
|
+
"branding": {
|
|
236
|
+
"showLogo": true,
|
|
237
|
+
"showName": true
|
|
238
|
+
},
|
|
239
|
+
"features": {
|
|
240
|
+
"search": true,
|
|
241
|
+
"toc": true,
|
|
242
|
+
"codeBlocks": true,
|
|
243
|
+
"mermaid": true,
|
|
244
|
+
"katex": true,
|
|
245
|
+
"apiPlayground": true,
|
|
246
|
+
"darkMode": true
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
See [Embed](/configuration/embed) for embedding configuration.
|
|
252
|
+
|
|
253
|
+
## Social preview images
|
|
254
|
+
|
|
255
|
+
Dory automatically generates a 1200 × 630 PNG for every documentation page during `dory build`. Each image includes your site name, local logo, brand colors, page title, and description. Open Graph and Twitter metadata point to the page's image. Set `url` so these links are absolute.
|
|
256
|
+
|
|
257
|
+
Override an individual page's image in its frontmatter:
|
|
258
|
+
|
|
259
|
+
```yaml
|
|
260
|
+
---
|
|
261
|
+
title: Installation
|
|
262
|
+
description: Install and configure the application.
|
|
263
|
+
image: /images/installation-preview.png
|
|
264
|
+
---
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
To use a shared site image instead of generating page images:
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"image": "/social-card.png",
|
|
272
|
+
"seo": {
|
|
273
|
+
"generateSocialImages": false
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Generated files live in the build output under `_dory/social/`; they do not need to be committed. Generation uses a bundled Hanken Grotesk font and requires no browser or network connection. Local TTF or OTF heading fonts can be configured through `fonts.heading.source`. Remote logos and font URLs are not fetched during image generation.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Embed
|
|
3
|
+
description: Open contextual Dory documentation inside another application.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Embed
|
|
7
|
+
|
|
8
|
+
Dory can open a hosted documentation site in a slide-out iframe. The host application chooses the starting documentation route and can navigate the iframe when its own context changes. Dory keeps its search and page navigation inside the iframe.
|
|
9
|
+
|
|
10
|
+
## Allow the host origin
|
|
11
|
+
|
|
12
|
+
For a host on another origin, add its exact origin to the documentation site's `dory.json` and rebuild:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"embed": {
|
|
17
|
+
"security": {
|
|
18
|
+
"allowedOrigins": ["https://app.example.com"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use an origin without a path or trailing slash. Dory's preview server allows framing from these origins. If you serve the static build with another web server, configure its `Content-Security-Policy` `frame-ancestors` directive for the same origins and do not send `X-Frame-Options: SAMEORIGIN` on embeddable pages. Keep the list limited to applications you control.
|
|
25
|
+
|
|
26
|
+
## Add the widget
|
|
27
|
+
|
|
28
|
+
Load the `embed.js` file from the hosted docs, then initialize `DoryDocs`. The script derives the docs URL from its own address, including a `/docs` base path when present.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<button id="docs-help" type="button">Help</button>
|
|
32
|
+
<script src="https://docs.example.com/embed.js"></script>
|
|
33
|
+
<script>
|
|
34
|
+
window.DoryDocs.init({
|
|
35
|
+
trigger: '#docs-help',
|
|
36
|
+
position: 'right',
|
|
37
|
+
width: 560,
|
|
38
|
+
theme: 'inherit',
|
|
39
|
+
initialPath: '/getting-started',
|
|
40
|
+
onNavigate(path) {
|
|
41
|
+
console.log('Reader opened', path);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The widget loads when the reader opens it. `theme: 'inherit'` uses the host's light or dark theme on first open. Call `setTheme` when the host theme changes.
|
|
48
|
+
|
|
49
|
+
## Open the page that matches the app
|
|
50
|
+
|
|
51
|
+
Map application routes or selected objects to documentation routes in the host. For example:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
window.DoryDocs.open('/apps/overview');
|
|
55
|
+
window.DoryDocs.navigate('/apps/building-a-transform');
|
|
56
|
+
window.DoryDocs.setTheme('dark');
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`open(path)` opens the widget at a route. `navigate(path)` changes its current page. `close()`, `toggle()`, `isOpen()`, and `destroy()` manage the widget. A route change inside the iframe calls `onNavigate(path)` in the host. Messaging checks both the iframe window and the docs origin; the docs only send messages to an origin listed in `embed.security.allowedOrigins` or their own origin.
|
|
60
|
+
|
|
61
|
+
| Option | Default | Purpose |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `position` | `right` | `left`, `right`, or `bottom` |
|
|
64
|
+
| `width` | `500` | Width in pixels or a CSS width for side panels |
|
|
65
|
+
| `height` | `100vh` | Height of a bottom panel |
|
|
66
|
+
| `theme` | `inherit` | `inherit`, `light`, or `dark` |
|
|
67
|
+
| `initialPath` | `/` | Route shown on first open |
|
|
68
|
+
| `trigger` | — | CSS selector or element to open the widget |
|
|
69
|
+
| `showOverlay` | `true` | Dim the host behind the widget |
|
|
70
|
+
| `closeOnEscape` | `true` | Close when Escape is pressed |
|
|
71
|
+
| `closeOnOverlayClick` | `true` | Close when the overlay is clicked |
|
|
72
|
+
|
|
73
|
+
The embed displays published documentation. It does not store or edit MDX, and it does not pass host credentials into the iframe. Keep private documentation behind your own authenticated hosting layer. To create docs from an application, generate MDX and `dory.json`, run `dory build`, and publish the resulting site.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Fonts'
|
|
3
|
+
description: 'Configure a custom web font for your documentation site using Google Fonts or any CDN.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fonts
|
|
7
|
+
|
|
8
|
+
Dory uses the self-hosted Hanken Grotesk, Bricolage Grotesque, and JetBrains Mono fonts from `@clidey/ux` by default. You can set custom fonts in `dory.json` using a stylesheet URL or your own font files.
|
|
9
|
+
|
|
10
|
+
## Configuration
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
"fonts": {
|
|
14
|
+
"family": "Inter",
|
|
15
|
+
"source": "https://fonts.gstatic.com/s/inter/v19/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hiJ-Ek-_EeA.woff2",
|
|
16
|
+
"format": "woff2"
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
| Field | Description |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `family` | The font name (e.g. `"Inter"`, `"Montserrat"`, `"Fira Code"`). |
|
|
23
|
+
| `source` | Direct URL to the font file. See below for how to get this from Google Fonts. |
|
|
24
|
+
| `format` | Font format. Use `"woff2"` for the best browser support. |
|
|
25
|
+
|
|
26
|
+
## Getting a Font URL from Google Fonts
|
|
27
|
+
|
|
28
|
+
<Steps>
|
|
29
|
+
<Step title="Visit Google Fonts">
|
|
30
|
+
Go to [fonts.google.com](https://fonts.google.com) and find the font you want.
|
|
31
|
+
</Step>
|
|
32
|
+
<Step title="Select a weight">
|
|
33
|
+
Click the font, then select the weight you want (e.g. Regular 400). Click **Get font** → **Get embed code**.
|
|
34
|
+
</Step>
|
|
35
|
+
<Step title="Copy the font URL">
|
|
36
|
+
In the embed panel, switch to the **CSS** tab. Find the line that starts with `src: url(` and copy the URL inside the parentheses.
|
|
37
|
+
|
|
38
|
+
For Inter, it looks like this:
|
|
39
|
+
```
|
|
40
|
+
https://fonts.gstatic.com/s/inter/v19/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hiJ-Ek-_EeA.woff2
|
|
41
|
+
```
|
|
42
|
+
</Step>
|
|
43
|
+
<Step title="Update dory.json">
|
|
44
|
+
Set `family` to the font name, `source` to the URL you copied, and `format` to `"woff2"`.
|
|
45
|
+
</Step>
|
|
46
|
+
</Steps>
|
|
47
|
+
|
|
48
|
+
## Popular Font Configurations
|
|
49
|
+
|
|
50
|
+
<AccordionGroup>
|
|
51
|
+
<Accordion title="Inter" icon="type">
|
|
52
|
+
```json
|
|
53
|
+
"fonts": {
|
|
54
|
+
"family": "Inter",
|
|
55
|
+
"source": "https://fonts.gstatic.com/s/inter/v19/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hiJ-Ek-_EeA.woff2",
|
|
56
|
+
"format": "woff2"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
</Accordion>
|
|
60
|
+
<Accordion title="Montserrat" icon="type">
|
|
61
|
+
```json
|
|
62
|
+
"fonts": {
|
|
63
|
+
"family": "Montserrat",
|
|
64
|
+
"source": "https://fonts.gstatic.com/s/montserrat/v29/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2",
|
|
65
|
+
"format": "woff2"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
</Accordion>
|
|
69
|
+
<Accordion title="Geist (Vercel)" icon="type">
|
|
70
|
+
```json
|
|
71
|
+
"fonts": {
|
|
72
|
+
"family": "Geist",
|
|
73
|
+
"source": "https://fonts.gstatic.com/s/geist/v1/gyByhwUxId8gMEwcGFWNOITD-w.woff2",
|
|
74
|
+
"format": "woff2"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
</Accordion>
|
|
78
|
+
</AccordionGroup>
|
|
79
|
+
|
|
80
|
+
## Default Font
|
|
81
|
+
|
|
82
|
+
If no `fonts` configuration is provided, Dory uses the Clidey Design fonts bundled with `@clidey/ux`. They load from the built site without a Google Fonts request.
|
|
83
|
+
|
|
84
|
+
<Tip>
|
|
85
|
+
For a polished look, set a custom font that matches your brand. Google Fonts has hundreds of free options and the setup takes under a minute.
|
|
86
|
+
</Tip>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Languages and versions
|
|
3
|
+
description: Publish translated and versioned documentation in one Dory site.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Languages and versions
|
|
7
|
+
|
|
8
|
+
Dory uses file paths for translated and versioned pages. Existing sites keep their current URLs. The default language and current version stay at the root.
|
|
9
|
+
|
|
10
|
+
## Add a language
|
|
11
|
+
|
|
12
|
+
Run `dory i18n:init fr` in your project. Dory adds the locale to `dory.json` and creates `.mdx.template` copies of your default pages under `docs/fr/`. Translate a template and rename it to `.mdx` when it is ready to publish. Re-running the command only creates missing templates; it leaves authored translations untouched.
|
|
13
|
+
|
|
14
|
+
Add `i18n` to `dory.json`:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"i18n": {
|
|
19
|
+
"defaultLocale": "en",
|
|
20
|
+
"locales": [
|
|
21
|
+
{ "code": "en", "label": "English" },
|
|
22
|
+
{ "code": "fr", "label": "Français" }
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Keep English pages where they are. Place the French version of `docs/introduction.mdx` at `docs/fr/introduction.mdx`. It publishes at `/fr/introduction`. Dory shows a language picker when more than one locale is configured. When the matching page exists, switching languages keeps the reader on that page. Otherwise, it opens the first page in the selected language.
|
|
29
|
+
|
|
30
|
+
Translate page titles and descriptions in each file's frontmatter. To translate tab and group labels, add a complete `navigation` object to that locale's entry. Use the same page keys as the default navigation, relative to the locale directory:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"code": "fr",
|
|
35
|
+
"label": "Français",
|
|
36
|
+
"navigation": {
|
|
37
|
+
"tabs": [{
|
|
38
|
+
"tab": "Guides",
|
|
39
|
+
"groups": [{ "group": "Démarrage", "pages": ["introduction"] }]
|
|
40
|
+
}]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Only publish translated pages you have written. Dory does not generate machine translations or silently show English text at a French URL. Built pages use the locale in their HTML `lang` attribute and include alternate language links for pages that exist in both languages.
|
|
46
|
+
|
|
47
|
+
## Add an older version
|
|
48
|
+
|
|
49
|
+
Add a version with an `id`. The current version stays at the root, and older content goes in a folder with the version ID:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"version": "2.0 · Latest",
|
|
54
|
+
"versions": [{ "id": "v1", "label": "1.0" }]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For example, `docs/v1/introduction.mdx` publishes at `/v1/introduction`. The version picker keeps the reader on the same page where it exists. You can set a version's `navigation` to describe that version's pages. Existing `versions` entries with external `url` values continue to work.
|
|
59
|
+
|
|
60
|
+
For translated older versions, place files under `docs/fr/v1/`. Their URLs start with `/fr/v1/`.
|
|
61
|
+
If an older translation has different pages, set `versions.v1` inside the French locale entry to a complete navigation object for that content.
|