docula 0.41.0 → 0.50.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.
Files changed (50) hide show
  1. package/README.md +110 -0
  2. package/dist/docula.d.ts +156 -0
  3. package/dist/docula.js +1628 -0
  4. package/package.json +28 -24
  5. package/{template → templates/classic}/css/base.css +10 -0
  6. package/{template → templates/classic}/css/multipage.css +7 -0
  7. package/{template → templates/classic}/docs.hbs +1 -1
  8. package/{template/index.hbs → templates/classic/home.hbs} +7 -1
  9. package/templates/classic/includes/multipage/api-reference.hbs +1 -0
  10. package/templates/classic/includes/multipage/documentation.hbs +1 -0
  11. package/{template → templates/classic}/includes/multipage/hero.hbs +1 -2
  12. package/{template → templates/classic}/includes/multipage/home.hbs +3 -3
  13. package/{template → templates/classic}/includes/singlepage/content.hbs +3 -3
  14. package/templates/modern/api.hbs +30 -0
  15. package/templates/modern/changelog-entry.hbs +36 -0
  16. package/templates/modern/changelog.hbs +38 -0
  17. package/templates/modern/css/highlight/highlight.min.js +1433 -0
  18. package/templates/modern/css/highlight/styles/base16/docula.css +123 -0
  19. package/templates/modern/css/home.css +96 -0
  20. package/templates/modern/css/styles.css +697 -0
  21. package/templates/modern/docs.hbs +30 -0
  22. package/templates/modern/home.hbs +51 -0
  23. package/templates/modern/includes/api-reference.hbs +1 -0
  24. package/templates/modern/includes/doc.hbs +18 -0
  25. package/templates/modern/includes/documentation.hbs +1 -0
  26. package/templates/modern/includes/footer.hbs +6 -0
  27. package/templates/modern/includes/header-bar.hbs +57 -0
  28. package/templates/modern/includes/header.hbs +15 -0
  29. package/templates/modern/includes/hero.hbs +11 -0
  30. package/templates/modern/includes/home.hbs +46 -0
  31. package/templates/modern/includes/scripts.hbs +161 -0
  32. package/templates/modern/includes/sidebar.hbs +22 -0
  33. package/templates/modern/includes/theme-toggle.hbs +5 -0
  34. package/template/releases.hbs +0 -86
  35. /package/bin/{docula.mjs → docula.js} +0 -0
  36. /package/{template → templates/classic}/api.hbs +0 -0
  37. /package/{template → templates/classic}/changelog-entry.hbs +0 -0
  38. /package/{template → templates/classic}/changelog.hbs +0 -0
  39. /package/{template → templates/classic}/css/highlight/highlight.min.js +0 -0
  40. /package/{template → templates/classic}/css/highlight/styles/base16/dracula.min.css +0 -0
  41. /package/{template → templates/classic}/css/landing.css +0 -0
  42. /package/{template → templates/classic}/css/singlepage.css +0 -0
  43. /package/{template → templates/classic}/includes/footer.hbs +0 -0
  44. /package/{template → templates/classic}/includes/header.hbs +0 -0
  45. /package/{template → templates/classic}/includes/multipage/doc.hbs +0 -0
  46. /package/{template → templates/classic}/includes/multipage/header.hbs +0 -0
  47. /package/{template → templates/classic}/includes/multipage/scripts.hbs +0 -0
  48. /package/{template → templates/classic}/includes/multipage/sidebar.hbs +0 -0
  49. /package/{template → templates/classic}/includes/scripts.hbs +0 -0
  50. /package/{template → templates/classic}/includes/singlepage/hero.hbs +0 -0
package/README.md CHANGED
@@ -16,6 +16,8 @@
16
16
  - [Using Your own Template](#using-your-own-template)
17
17
  - [Building Multiple Pages](#building-multiple-pages)
18
18
  - [Public Folder](#public-folder)
19
+ - [API Reference](#api-reference)
20
+ - [LLM Files](#llm-files)
19
21
  - [Announcements](#announcements)
20
22
  - [Changelog](#changelog)
21
23
  - [Alert, Info, Warn Styling](#alert-info-warn-styling)
@@ -32,6 +34,7 @@
32
34
  * Full TypeScript support with typed configuration and IDE autocompletion.
33
35
  * Support for single page with readme or multiple markdown pages in a docs folder.
34
36
  * Will generate a sitemap.xml and robots.txt for your site.
37
+ * Automatically generates `llms.txt` and `llms-full.txt` for LLM-friendly indexing of docs, API reference, and changelog content.
35
38
  * Uses Github release notes to generate a changelog / releases page.
36
39
  * Uses Github to show contributors and link to their profiles.
37
40
  * Simple search is provided by default out of the box.
@@ -138,7 +141,11 @@ When both config files exist, Docula loads them in this order (first found wins)
138
141
  | `siteUrl` | `string` | - | Website URL |
139
142
  | `port` | `number` | `3000` | Port for local development server |
140
143
  | `singlePage` | `boolean` | `true` | Single page or multi-page site |
144
+ | `homePage` | `boolean` | `true` | When `false`, Docula uses the first docs page as `/index.html` instead of rendering `home.hbs` |
141
145
  | `sections` | `DoculaSection[]` | - | Documentation sections |
146
+ | `openApiUrl` | `string` | - | OpenAPI spec URL for API documentation (auto-detected if `api/swagger.json` exists) |
147
+ | `enableReleaseChangelog` | `boolean` | `true` | Convert GitHub releases to changelog entries |
148
+ | `enableLlmsTxt` | `boolean` | `true` | Generate `llms.txt` and `llms-full.txt` in the build output |
142
149
 
143
150
  # Using Your own Template
144
151
 
@@ -172,6 +179,14 @@ title: Getting Started
172
179
  order: 2
173
180
  ```
174
181
 
182
+ If you want your docs to be the root home page (`/`) instead of rendering the template home page, set `homePage: false`:
183
+
184
+ ```js
185
+ export const options = {
186
+ homePage: false,
187
+ };
188
+ ```
189
+
175
190
  # Public Folder
176
191
 
177
192
  If you have static assets like images, fonts, or other files that need to be copied directly to your built site, you can use a `public` folder. Any files placed in the `public` folder within your site directory will be automatically copied to the root of your `dist` output folder during the build process.
@@ -228,6 +243,101 @@ This is useful for:
228
243
  - Custom fonts
229
244
  - Any other static assets that need to be served from your site
230
245
 
246
+ # API Reference
247
+
248
+ Docula can generate an API Reference page from an OpenAPI (Swagger) specification. The page is rendered using [Docutopia](https://www.npmjs.com/package/@docutopia/react) and is available at `/api`.
249
+
250
+ ## Auto-Detection
251
+
252
+ If your site directory contains an `api/swagger.json` file, Docula will automatically detect it and generate the API Reference page — no configuration needed:
253
+
254
+ ```
255
+ site
256
+ ├───api
257
+ │ └───swagger.json
258
+ ├───docs
259
+ ├───logo.svg
260
+ ├───favicon.ico
261
+ └───docula.config.mjs
262
+ ```
263
+
264
+ ## Explicit Configuration
265
+
266
+ You can also set the `openApiUrl` option in your config to point to any OpenAPI spec, either a local path or a remote URL:
267
+
268
+ ```js
269
+ export const options = {
270
+ openApiUrl: '/api/swagger.json',
271
+ // or a remote URL:
272
+ // openApiUrl: 'https://petstore.swagger.io/v2/swagger.json',
273
+ };
274
+ ```
275
+
276
+ When `openApiUrl` is set explicitly, it takes priority over auto-detection.
277
+
278
+ ## Spec Requirements
279
+
280
+ The file must be a valid OpenAPI 3.x or Swagger 2.0 JSON specification. A minimal example:
281
+
282
+ ```json
283
+ {
284
+ "openapi": "3.0.0",
285
+ "info": {
286
+ "title": "My API",
287
+ "version": "1.0.0"
288
+ },
289
+ "paths": {}
290
+ }
291
+ ```
292
+
293
+ # LLM Files
294
+
295
+ Docula generates two LLM-focused files in the output directory by default:
296
+
297
+ - `/llms.txt` - a compact index of your docs, API reference, and changelog URLs.
298
+ - `/llms-full.txt` - expanded content including markdown bodies for docs/changelog and local OpenAPI spec text.
299
+
300
+ ## What Gets Included
301
+
302
+ `/llms.txt` includes:
303
+ - Site title and description
304
+ - A link to `/llms-full.txt`
305
+ - Documentation links (absolute URLs)
306
+ - API Reference link when API docs are generated
307
+ - Changelog landing page and the latest 20 changelog entries
308
+
309
+ `/llms-full.txt` includes:
310
+ - Site title and description
311
+ - Full markdown body for each docs page
312
+ - Full markdown body for each changelog entry
313
+ - Full local OpenAPI spec text when available (for example `site/api/swagger.json`)
314
+
315
+ If `openApiUrl` points to a remote URL, `/llms-full.txt` includes only the URL reference instead of fetching content over the network.
316
+
317
+ ## Configuration
318
+
319
+ To disable generation:
320
+
321
+ ```js
322
+ export const options = {
323
+ enableLlmsTxt: false,
324
+ };
325
+ ```
326
+
327
+ ## Custom Overrides
328
+
329
+ You can override generated output by providing custom files in your site directory:
330
+
331
+ - `site/llms.txt`
332
+ - `site/llms-full.txt`
333
+
334
+ If present, Docula copies these files to output as-is.
335
+
336
+ ## Notes
337
+
338
+ - These files are generated in the output root (`dist/llms.txt` and `dist/llms-full.txt`).
339
+ - They are not added to `sitemap.xml`.
340
+
231
341
  # Announcements
232
342
 
233
343
  You can display an announcement banner on your home page by creating an `announcement.md` file in your site directory. This is useful for highlighting important updates, new releases, or any time-sensitive information.
@@ -0,0 +1,156 @@
1
+ import http from 'node:http';
2
+ export { Writr } from 'writr';
3
+
4
+ type DoculaSection = {
5
+ name: string;
6
+ order?: number;
7
+ path: string;
8
+ children?: DoculaSection[];
9
+ };
10
+
11
+ declare class DoculaOptions {
12
+ /**
13
+ * Name of the built-in template to use (e.g., "modern", "classic")
14
+ */
15
+ template: string;
16
+ /**
17
+ * Path to the template directory. When set, overrides the `template` option.
18
+ */
19
+ templatePath: string;
20
+ /**
21
+ * Path to the output directory
22
+ */
23
+ outputPath: string;
24
+ /**
25
+ * Path to the site directory
26
+ */
27
+ sitePath: string;
28
+ /**
29
+ * Path to the github repository
30
+ */
31
+ githubPath: string;
32
+ /**
33
+ * Site title
34
+ */
35
+ siteTitle: string;
36
+ /**
37
+ * Site description
38
+ */
39
+ siteDescription: string;
40
+ /**
41
+ * Site URL
42
+ */
43
+ siteUrl: string;
44
+ /**
45
+ * Port to run the server
46
+ */
47
+ port: number;
48
+ /**
49
+ * Single page website
50
+ */
51
+ singlePage: boolean;
52
+ /**
53
+ * Sections
54
+ */
55
+ sections?: DoculaSection[];
56
+ /**
57
+ * OpenAPI specification URL for API documentation.
58
+ * When provided, creates a dedicated /api page
59
+ * Supports both external URLs (https://...) and relative paths (/openapi.json)
60
+ */
61
+ openApiUrl?: string;
62
+ /**
63
+ * When true, GitHub releases are converted to changelog entries and merged
64
+ * with file-based changelog entries. Requires a changelog template to exist.
65
+ */
66
+ enableReleaseChangelog: boolean;
67
+ /**
68
+ * When false, the first document becomes the home page (index.html)
69
+ * and the home.hbs template is not rendered.
70
+ */
71
+ homePage: boolean;
72
+ /**
73
+ * When true, generates llms.txt and llms-full.txt files for the built site.
74
+ */
75
+ enableLlmsTxt: boolean;
76
+ constructor(options?: Record<string, unknown>);
77
+ parseOptions(options: Record<string, any>): void;
78
+ }
79
+
80
+ declare class Docula {
81
+ private _options;
82
+ private readonly _console;
83
+ private _configFileModule;
84
+ private _server;
85
+ /**
86
+ * Initialize the Docula class
87
+ * @param {DoculaOptions} options
88
+ * @returns {void}
89
+ * @constructor
90
+ */
91
+ constructor(options?: DoculaOptions);
92
+ /**
93
+ * Get the options
94
+ * @returns {DoculaOptions}
95
+ */
96
+ get options(): DoculaOptions;
97
+ /**
98
+ * Set the options
99
+ * @param {DoculaOptions} value
100
+ */
101
+ set options(value: DoculaOptions);
102
+ /**
103
+ * The http server used to serve the site
104
+ * @returns {http.Server | undefined}
105
+ */
106
+ get server(): http.Server | undefined;
107
+ /**
108
+ * The config file module. This is the module that is loaded from the docula.config.ts or docula.config.mjs file
109
+ * @returns {any}
110
+ */
111
+ get configFileModule(): any;
112
+ /**
113
+ * Check for updates
114
+ * @returns {void}
115
+ */
116
+ checkForUpdates(): void;
117
+ /**
118
+ * Is the execution process that runs the docula command
119
+ * @param {NodeJS.Process} process
120
+ * @returns {Promise<void>}
121
+ */
122
+ execute(process: NodeJS.Process): Promise<void>;
123
+ /**
124
+ * Checks if the site is a single page website
125
+ * @param {string} sitePath
126
+ * @returns {boolean}
127
+ */
128
+ isSinglePageWebsite(sitePath: string): boolean;
129
+ /**
130
+ * Generate the init files
131
+ * @param {string} sitePath
132
+ * @param {boolean} typescript - If true, generates docula.config.ts instead of docula.config.mjs
133
+ * @returns {void}
134
+ */
135
+ generateInit(sitePath: string, typescript?: boolean): void;
136
+ /**
137
+ * Get the version of the package
138
+ * @returns {string}
139
+ */
140
+ getVersion(): string;
141
+ /**
142
+ * Load the config file. Supports both .mjs and .ts config files.
143
+ * Priority: docula.config.ts > docula.config.mjs
144
+ * @param {string} sitePath
145
+ * @returns {Promise<void>}
146
+ */
147
+ loadConfigFile(sitePath: string): Promise<void>;
148
+ /**
149
+ * Serve the site based on the options (port and output path)
150
+ * @param {DoculaOptions} options
151
+ * @returns {Promise<void>}
152
+ */
153
+ serve(options: DoculaOptions): Promise<http.Server>;
154
+ }
155
+
156
+ export { Docula as default };