@docubook/flame 1.2.0 → 1.3.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 CHANGED
@@ -282,6 +282,54 @@ Reference in MDX:
282
282
 
283
283
  ---
284
284
 
285
+ ## Plugins
286
+
287
+ 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.
288
+
289
+ ### Usage in `docu.json`
290
+
291
+ ```json
292
+ {
293
+ "plugins": [
294
+ "@docubook/plugin-sitemap",
295
+ ["./plugins/analytics", { "id": "G-XXXXXXX" }]
296
+ ]
297
+ }
298
+ ```
299
+
300
+ String = npm package or relative path. Tuple `["name", opts]` = factory with options.
301
+
302
+ ### Available Hooks
303
+
304
+ | Hook | Purpose |
305
+ | --------------------------------- | ------------------------------------------------- |
306
+ | `onStart` | Validate config before build |
307
+ | `onEnd` | Generate files after build (sitemap, RSS) |
308
+ | `onLoad` | Transform raw file content before MDX compilation |
309
+ | `transformFrontmatter` | Mutate frontmatter (reading time, SEO) |
310
+ | `transformHtml` | Modify final HTML before writing to disk |
311
+ | `injectHead` / `injectBody` | Inject HTML into `<head>` or before `</body>` |
312
+ | `remarkPlugins` / `rehypePlugins` | Add remark/rehype plugins to the MDX pipeline |
313
+ | `handleRequest` | Intercept dev server requests (custom API) |
314
+
315
+ ### Quick Example
316
+
317
+ ```typescript
318
+ import type { DocuBookPlugin } from "@docubook/flame";
319
+
320
+ export default {
321
+ name: "reading-time",
322
+ setup(build) {
323
+ build.transformFrontmatter((fm, ctx) => ({
324
+ ...fm,
325
+ readingTime: `${Math.ceil((ctx.content ?? "").split(/\s+/).length / 200)} min read`,
326
+ }));
327
+ },
328
+ } satisfies DocuBookPlugin;
329
+ ```
330
+
331
+ See the [full plugin guide](docs/getting-started/plugins.mdx) for step-by-step instructions.
332
+
285
333
  ## Architecture
286
334
 
287
335
  - **Bun** — runtime, bundler, file watcher
package/docu.schema.json CHANGED
@@ -118,6 +118,34 @@
118
118
  "description": "Documentation navigation routes. Leave empty for auto-detection from docs/ folder.",
119
119
  "items": { "$ref": "#/$defs/route" }
120
120
  },
121
+ "plugins": {
122
+ "type": "array",
123
+ "description": "List of DocuBook plugins to load",
124
+ "items": {
125
+ "oneOf": [
126
+ {
127
+ "type": "string",
128
+ "description": "Plugin package name or relative path (e.g. @docubook/plugin-sitemap)"
129
+ },
130
+ {
131
+ "type": "array",
132
+ "description": "Plugin package name with factory options",
133
+ "items": [
134
+ {
135
+ "type": "string",
136
+ "description": "Plugin package name"
137
+ },
138
+ {
139
+ "type": "object",
140
+ "description": "Plugin factory options"
141
+ }
142
+ ],
143
+ "minItems": 2,
144
+ "maxItems": 2
145
+ }
146
+ ]
147
+ }
148
+ },
121
149
  "themes": {
122
150
  "type": "object",
123
151
  "description": "Color themes configuration. Use preset name or custom hex values.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/flame",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,7 +34,7 @@
34
34
  "react",
35
35
  "react-dom"
36
36
  ],
37
- "homepage": "https://docubook.pro/",
37
+ "homepage": "https://github.com/DocuBook/docubook/tree/main/packages/flame",
38
38
  "repository": {
39
39
  "type": "git",
40
40
  "url": "git+https://github.com/DocuBook/docubook.git",
@@ -51,10 +51,10 @@
51
51
  "lucide-react": "^1.14.0",
52
52
  "react": "^19.0.0",
53
53
  "react-dom": "^19.0.0",
54
- "@docubook/core": "^1.7.0",
54
+ "@docubook/core": "^1.7.1",
55
55
  "@docubook/mdx-content": "^3.2.1",
56
- "@docubook/ui-react": "^0.1.3",
57
- "@docubook/themes-colors": "^0.10.0"
56
+ "@docubook/themes-colors": "^0.10.1",
57
+ "@docubook/ui-react": "^0.1.3"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@sentry/bun": "^9.0.0"