@docubook/flame 1.4.4 → 1.5.1
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/.docu/lib/build.deno.js +11 -0
- package/.docu/lib/build.impl-7KJ4ZTAJ.js +12 -0
- package/.docu/lib/build.node.js +10 -0
- package/.docu/lib/chunk-7ZEUL6PR.js +383 -0
- package/.docu/lib/chunk-AI7QAMMZ.js +2410 -0
- package/.docu/lib/chunk-E4OIJWCU.js +368 -0
- package/.docu/lib/chunk-IR5TVJOV.js +79 -0
- package/.docu/lib/chunk-J5NMYSBJ.js +59 -0
- package/.docu/lib/chunk-PTRZ2S2C.js +298 -0
- package/.docu/lib/chunk-RE4NGTMT.js +185 -0
- package/.docu/lib/chunk-TE52TIEW.js +92 -0
- package/.docu/lib/clean.js +32 -0
- package/.docu/lib/deploy.deno.js +13 -0
- package/.docu/lib/deploy.node.js +10 -0
- package/.docu/lib/preview.deno.js +10 -0
- package/.docu/lib/preview.node.js +10 -0
- package/.docu/lib/server.deno.js +11 -0
- package/.docu/lib/server.node.js +11 -0
- package/.docu/node/build.deno.ts +7 -0
- package/.docu/node/build.impl.ts +416 -0
- package/.docu/node/build.node.ts +3 -0
- package/.docu/node/deploy.deno.ts +11 -0
- package/.docu/node/deploy.node.ts +6 -0
- package/.docu/node/deploy.shared.ts +85 -0
- package/.docu/node/deploy.ts +11 -0
- package/.docu/node/escapeHtml.ts +18 -0
- package/.docu/node/git.ts +79 -0
- package/.docu/node/html.shared.ts +110 -0
- package/.docu/node/hydrate.node.ts +276 -0
- package/.docu/node/hydrate.ts +17 -31
- package/.docu/node/mdx.ts +1 -1
- package/.docu/node/paths.ts +24 -0
- package/.docu/node/plugin-builder.ts +6 -2
- package/.docu/node/plugin.ts +11 -2
- package/.docu/node/preview.deno.ts +4 -0
- package/.docu/node/preview.impl.ts +96 -0
- package/.docu/node/preview.node.ts +4 -0
- package/.docu/node/security.ts +5 -0
- package/.docu/node/server-routes.ts +4 -4
- package/.docu/node/server.deno.ts +4 -0
- package/.docu/node/server.impl.ts +184 -0
- package/.docu/node/server.node.ts +4 -0
- package/.docu/styles/globals.css +20 -5
- package/README.md +57 -506
- package/bin/cli.js +99 -14
- package/bin/compile-lib.mjs +67 -0
- package/package.json +9 -7
- package/template/docs/getting-started/configuration.mdx +18 -0
- package/template/docs/getting-started/overview.mdx +50 -0
- package/template/docs/guide/deployment.mdx +27 -0
- package/template/docs/guide/routing.mdx +25 -0
- package/template/docs/index.mdx +8 -205
- package/template/docu.json +32 -1
package/README.md
CHANGED
|
@@ -6,14 +6,17 @@
|
|
|
6
6
|
</h3>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
|
|
10
|
-
No heavy abstractions. No complex tooling. Just a minimal layer between your content and the browser.
|
|
9
|
+
<strong>@docubook/flame</strong> is a lightweight runtime for building documentation websites using React, MDX, and filesystem-based routing — running on Bun, Node.js, and Deno.
|
|
11
10
|
</p>
|
|
12
11
|
|
|
13
12
|
---
|
|
14
13
|
|
|
14
|
+
> **Lightweight** — 📦 ~132 kB packed. No bloat, just fire.
|
|
15
|
+
|
|
16
|
+
---
|
|
15
17
|
## Quick Start
|
|
16
18
|
|
|
19
|
+
**Bun**
|
|
17
20
|
```bash
|
|
18
21
|
mkdir my-docs && cd my-docs
|
|
19
22
|
bun add @docubook/flame
|
|
@@ -21,518 +24,66 @@ bunx flame init
|
|
|
21
24
|
bun run dev
|
|
22
25
|
```
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Features
|
|
27
|
-
|
|
28
|
-
- **Bun-native** — instant startup, native TypeScript, fast builds
|
|
29
|
-
- **React-first** — JSX/TSX, hooks, component composition
|
|
30
|
-
- **MDX content** — write Markdown with embedded React components
|
|
31
|
-
- **Filesystem routing** — auto-detect routes from `docs/` folder
|
|
32
|
-
- **Lightweight SSR** — React server-side rendering without a heavy framework
|
|
33
|
-
- **Client hydration** — interactive islands for sidebar, TOC, and MDX components
|
|
34
|
-
- **HMR** — instant reload on docs changes during development
|
|
35
|
-
- **Static build** — pre-render all pages to static HTML for deployment
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Project Structure
|
|
40
|
-
|
|
41
|
-
After `flame init`, your project looks like:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
my-docs/
|
|
45
|
-
├── docs/ # Your MDX content
|
|
46
|
-
│ └── index.mdx # Home page
|
|
47
|
-
├── docu.json # Site configuration (navbar, routes, meta)
|
|
48
|
-
├── package.json # Dependencies
|
|
49
|
-
└── .docu/
|
|
50
|
-
└── dist/ # Build output (after `bun run build`)
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Commands
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
bun run dev # Start dev server with HMR
|
|
59
|
-
bun run build # Static build to .docu/dist/
|
|
60
|
-
bun run preview # Serve built output locally
|
|
61
|
-
bun run deploy # Build + prepare for GitHub Pages
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Configuration
|
|
67
|
-
|
|
68
|
-
`docu.json` controls your site. Full example:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"$schema": "https://cdn.jsdelivr.net/npm/@docubook/flame/docu.schema.json",
|
|
73
|
-
"meta": {
|
|
74
|
-
"title": "My Docs",
|
|
75
|
-
"description": "Documentation powered by DocuBook Flame",
|
|
76
|
-
"baseURL": "https://example.com",
|
|
77
|
-
"favicon": "/docs/assets/images/favicon.ico"
|
|
78
|
-
},
|
|
79
|
-
"home": {
|
|
80
|
-
"hero": {
|
|
81
|
-
"tagline": "#MyDocs",
|
|
82
|
-
"headline": "Documentation",
|
|
83
|
-
"description": "Welcome to your documentation site.",
|
|
84
|
-
"actions": [
|
|
85
|
-
{ "text": "Get Started", "link": "/docs", "theme": "primary" },
|
|
86
|
-
{ "text": "GitHub", "link": "https://github.com", "theme": "ghost", "icon": "github" }
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
"features": [
|
|
90
|
-
{ "icon": "Zap", "title": "Fast", "description": "Instant builds.", "link": "/docs" }
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
"navbar": {
|
|
94
|
-
"logo": { "src": "/docs/assets/logo.svg", "alt": "Logo" },
|
|
95
|
-
"logoText": "My Docs",
|
|
96
|
-
"menu": [
|
|
97
|
-
{ "title": "Home", "href": "/" },
|
|
98
|
-
{ "title": "Docs", "href": "/docs" }
|
|
99
|
-
]
|
|
100
|
-
},
|
|
101
|
-
"footer": {
|
|
102
|
-
"social": [
|
|
103
|
-
{ "name": "github", "url": "https://github.com/you" }
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
"repo": {
|
|
107
|
-
"url": "https://github.com/you/repo",
|
|
108
|
-
"edit": true
|
|
109
|
-
},
|
|
110
|
-
"routes": []
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Repo & Edit Links
|
|
115
|
-
|
|
116
|
-
The `repo` section enables **"Edit this page"** links on every doc page, pointing directly to the source file in your repository.
|
|
117
|
-
|
|
118
|
-
```json
|
|
119
|
-
{
|
|
120
|
-
"repo": {
|
|
121
|
-
"url": "https://github.com/you/repo",
|
|
122
|
-
"edit": true
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
| Property | Type | Required | Description |
|
|
128
|
-
|----------|------|----------|-------------|
|
|
129
|
-
| `url` | `string` (URI) | ✅ Yes | Base URL of your repository |
|
|
130
|
-
| `edit` | `boolean` | ✅ Yes | Show or hide the edit link on pages |
|
|
131
|
-
| `path` | `string` | No | Path template override — see below |
|
|
132
|
-
|
|
133
|
-
#### Platform Auto-Detection
|
|
134
|
-
|
|
135
|
-
When `path` is omitted, Flame detects the correct path format from `url` automatically:
|
|
136
|
-
|
|
137
|
-
| Platform | Domain | Auto-generated path |
|
|
138
|
-
|----------|--------|---------------------|
|
|
139
|
-
| GitHub | `github.com` | `blob/main/{filePath}` |
|
|
140
|
-
| GitLab | `gitlab.com` | `-/blob/main/{filePath}` |
|
|
141
|
-
| Bitbucket | `bitbucket.org` | `src/main/{filePath}` |
|
|
142
|
-
| Gitea Cloud | `gitea.com` | `src/branch/main/{filePath}` |
|
|
143
|
-
| Codeberg (Forgejo) | `codeberg.org` | `src/branch/main/{filePath}` |
|
|
144
|
-
| Gogs / self-hosted Gitea / Forgejo | any other host | `src/branch/main/{filePath}` |
|
|
145
|
-
|
|
146
|
-
For most single-repo projects this is all you need — just set `url` and `edit: true`.
|
|
147
|
-
|
|
148
|
-
#### When to set `path` manually
|
|
149
|
-
|
|
150
|
-
Override `path` when auto-detection is not enough. The value must contain `{filePath}` as a placeholder:
|
|
151
|
-
|
|
152
|
-
**Monorepo** — docs live in a subdirectory, not the repo root:
|
|
153
|
-
|
|
154
|
-
```json
|
|
155
|
-
{
|
|
156
|
-
"repo": {
|
|
157
|
-
"url": "https://github.com/org/monorepo",
|
|
158
|
-
"path": "blob/main/apps/docs/{filePath}",
|
|
159
|
-
"edit": true
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**Non-default branch** — your default branch is not `main`:
|
|
165
|
-
|
|
166
|
-
```json
|
|
167
|
-
{
|
|
168
|
-
"repo": {
|
|
169
|
-
"url": "https://github.com/you/repo",
|
|
170
|
-
"path": "blob/master/{filePath}",
|
|
171
|
-
"edit": true
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Self-hosted GitLab on a custom domain** — auto-detect falls back to Gitea format, which is wrong for GitLab:
|
|
177
|
-
|
|
178
|
-
```json
|
|
179
|
-
{
|
|
180
|
-
"repo": {
|
|
181
|
-
"url": "https://git.mycompany.com/team/repo",
|
|
182
|
-
"path": "-/blob/main/{filePath}",
|
|
183
|
-
"edit": true
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
> **Rule of thumb:** if your docs are at the root of the repo and the branch is `main`, skip `path` — auto-detect handles it. Add `path` only when you need to point to a subdirectory, a different branch, or a self-hosted platform with a non-standard URL format.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
### Homepage
|
|
193
|
-
|
|
194
|
-
The `home` section configures your landing page with a hero section and feature cards:
|
|
195
|
-
|
|
196
|
-
| Property | Description |
|
|
197
|
-
| ------------------ | ------------------------------------------------------------------- |
|
|
198
|
-
| `hero.tagline` | Small text above the headline (e.g., product name) |
|
|
199
|
-
| `hero.headline` | **Required.** Main heading text |
|
|
200
|
-
| `hero.description` | Description below the headline |
|
|
201
|
-
| `hero.actions` | Array of CTA buttons with `text`, `link`, `theme`, `icon` |
|
|
202
|
-
| `features` | Array of feature cards with `icon`, `title`, `description`, `link` |
|
|
203
|
-
|
|
204
|
-
### Theme Colors
|
|
205
|
-
|
|
206
|
-
Flame uses `@docubook/themes-colors` for its config-driven color system. Configure via `docu.json`:
|
|
207
|
-
|
|
208
|
-
```json
|
|
209
|
-
{
|
|
210
|
-
"themes": {
|
|
211
|
-
"colors": "default"
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
#### Preset Themes
|
|
217
|
-
|
|
218
|
-
Use a preset name as a string. Three built-in presets are available:
|
|
219
|
-
|
|
220
|
-
| Name | Description | Hue |
|
|
221
|
-
| ------------- | ----------------- | ------ |
|
|
222
|
-
| `"default"` | Modern Blue theme | ~210 |
|
|
223
|
-
| `"freshlime"` | Fresh Lime theme | ~85 |
|
|
224
|
-
| `"coffee"` | Rich Coffee theme | ~25–35 |
|
|
225
|
-
|
|
226
|
-
```json
|
|
227
|
-
{
|
|
228
|
-
"themes": {
|
|
229
|
-
"colors": "freshlime"
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
#### Custom Hex Colors
|
|
235
|
-
|
|
236
|
-
Define a custom primary color as a hex value. The full 24-variable palette is auto-generated from it:
|
|
237
|
-
|
|
238
|
-
```json
|
|
239
|
-
{
|
|
240
|
-
"themes": {
|
|
241
|
-
"colors": {
|
|
242
|
-
"primary": "#FF5733"
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
| Property | Type | Required | Description |
|
|
249
|
-
| --------- | -------------- | -------- | ----------------------------------------------------------------- |
|
|
250
|
-
| `primary` | `string` (hex) | ✅ Yes | Primary brand color. A full light + dark scale is auto-generated. |
|
|
251
|
-
|
|
252
|
-
##### What gets auto-generated from `primary`
|
|
253
|
-
|
|
254
|
-
A single hex color generates **24 CSS variables × 2 modes** (light `:root` + dark `.dark`) plus **12 syntax highlighting tokens × 2 modes** — all derived from the primary color.
|
|
255
|
-
|
|
256
|
-
| Token | Description |
|
|
257
|
-
| -------------------------------------------- | -------------------------- |
|
|
258
|
-
| `--background` / `--foreground` | Page background & text |
|
|
259
|
-
| `--card` / `--card-foreground` | Card surface & text |
|
|
260
|
-
| `--popover` / `--popover-foreground` | Popover surface & text |
|
|
261
|
-
| `--primary` / `--primary-foreground` | Primary brand color & text |
|
|
262
|
-
| `--secondary` / `--secondary-foreground` | Secondary color & text |
|
|
263
|
-
| `--muted` / `--muted-foreground` | Muted surface & text |
|
|
264
|
-
| `--accent` / `--accent-foreground` | Accent color & text |
|
|
265
|
-
| `--destructive` / `--destructive-foreground` | Destructive action & text |
|
|
266
|
-
| `--border` | Border color |
|
|
267
|
-
| `--input` | Input field border |
|
|
268
|
-
| `--ring` | Focus ring color |
|
|
269
|
-
| `--radius` | Border radius value |
|
|
270
|
-
| `--base-100` / `--base-200` / `--base-300` | DaisyUI surface layers |
|
|
271
|
-
| `--base-content` | DaisyUI content color |
|
|
272
|
-
|
|
273
|
-
#### CLI Override
|
|
274
|
-
|
|
275
|
-
Override any theme without editing `docu.json`:
|
|
276
|
-
|
|
27
|
+
**Node.js**
|
|
277
28
|
```bash
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
flame
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
#### Priority
|
|
284
|
-
|
|
285
|
-
Theme resolution follows this order (first match wins):
|
|
286
|
-
1. `--theme` CLI flag (e.g., `flame dev --theme coffee`)
|
|
287
|
-
2. `docu.json` → `themes.colors`
|
|
288
|
-
3. Falls back to `default` preset
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
### Sidebar
|
|
293
|
-
|
|
294
|
-
Controls how documentation sections appear in the sidebar. Defaults to **dropdown** mode when not configured.
|
|
295
|
-
|
|
296
|
-
To switch to **separator** mode, add `sidebar` to the top level of your `docu.json`:
|
|
297
|
-
|
|
298
|
-
```json
|
|
299
|
-
{
|
|
300
|
-
"sidebar": {
|
|
301
|
-
"context": "separator"
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
| Mode | Description |
|
|
307
|
-
|------|-------------|
|
|
308
|
-
| `"dropdown"` (default) | Compact view — a dropdown at the top of the sidebar lets users switch between sections. Only the active section's items are shown. |
|
|
309
|
-
| `"separator"` | All sections visible — group header (icon + title) with tree connector line. Items nest under their section. |
|
|
310
|
-
|
|
311
|
-
```
|
|
312
|
-
Default (dropdown) Separator
|
|
313
|
-
┌──────────────────┐ 📖 Guides
|
|
314
|
-
│ 📖 Guides ▼ │ │
|
|
315
|
-
├──────────────────┤ ├─ Introduction
|
|
316
|
-
│ Introduction │ ├─ Installation
|
|
317
|
-
│ Installation │ │
|
|
318
|
-
└──────────────────┘ 🧩 Markdown
|
|
319
|
-
│
|
|
320
|
-
├─ Accordion
|
|
321
|
-
├─ Button
|
|
322
|
-
└─ Card
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
> Omit `sidebar` entirely → dropdown mode. Set `"context": "separator"` → separator mode. Mode is static per page, no runtime switching.
|
|
326
|
-
|
|
327
|
-
---
|
|
328
|
-
|
|
329
|
-
### Routes
|
|
330
|
-
|
|
331
|
-
When `routes` is an empty array `[]`, Flame automatically scans your `docs/` folder at build-time and generates the sidebar navigation from the directory structure. Folders become collapsible sections, and `.mdx`/`.md` files become links — sorted alphabetically.
|
|
332
|
-
|
|
333
|
-
To define navigation manually, populate the `routes` array:
|
|
334
|
-
|
|
335
|
-
```json
|
|
336
|
-
{
|
|
337
|
-
"routes": [
|
|
338
|
-
{
|
|
339
|
-
"title": "Getting Started",
|
|
340
|
-
"href": "/getting-started",
|
|
341
|
-
"noLink": true,
|
|
342
|
-
"context": {
|
|
343
|
-
"icon": "BookOpen",
|
|
344
|
-
"title": "Guides",
|
|
345
|
-
"description": "Set up your Documentation"
|
|
346
|
-
},
|
|
347
|
-
"items": [
|
|
348
|
-
{ "title": "Introduction", "href": "/introduction" },
|
|
349
|
-
{ "title": "Installation", "href": "/installation" }
|
|
350
|
-
]
|
|
351
|
-
}
|
|
352
|
-
]
|
|
353
|
-
}
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
> Manual routes take priority — if `routes` has entries, folder scanning is skipped entirely.
|
|
357
|
-
|
|
358
|
-
> Context on a route (`icon`, `title`, `description`) provides metadata for the sidebar context switcher. In **dropdown** mode it fills the dropdown; in **separator** mode it renders the group header + tree. The icon name must match a [Lucide icon](https://lucide.dev/icons) export (e.g., `"BookOpen"`, `"Layers"`).
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## Routing
|
|
363
|
-
|
|
364
|
-
```
|
|
365
|
-
docs/
|
|
366
|
-
├── index.mdx → /docs
|
|
367
|
-
├── getting-started/
|
|
368
|
-
│ ├── introduction.mdx → /docs/getting-started/introduction
|
|
369
|
-
│ └── installation.mdx → /docs/getting-started/installation
|
|
370
|
-
└── components/
|
|
371
|
-
├── button.mdx → /docs/components/button
|
|
372
|
-
└── card.mdx → /docs/components/card
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## Assets
|
|
378
|
-
|
|
379
|
-
Place images and static files in `docs/assets/`. They are copied to the build output and accessible at `/docs/assets/`.
|
|
380
|
-
|
|
381
|
-
```
|
|
382
|
-
docs/
|
|
383
|
-
├── assets/
|
|
384
|
-
│ └── images/
|
|
385
|
-
│ ├── logo.svg
|
|
386
|
-
│ └── screenshot.png
|
|
387
|
-
└── getting-started/
|
|
388
|
-
└── introduction.mdx
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
Reference in MDX:
|
|
392
|
-
|
|
393
|
-
```mdx
|
|
394
|
-

|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
> The `docs/assets/` directory is excluded from route scanning — files inside it won't appear in the sidebar.
|
|
398
|
-
|
|
399
|
-
---
|
|
400
|
-
|
|
401
|
-
## Plugins
|
|
402
|
-
|
|
403
|
-
Flame supports a plugin system to extend the build pipeline and dev server. Plugins can inject head/body HTML, transform content, add remark/rehype plugins, intercept API requests, and more.
|
|
404
|
-
|
|
405
|
-
### Usage in `docu.json`
|
|
406
|
-
|
|
407
|
-
```json
|
|
408
|
-
{
|
|
409
|
-
"plugins": [
|
|
410
|
-
"@docubook/plugin-sitemap",
|
|
411
|
-
["./plugins/analytics", { "id": "G-XXXXXXX" }]
|
|
412
|
-
]
|
|
413
|
-
}
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
String = npm package or relative path. Tuple `["name", opts]` = factory with options.
|
|
417
|
-
|
|
418
|
-
### Available Hooks
|
|
419
|
-
|
|
420
|
-
| Hook | Purpose |
|
|
421
|
-
| --------------------------------- | ------------------------------------------------- |
|
|
422
|
-
| `onStart` | Validate config before build |
|
|
423
|
-
| `onEnd` | Generate files after build (sitemap, RSS) |
|
|
424
|
-
| `onLoad` | Transform raw file content before MDX compilation |
|
|
425
|
-
| `transformFrontmatter` | Mutate frontmatter (reading time, SEO) |
|
|
426
|
-
| `transformHtml` | Modify final HTML before writing to disk |
|
|
427
|
-
| `injectHead` / `injectBody` | Inject HTML into `<head>` or before `</body>` |
|
|
428
|
-
| `remarkPlugins` / `rehypePlugins` | Add remark/rehype plugins to the MDX pipeline |
|
|
429
|
-
| `handleRequest` | Intercept dev server requests (custom API) |
|
|
430
|
-
|
|
431
|
-
### Quick Example
|
|
432
|
-
|
|
433
|
-
```typescript
|
|
434
|
-
import type { DocuBookPlugin } from "@docubook/flame";
|
|
435
|
-
|
|
436
|
-
export default {
|
|
437
|
-
name: "reading-time",
|
|
438
|
-
setup(build) {
|
|
439
|
-
build.transformFrontmatter((fm, ctx) => ({
|
|
440
|
-
...fm,
|
|
441
|
-
readingTime: `${Math.ceil((ctx.content ?? "").split(/\s+/).length / 200)} min read`,
|
|
442
|
-
}));
|
|
443
|
-
},
|
|
444
|
-
} satisfies DocuBookPlugin;
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
See the [full plugin guide](docs/getting-started/plugins.mdx) for step-by-step instructions.
|
|
448
|
-
|
|
449
|
-
## Architecture
|
|
450
|
-
|
|
451
|
-
- **Bun** — runtime, bundler, file watcher
|
|
452
|
-
- **React + React DOM** — rendering (SSR + client hydration)
|
|
453
|
-
- **@docubook/core** — MDX compilation, rehype/remark plugins
|
|
454
|
-
- **@docubook/mdx-content** — pre-built MDX components
|
|
455
|
-
- **Tailwind CSS + daisyUI** — styling
|
|
456
|
-
|
|
457
|
-
---
|
|
458
|
-
|
|
459
|
-
## Comparison
|
|
460
|
-
|
|
461
|
-
| Framework | Runtime | UI | Approach |
|
|
462
|
-
| ------------------- | ------- | --------- | --------------------------- |
|
|
463
|
-
| Docusaurus | Node.js | React | Full-featured, plugin-heavy |
|
|
464
|
-
| VitePress | Node.js | Vue | Lightweight, Vue-only |
|
|
465
|
-
| Nextra | Node.js | React | Next.js-based |
|
|
466
|
-
| **@docubook/flame** | **Bun** | **React** | **Minimal, Bun-native SSR** |
|
|
467
|
-
|
|
468
|
-
---
|
|
469
|
-
|
|
470
|
-
## Deployment
|
|
471
|
-
|
|
472
|
-
### GitHub Pages
|
|
473
|
-
|
|
474
|
-
```bash
|
|
475
|
-
bun run deploy
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
This will:
|
|
479
|
-
1. Run production build → output to `.docu/dist/`
|
|
480
|
-
2. Add `.nojekyll` file
|
|
481
|
-
3. Generate `.github/workflows/deploy.yml` (first run only)
|
|
482
|
-
|
|
483
|
-
Then push to GitHub and enable Pages:
|
|
484
|
-
**Settings → Pages → Source: GitHub Actions**
|
|
485
|
-
|
|
486
|
-
### Manual / Other Hosts
|
|
487
|
-
|
|
488
|
-
```bash
|
|
489
|
-
bun run build
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
Upload the contents of `.docu/dist/` to any static hosting (Netlify, Cloudflare Pages, Vercel, S3, etc).
|
|
493
|
-
|
|
494
|
-
---
|
|
495
|
-
|
|
496
|
-
## Environment Variables
|
|
497
|
-
|
|
498
|
-
Copy `.env.example` to `.env` to customize:
|
|
499
|
-
|
|
500
|
-
```env
|
|
501
|
-
# Server port (default: 3000)
|
|
502
|
-
PORT=3000
|
|
503
|
-
|
|
504
|
-
# Theme preset (optional — overrides docu.json themes.colors)
|
|
505
|
-
# FLAME_THEME=default
|
|
506
|
-
# FLAME_THEME=freshlime
|
|
507
|
-
# FLAME_THEME=coffee
|
|
508
|
-
|
|
509
|
-
# Error Monitoring (optional)
|
|
510
|
-
SENTRY_DSN=https://your-dsn@sentry.io/project-id
|
|
29
|
+
mkdir my-docs && cd my-docs
|
|
30
|
+
npm install @docubook/flame
|
|
31
|
+
npx flame init
|
|
32
|
+
npm run dev
|
|
511
33
|
```
|
|
512
34
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
## Error Monitoring (Optional)
|
|
516
|
-
|
|
517
|
-
Flame has built-in [Sentry](https://sentry.io) support for error tracking. To enable:
|
|
518
|
-
|
|
35
|
+
**Deno**
|
|
519
36
|
```bash
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
Then set environment variables:
|
|
524
|
-
|
|
525
|
-
```env
|
|
526
|
-
SENTRY_DSN=https://your-dsn@sentry.io/project-id
|
|
37
|
+
mkdir my-docs && cd my-docs
|
|
38
|
+
deno run -A npm:@docubook/flame init
|
|
39
|
+
deno task dev
|
|
527
40
|
```
|
|
528
41
|
|
|
529
|
-
Errors during dev server and build will be automatically captured. No configuration needed beyond the DSN.
|
|
530
|
-
|
|
531
42
|
---
|
|
532
43
|
|
|
533
|
-
##
|
|
534
|
-
|
|
535
|
-
|
|
44
|
+
## Documentation
|
|
45
|
+
|
|
46
|
+
For the full documentation, please visit **[packages/flame/docs](https://github.com/DocuBook/docubook/tree/main/packages/flame/docs)** or read the individual pages below:
|
|
47
|
+
|
|
48
|
+
### Getting Started
|
|
49
|
+
|
|
50
|
+
| Page | Description |
|
|
51
|
+
| --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
52
|
+
| [Welcome](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/index.mdx) | Overview and welcome to `@docubook/flame`. |
|
|
53
|
+
| [Introduction](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/introduction.mdx) | Overview of the framework. |
|
|
54
|
+
| [Installation](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/installation.mdx) | Install and scaffold your first site. |
|
|
55
|
+
| [Quick Start Guide](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/quick-start-guide.mdx) | Get up and running in minutes. |
|
|
56
|
+
| [Format text](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/format-text.mdx) | Markdown and inline styling in MDX. |
|
|
57
|
+
| [Frontmatter](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/frontmatter.mdx) | Page metadata via frontmatter. |
|
|
58
|
+
| [Themes](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/themes.mdx) | Color system, presets, and custom hex. |
|
|
59
|
+
| [Plugins](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/plugins.mdx) | Extend the build and dev pipeline. |
|
|
60
|
+
| [Deployment](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/deployment.mdx) | Deploy to static hosting with clean URLs. |
|
|
61
|
+
| [Search — Built-in](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/search/built-in.mdx) | Build-time full-text search. |
|
|
62
|
+
| [Search — Algolia](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/getting-started/search/algolia.mdx) | Algolia DocSearch integration. |
|
|
63
|
+
|
|
64
|
+
### Components
|
|
65
|
+
|
|
66
|
+
| Page | Description |
|
|
67
|
+
| ------------------------------------------------------------------------------------------------- | ---------------------------------------- |
|
|
68
|
+
| [Accordion](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/accordion.mdx) | Collapsible content sections. |
|
|
69
|
+
| [Accordion Group](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/accordion-group.mdx) | Group multiple accordions. |
|
|
70
|
+
| [Button](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/button.mdx) | Action and navigation buttons. |
|
|
71
|
+
| [Card](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/card.mdx) | Compact content cards. |
|
|
72
|
+
| [Card Group](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/card-group.mdx) | Display multiple cards together. |
|
|
73
|
+
| [Code Block](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/code-block.mdx) | Code snippets with line highlighting. |
|
|
74
|
+
| [Custom Components](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/custom.mdx) | Register your own MDX components. |
|
|
75
|
+
| [File Tree](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/file-tree.mdx) | Hierarchical file structures. |
|
|
76
|
+
| [Image](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/image.mdx) | Display images in Markdown. |
|
|
77
|
+
| [Keyboard](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/keyboard.mdx) | Keyboard keys with platform styling. |
|
|
78
|
+
| [Link](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/link.mdx) | Navigation links. |
|
|
79
|
+
| [Mermaid](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/mermaid.mdx) | Mermaid.js diagrams in MDX. |
|
|
80
|
+
| [Note](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/note.mdx) | Notes, warnings, and success messages. |
|
|
81
|
+
| [Release Note](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/release-note.mdx) | Per-version update notes. |
|
|
82
|
+
| [Stepper](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/stepper.mdx) | Step-by-step instructions. |
|
|
83
|
+
| [Tables](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/tables.mdx) | GitHub-flavored tables. |
|
|
84
|
+
| [Tabs](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/tabs.mdx) | Switchable content sections. |
|
|
85
|
+
| [Tooltips](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/tooltips.mdx) | Hover info tooltips. |
|
|
86
|
+
| [Youtube](https://github.com/DocuBook/docubook/blob/main/packages/flame/docs/components/youtube.mdx) | Embed YouTube videos. |
|
|
536
87
|
|
|
537
88
|
---
|
|
538
89
|
|