@clidey/dory 1.0.8 → 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,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Callouts'
|
|
3
|
+
description: 'Highlight important information with Note, Warning, Info, Tip, Check, and custom Callout components.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Callouts
|
|
7
|
+
|
|
8
|
+
Callouts draw attention to important information. Dory provides five pre-configured callout types plus a generic `Callout` component for custom types.
|
|
9
|
+
|
|
10
|
+
## Note
|
|
11
|
+
|
|
12
|
+
Use `<Note>` for supplementary information:
|
|
13
|
+
|
|
14
|
+
<Specimen label="<Note>">
|
|
15
|
+
|
|
16
|
+
```mdx
|
|
17
|
+
<Note>
|
|
18
|
+
This feature requires Node.js 18 or later. Check your version with `node --version`.
|
|
19
|
+
</Note>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<Note>
|
|
23
|
+
This feature requires Node.js 18 or later. Check your version with `node --version`.
|
|
24
|
+
</Note>
|
|
25
|
+
|
|
26
|
+
</Specimen>
|
|
27
|
+
|
|
28
|
+
## Warning
|
|
29
|
+
|
|
30
|
+
Use `<Warning>` for critical caveats or destructive actions:
|
|
31
|
+
|
|
32
|
+
<Specimen label="<Warning>">
|
|
33
|
+
|
|
34
|
+
```mdx
|
|
35
|
+
<Warning>
|
|
36
|
+
This action is **irreversible**. All data in the selected namespace will be permanently deleted.
|
|
37
|
+
</Warning>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
<Warning>
|
|
41
|
+
This action is **irreversible**. All data in the selected namespace will be permanently deleted.
|
|
42
|
+
</Warning>
|
|
43
|
+
|
|
44
|
+
</Specimen>
|
|
45
|
+
|
|
46
|
+
## Info
|
|
47
|
+
|
|
48
|
+
Use `<Info>` for contextual information:
|
|
49
|
+
|
|
50
|
+
<Specimen label="<Info>">
|
|
51
|
+
|
|
52
|
+
```mdx
|
|
53
|
+
<Info>
|
|
54
|
+
Rate limiting applies to all API endpoints. The default limit is 1000 requests per hour per API key.
|
|
55
|
+
</Info>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
<Info>
|
|
59
|
+
Rate limiting applies to all API endpoints. The default limit is 1000 requests per hour per API key.
|
|
60
|
+
</Info>
|
|
61
|
+
|
|
62
|
+
</Specimen>
|
|
63
|
+
|
|
64
|
+
## Tip
|
|
65
|
+
|
|
66
|
+
Use `<Tip>` for helpful hints and best practices:
|
|
67
|
+
|
|
68
|
+
<Specimen label="<Tip>">
|
|
69
|
+
|
|
70
|
+
```mdx
|
|
71
|
+
<Tip>
|
|
72
|
+
Enable response caching to reduce API calls. Cache keys are scoped to the authenticated user.
|
|
73
|
+
</Tip>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
<Tip>
|
|
77
|
+
Enable response caching to reduce API calls. Cache keys are scoped to the authenticated user.
|
|
78
|
+
</Tip>
|
|
79
|
+
|
|
80
|
+
</Specimen>
|
|
81
|
+
|
|
82
|
+
## Check
|
|
83
|
+
|
|
84
|
+
Use `<Check>` for success states, confirmations, or completed items:
|
|
85
|
+
|
|
86
|
+
<Specimen label="<Check>">
|
|
87
|
+
|
|
88
|
+
```mdx
|
|
89
|
+
<Check>
|
|
90
|
+
Your API key has been generated and is ready to use. Store it securely — it won't be shown again.
|
|
91
|
+
</Check>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
<Check>
|
|
95
|
+
Your API key has been generated and is ready to use. Store it securely — it won't be shown again.
|
|
96
|
+
</Check>
|
|
97
|
+
|
|
98
|
+
</Specimen>
|
|
99
|
+
|
|
100
|
+
## Custom Callout
|
|
101
|
+
|
|
102
|
+
Use `<Callout>` with a `type` and `title` for full control:
|
|
103
|
+
|
|
104
|
+
<Specimen label="<Callout>">
|
|
105
|
+
|
|
106
|
+
```mdx
|
|
107
|
+
<Callout type="warning" title="Breaking Change in v2.0">
|
|
108
|
+
The `authenticate()` method signature has changed. Update your integration before upgrading.
|
|
109
|
+
</Callout>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
<Callout type="warning" title="Breaking Change in v2.0">
|
|
113
|
+
The `authenticate()` method signature has changed. Update your integration before upgrading.
|
|
114
|
+
</Callout>
|
|
115
|
+
|
|
116
|
+
</Specimen>
|
|
117
|
+
|
|
118
|
+
### Callout Props
|
|
119
|
+
|
|
120
|
+
| Prop | Type | Default | Description |
|
|
121
|
+
| --- | --- | --- | --- |
|
|
122
|
+
| `type` | `'note' \| 'warning' \| 'info' \| 'tip' \| 'check'` | `'note'` | Determines the color scheme and icon. |
|
|
123
|
+
| `title` | `string` | — | Optional title displayed above the content. |
|
|
124
|
+
| `children` | `ReactNode` | — | Callout body content. Supports MDX. |
|
|
125
|
+
|
|
126
|
+
## Callout Types Reference
|
|
127
|
+
|
|
128
|
+
| Component | Color | Icon | Use Case |
|
|
129
|
+
| --- | --- | --- | --- |
|
|
130
|
+
| `<Note>` | Neutral | Info | Supplementary information |
|
|
131
|
+
| `<Warning>` | Yellow outline | Alert Triangle | Destructive or risky actions |
|
|
132
|
+
| `<Info>` | Blue | Info Circle | Contextual facts |
|
|
133
|
+
| `<Tip>` | Green | Star | Helpful hints, best practices |
|
|
134
|
+
| `<Check>` | Outlined, green badge | Check | Success states, confirmations |
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Cards'
|
|
3
|
+
description: 'Informational and linked cards in responsive grid layouts using Card and CardGroup.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cards
|
|
7
|
+
|
|
8
|
+
Cards are versatile components for showcasing features, navigation links, or grouped information.
|
|
9
|
+
|
|
10
|
+
## Basic Card
|
|
11
|
+
|
|
12
|
+
<Specimen label="<Card>">
|
|
13
|
+
|
|
14
|
+
```mdx
|
|
15
|
+
<Card title="Getting Started" icon="rocket" description="Set up your first Dory project in minutes." />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
<Card title="Getting Started" icon="rocket" description="Set up your first Dory project in minutes." />
|
|
19
|
+
|
|
20
|
+
</Specimen>
|
|
21
|
+
|
|
22
|
+
## Linked Card
|
|
23
|
+
|
|
24
|
+
Add an `href` prop to make the entire card clickable:
|
|
25
|
+
|
|
26
|
+
<Specimen label="<Card>">
|
|
27
|
+
|
|
28
|
+
```mdx
|
|
29
|
+
<Card
|
|
30
|
+
title="Installation"
|
|
31
|
+
icon="package"
|
|
32
|
+
href="/getting-started/installation"
|
|
33
|
+
description="Install Dory globally or as a project dependency."
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<Card
|
|
38
|
+
title="Installation"
|
|
39
|
+
icon="package"
|
|
40
|
+
href="/getting-started/installation"
|
|
41
|
+
description="Install Dory globally or as a project dependency."
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
</Specimen>
|
|
45
|
+
|
|
46
|
+
## Card with Children
|
|
47
|
+
|
|
48
|
+
Add content inside the card for richer layouts:
|
|
49
|
+
|
|
50
|
+
<Specimen label="<Card>">
|
|
51
|
+
|
|
52
|
+
```mdx
|
|
53
|
+
<Card title="API Rate Limits" icon="gauge">
|
|
54
|
+
The default rate limit is **1000 requests per hour** per API key.
|
|
55
|
+
|
|
56
|
+
- Burst limit: 100 requests per second
|
|
57
|
+
- Retry after: `Retry-After` header in 429 responses
|
|
58
|
+
</Card>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
<Card title="API Rate Limits" icon="gauge">
|
|
62
|
+
The default rate limit is **1000 requests per hour** per API key.
|
|
63
|
+
|
|
64
|
+
- Burst limit: 100 requests per second
|
|
65
|
+
- Retry after: `Retry-After` header in 429 responses
|
|
66
|
+
</Card>
|
|
67
|
+
|
|
68
|
+
</Specimen>
|
|
69
|
+
|
|
70
|
+
## CardGroup — Grid Layout
|
|
71
|
+
|
|
72
|
+
Use `<CardGroup>` to arrange cards in a responsive grid:
|
|
73
|
+
|
|
74
|
+
<Specimen label="<CardGroup> <Card>">
|
|
75
|
+
|
|
76
|
+
```mdx
|
|
77
|
+
<CardGroup cols={2}>
|
|
78
|
+
<Card title="TypeScript" icon="code-2" description="Full type definitions included." />
|
|
79
|
+
<Card title="Open Source" icon="github" description="MIT licensed. Contributions welcome." />
|
|
80
|
+
<Card title="Zero Config" icon="zap" description="Works out of the box with sensible defaults." />
|
|
81
|
+
<Card title="Extensible" icon="plug" description="Customize themes, fonts, and components." />
|
|
82
|
+
</CardGroup>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
<CardGroup cols={2}>
|
|
86
|
+
<Card title="TypeScript" icon="code-2" description="Full type definitions included." />
|
|
87
|
+
<Card title="Open Source" icon="github" description="Contributions welcome." />
|
|
88
|
+
<Card title="Zero Config" icon="zap" description="Works out of the box with sensible defaults." />
|
|
89
|
+
<Card title="Extensible" icon="plug" description="Customize themes, fonts, and components." />
|
|
90
|
+
</CardGroup>
|
|
91
|
+
|
|
92
|
+
</Specimen>
|
|
93
|
+
|
|
94
|
+
### Three-Column Grid
|
|
95
|
+
|
|
96
|
+
<Specimen label="<CardGroup> <Card>">
|
|
97
|
+
|
|
98
|
+
```mdx
|
|
99
|
+
<CardGroup cols={3}>
|
|
100
|
+
<Card title="Build" icon="hammer" description="Compile MDX into a static site." />
|
|
101
|
+
<Card title="Preview" icon="eye" description="Serve the built site locally." />
|
|
102
|
+
<Card title="Deploy" icon="rocket" description="Upload dist/ to any static host." />
|
|
103
|
+
</CardGroup>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
<CardGroup cols={3}>
|
|
107
|
+
<Card title="Build" icon="hammer" description="Compile MDX into a static site." />
|
|
108
|
+
<Card title="Preview" icon="eye" description="Serve the built site locally." />
|
|
109
|
+
<Card title="Deploy" icon="rocket" description="Upload dist/ to any static host." />
|
|
110
|
+
</CardGroup>
|
|
111
|
+
|
|
112
|
+
</Specimen>
|
|
113
|
+
|
|
114
|
+
## Numbered Cards
|
|
115
|
+
|
|
116
|
+
Add `numbered` to a `CardGroup` to label each card 01, 02, 03 in reading order.
|
|
117
|
+
|
|
118
|
+
<Specimen label="<CardGroup numbered>">
|
|
119
|
+
|
|
120
|
+
```mdx
|
|
121
|
+
<CardGroup cols={2} numbered>
|
|
122
|
+
<Card title="Install" description="One Docker command. Runs on your machine." />
|
|
123
|
+
<Card title="Connect a database" description="Pick an engine, test, connect." />
|
|
124
|
+
<Card title="Explore the graph" description="Tables as nodes, keys as edges." />
|
|
125
|
+
</CardGroup>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
<CardGroup cols={2} numbered>
|
|
129
|
+
<Card title="Install" description="One Docker command. Runs on your machine." />
|
|
130
|
+
<Card title="Connect a database" description="Pick an engine, test, connect." />
|
|
131
|
+
<Card title="Explore the graph" description="Tables as nodes, keys as edges." />
|
|
132
|
+
</CardGroup>
|
|
133
|
+
|
|
134
|
+
</Specimen>
|
|
135
|
+
|
|
136
|
+
## Props Reference
|
|
137
|
+
|
|
138
|
+
### Card Props
|
|
139
|
+
|
|
140
|
+
| Prop | Type | Description |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| `title` | `string` | Card heading. |
|
|
143
|
+
| `description` | `string` | Optional subtitle text. |
|
|
144
|
+
| `icon` | `string` | Clidey Design icon name (e.g. `"promote"`, `"code"`). |
|
|
145
|
+
| `href` | `string` | Makes the card a link. Navigates on click. |
|
|
146
|
+
| `children` | `ReactNode` | Rich content rendered inside the card body. |
|
|
147
|
+
|
|
148
|
+
### CardGroup Props
|
|
149
|
+
|
|
150
|
+
| Prop | Type | Default | Description |
|
|
151
|
+
| --- | --- | --- | --- |
|
|
152
|
+
| `cols` | `1 \| 2 \| 3 \| 4` | `2` | Number of columns in the grid. Responsive — collapses to 1 on mobile. |
|
|
153
|
+
| `numbered` | `boolean` | `false` | Label cards 01, 02, 03 in order. |
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Code Blocks'
|
|
3
|
+
description: 'Syntax-highlighted code blocks with multi-language tab groups, copy button, and HTTP method badges.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Blocks
|
|
7
|
+
|
|
8
|
+
Dory provides rich code block components with syntax highlighting, tab groups, and interactive copy functionality.
|
|
9
|
+
|
|
10
|
+
## Basic Code Block
|
|
11
|
+
|
|
12
|
+
Use triple backticks with an optional language identifier:
|
|
13
|
+
|
|
14
|
+
<Specimen label="```lang">
|
|
15
|
+
|
|
16
|
+
````mdx
|
|
17
|
+
```python
|
|
18
|
+
def greet(name: str) -> str:
|
|
19
|
+
return f"Hello, {name}!"
|
|
20
|
+
|
|
21
|
+
print(greet("World"))
|
|
22
|
+
```
|
|
23
|
+
````
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
def greet(name: str) -> str:
|
|
27
|
+
return f"Hello, {name}!"
|
|
28
|
+
|
|
29
|
+
print(greet("World"))
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
</Specimen>
|
|
33
|
+
|
|
34
|
+
## Filenames and Highlighted Lines
|
|
35
|
+
|
|
36
|
+
Text after the language becomes the block's filename. Add line numbers or ranges in braces to highlight them. A filename or highlight also turns on line numbers.
|
|
37
|
+
|
|
38
|
+
<Specimen label="```lang title {lines}">
|
|
39
|
+
|
|
40
|
+
````mdx
|
|
41
|
+
```json dory.json {4-6}
|
|
42
|
+
{
|
|
43
|
+
"name": "Dory",
|
|
44
|
+
"logo": "./logo/logo.svg",
|
|
45
|
+
"colors": {
|
|
46
|
+
"primary": "#2C6BD4"
|
|
47
|
+
},
|
|
48
|
+
"fonts": {
|
|
49
|
+
"family": "Hanken Grotesk"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
````
|
|
54
|
+
|
|
55
|
+
```json dory.json {4-6}
|
|
56
|
+
{
|
|
57
|
+
"name": "Dory",
|
|
58
|
+
"logo": "./logo/logo.svg",
|
|
59
|
+
"colors": {
|
|
60
|
+
"primary": "#2C6BD4"
|
|
61
|
+
},
|
|
62
|
+
"fonts": {
|
|
63
|
+
"family": "Hanken Grotesk"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<SpecimenProps>
|
|
69
|
+
|
|
70
|
+
<Prop name="Filename" type="dory.json">Any text after the language. Shown in the header with the language.</Prop>
|
|
71
|
+
<Prop name='title="..."' type='title="Fetch users"'>Same as a bare filename; use it when the title contains braces or quotes.</Prop>
|
|
72
|
+
<Prop name="{lines}" type="{1,4-6}">Comma-separated line numbers and ranges to highlight.</Prop>
|
|
73
|
+
|
|
74
|
+
</SpecimenProps>
|
|
75
|
+
|
|
76
|
+
</Specimen>
|
|
77
|
+
|
|
78
|
+
## Diffs
|
|
79
|
+
|
|
80
|
+
Use `diff` for a plain diff, or `diff-<lang>` to keep syntax highlighting. Lines starting with `+` or `-` are marked, and the header counts them.
|
|
81
|
+
|
|
82
|
+
<Specimen label="```diff-json">
|
|
83
|
+
|
|
84
|
+
````mdx
|
|
85
|
+
```diff-json dory.json
|
|
86
|
+
"fonts": {
|
|
87
|
+
- "family": "Inter",
|
|
88
|
+
+ "family": "Hanken Grotesk",
|
|
89
|
+
"mono": { "family": "JetBrains Mono" }
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
````
|
|
93
|
+
|
|
94
|
+
```diff-json dory.json
|
|
95
|
+
"fonts": {
|
|
96
|
+
- "family": "Inter",
|
|
97
|
+
+ "family": "Hanken Grotesk",
|
|
98
|
+
"mono": { "family": "JetBrains Mono" }
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
</Specimen>
|
|
103
|
+
|
|
104
|
+
## Terminal Sessions
|
|
105
|
+
|
|
106
|
+
A `bash`, `sh`, `shell`, `zsh` or `console` block with `$ ` prompts renders as a terminal. The command name is highlighted and other lines are output.
|
|
107
|
+
|
|
108
|
+
<Specimen label="```sh">
|
|
109
|
+
|
|
110
|
+
````mdx
|
|
111
|
+
```sh
|
|
112
|
+
$ dory dev
|
|
113
|
+
✓ Compiled 48 pages in 1.2s
|
|
114
|
+
$ dory build
|
|
115
|
+
✓ Wrote 48 pages to ./dist
|
|
116
|
+
```
|
|
117
|
+
````
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
$ dory dev
|
|
121
|
+
✓ Compiled 48 pages in 1.2s
|
|
122
|
+
$ dory build
|
|
123
|
+
✓ Wrote 48 pages to ./dist
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
</Specimen>
|
|
127
|
+
|
|
128
|
+
## Supported Languages
|
|
129
|
+
|
|
130
|
+
Dory supports syntax highlighting for 20+ languages:
|
|
131
|
+
|
|
132
|
+
<Row>
|
|
133
|
+
<Col>
|
|
134
|
+
- `python`
|
|
135
|
+
- `javascript` / `js`
|
|
136
|
+
- `typescript` / `ts`
|
|
137
|
+
- `jsx` / `tsx`
|
|
138
|
+
- `java`
|
|
139
|
+
- `c`, `cpp`, `c#`
|
|
140
|
+
- `rust`
|
|
141
|
+
- `go`
|
|
142
|
+
</Col>
|
|
143
|
+
<Col>
|
|
144
|
+
- `ruby`
|
|
145
|
+
- `php`
|
|
146
|
+
- `swift`
|
|
147
|
+
- `kotlin`
|
|
148
|
+
- `bash`
|
|
149
|
+
- `json`
|
|
150
|
+
- `yaml` / `toml`
|
|
151
|
+
- `html` / `css`
|
|
152
|
+
- `sql`
|
|
153
|
+
- `graphql`
|
|
154
|
+
</Col>
|
|
155
|
+
</Row>
|
|
156
|
+
|
|
157
|
+
## CodeGroup — Multi-Language Tabs
|
|
158
|
+
|
|
159
|
+
Use `<CodeGroup>` to show the same code in multiple languages. Each child code block becomes a tab, labelled by its title or language.
|
|
160
|
+
|
|
161
|
+
<Specimen label="<CodeGroup>">
|
|
162
|
+
|
|
163
|
+
````mdx
|
|
164
|
+
<CodeGroup>
|
|
165
|
+
```python
|
|
166
|
+
import requests
|
|
167
|
+
|
|
168
|
+
response = requests.get("https://api.example.com/users")
|
|
169
|
+
print(response.json())
|
|
170
|
+
```
|
|
171
|
+
```javascript
|
|
172
|
+
const response = await fetch("https://api.example.com/users");
|
|
173
|
+
const data = await response.json();
|
|
174
|
+
console.log(data);
|
|
175
|
+
```
|
|
176
|
+
```go
|
|
177
|
+
resp, err := http.Get("https://api.example.com/users")
|
|
178
|
+
if err != nil {
|
|
179
|
+
log.Fatal(err)
|
|
180
|
+
}
|
|
181
|
+
defer resp.Body.Close()
|
|
182
|
+
```
|
|
183
|
+
</CodeGroup>
|
|
184
|
+
````
|
|
185
|
+
|
|
186
|
+
<CodeGroup>
|
|
187
|
+
```python
|
|
188
|
+
import requests
|
|
189
|
+
|
|
190
|
+
response = requests.get("https://api.example.com/users")
|
|
191
|
+
print(response.json())
|
|
192
|
+
```
|
|
193
|
+
```javascript
|
|
194
|
+
const response = await fetch("https://api.example.com/users");
|
|
195
|
+
const data = await response.json();
|
|
196
|
+
console.log(data);
|
|
197
|
+
```
|
|
198
|
+
```go
|
|
199
|
+
resp, err := http.Get("https://api.example.com/users")
|
|
200
|
+
if err != nil {
|
|
201
|
+
log.Fatal(err)
|
|
202
|
+
}
|
|
203
|
+
defer resp.Body.Close()
|
|
204
|
+
```
|
|
205
|
+
</CodeGroup>
|
|
206
|
+
|
|
207
|
+
</Specimen>
|
|
208
|
+
|
|
209
|
+
### CodeGroup with Title
|
|
210
|
+
|
|
211
|
+
Add a `title` prop to label the group:
|
|
212
|
+
|
|
213
|
+
<Specimen label="<CodeGroup title>">
|
|
214
|
+
|
|
215
|
+
````mdx
|
|
216
|
+
<CodeGroup title="Fetch Users">
|
|
217
|
+
```python
|
|
218
|
+
import requests
|
|
219
|
+
response = requests.get("https://api.example.com/users")
|
|
220
|
+
```
|
|
221
|
+
```typescript
|
|
222
|
+
const res = await fetch("https://api.example.com/users");
|
|
223
|
+
```
|
|
224
|
+
</CodeGroup>
|
|
225
|
+
````
|
|
226
|
+
|
|
227
|
+
<CodeGroup title="Fetch Users">
|
|
228
|
+
```python
|
|
229
|
+
import requests
|
|
230
|
+
response = requests.get("https://api.example.com/users")
|
|
231
|
+
```
|
|
232
|
+
```typescript
|
|
233
|
+
const res = await fetch("https://api.example.com/users");
|
|
234
|
+
```
|
|
235
|
+
</CodeGroup>
|
|
236
|
+
|
|
237
|
+
</Specimen>
|
|
238
|
+
|
|
239
|
+
## HTTP Method Badges
|
|
240
|
+
|
|
241
|
+
Add `tag` and `label` to a code block inside a `CodeGroup` to show HTTP method badges:
|
|
242
|
+
|
|
243
|
+
<Specimen label="```lang tag label">
|
|
244
|
+
|
|
245
|
+
````mdx
|
|
246
|
+
<CodeGroup>
|
|
247
|
+
```bash tag="GET" label="/api/users"
|
|
248
|
+
curl https://api.example.com/users
|
|
249
|
+
```
|
|
250
|
+
```bash tag="POST" label="/api/users"
|
|
251
|
+
curl -X POST https://api.example.com/users \
|
|
252
|
+
-H "Content-Type: application/json" \
|
|
253
|
+
-d '{"name": "Alice"}'
|
|
254
|
+
```
|
|
255
|
+
</CodeGroup>
|
|
256
|
+
````
|
|
257
|
+
|
|
258
|
+
<CodeGroup>
|
|
259
|
+
```bash tag="GET" label="/api/users"
|
|
260
|
+
curl https://api.example.com/users
|
|
261
|
+
```
|
|
262
|
+
```bash tag="POST" label="/api/users"
|
|
263
|
+
curl -X POST https://api.example.com/users \
|
|
264
|
+
-H "Content-Type: application/json" \
|
|
265
|
+
-d '{"name": "Alice"}'
|
|
266
|
+
```
|
|
267
|
+
</CodeGroup>
|
|
268
|
+
|
|
269
|
+
</Specimen>
|
|
270
|
+
|
|
271
|
+
## Inline Code
|
|
272
|
+
|
|
273
|
+
Use single backticks for inline `code` within prose text.
|
|
274
|
+
|
|
275
|
+
```mdx
|
|
276
|
+
Call the `greet()` function with a `name` parameter.
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Copy Button
|
|
280
|
+
|
|
281
|
+
All code blocks include a **copy button** in the header. It copies the raw code to the clipboard and shows a checkmark for 1 second.
|