docula 0.50.0 → 1.0.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 +119 -5
- package/dist/docula.d.ts +254 -15
- package/dist/docula.js +1255 -227
- package/package.json +10 -12
- package/templates/classic/api.hbs +203 -17
- package/templates/classic/changelog-entry.hbs +2 -0
- package/templates/classic/changelog.hbs +2 -0
- package/templates/classic/css/api.css +753 -0
- package/templates/classic/css/base.css +29 -0
- package/templates/classic/docs.hbs +2 -0
- package/templates/classic/home.hbs +2 -0
- package/templates/classic/includes/api-try-it.hbs +61 -0
- package/templates/classic/js/api.js +282 -0
- package/templates/modern/api.hbs +203 -18
- package/templates/modern/css/api.css +1051 -0
- package/templates/modern/css/home.css +37 -0
- package/templates/modern/css/styles.css +65 -6
- package/templates/modern/home.hbs +13 -0
- package/templates/modern/includes/api-try-it.hbs +61 -0
- package/templates/modern/includes/header-bar.hbs +23 -3
- package/templates/modern/includes/header.hbs +2 -2
- package/templates/modern/includes/scripts.hbs +75 -17
- package/templates/modern/includes/theme-toggle.hbs +2 -2
- package/templates/modern/js/api.js +300 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://github.com/jaredwray/docula/actions/workflows/tests.yaml)
|
|
6
6
|
[](https://github.com/jaredwray/docula/blob/master/LICENSE)
|
|
7
|
-
[](https://codecov.io/gh/jaredwray/docula)
|
|
7
|
+
[](https://codecov.io/gh/jaredwray/docula)
|
|
8
8
|
[](https://npmjs.com/package/docula)
|
|
9
9
|
[](https://npmjs.com/package/docula)
|
|
10
10
|
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
- [Features](#features)
|
|
13
13
|
- [Open Source Examples](#open-source-examples)
|
|
14
14
|
- [Getting Started](#getting-started)
|
|
15
|
+
- [Serve your site locally](#serve-your-site-locally)
|
|
15
16
|
- [TypeScript Configuration](#typescript-configuration)
|
|
17
|
+
- [Theme Mode](#theme-mode)
|
|
16
18
|
- [Using Your own Template](#using-your-own-template)
|
|
17
19
|
- [Building Multiple Pages](#building-multiple-pages)
|
|
20
|
+
- [Including Assets in Markdown](#including-assets-in-markdown)
|
|
18
21
|
- [Public Folder](#public-folder)
|
|
19
22
|
- [API Reference](#api-reference)
|
|
20
23
|
- [LLM Files](#llm-files)
|
|
@@ -76,6 +79,38 @@ Simply replace the logo, favicon, and css file with your own. The readme is your
|
|
|
76
79
|
|
|
77
80
|
This will build your site and place it in the `dist` folder. You can then host it anywhere you like.
|
|
78
81
|
|
|
82
|
+
## Serve your site locally
|
|
83
|
+
|
|
84
|
+
> npx docula serve
|
|
85
|
+
|
|
86
|
+
This will build and serve your site locally at `http://localhost:3000`. You can specify a custom port with the `-p` or `--port` flag:
|
|
87
|
+
|
|
88
|
+
> npx docula serve -p 8080
|
|
89
|
+
|
|
90
|
+
### CLI Options for serve
|
|
91
|
+
|
|
92
|
+
| Flag | Description | Default |
|
|
93
|
+
|------|-------------|---------|
|
|
94
|
+
| `-p, --port` | Set the port number | `3000` |
|
|
95
|
+
| `-s, --site` | Set the path where site files are located | `./site` |
|
|
96
|
+
| `-o, --output` | Set the output directory | `./site/dist` |
|
|
97
|
+
| `-w, --watch` | Watch for changes and rebuild | `false` |
|
|
98
|
+
| `-c, --clean` | Clean the output directory before building | `false` |
|
|
99
|
+
|
|
100
|
+
### Watch Mode
|
|
101
|
+
|
|
102
|
+
Use the `--watch` flag to automatically rebuild your site when files change:
|
|
103
|
+
|
|
104
|
+
> npx docula serve --watch
|
|
105
|
+
|
|
106
|
+
When watch mode is enabled:
|
|
107
|
+
1. An initial build runs at startup
|
|
108
|
+
2. The dev server starts and serves your site
|
|
109
|
+
3. File changes in `sitePath` (e.g., `./site`) are detected and trigger an automatic rebuild
|
|
110
|
+
4. Changes in the output directory are ignored to prevent rebuild loops
|
|
111
|
+
|
|
112
|
+
This is useful during development when you want to see changes reflected immediately without manually re-running the build.
|
|
113
|
+
|
|
79
114
|
# TypeScript Configuration
|
|
80
115
|
|
|
81
116
|
Docula supports TypeScript configuration files (`docula.config.ts`) in addition to JavaScript (`docula.config.mjs`). TypeScript configs provide type safety and better IDE support.
|
|
@@ -95,7 +130,7 @@ import type { DoculaOptions } from 'docula';
|
|
|
95
130
|
|
|
96
131
|
export const options: Partial<DoculaOptions> = {
|
|
97
132
|
templatePath: './template',
|
|
98
|
-
|
|
133
|
+
output: './dist',
|
|
99
134
|
sitePath: './site',
|
|
100
135
|
githubPath: 'your-username/your-repo',
|
|
101
136
|
siteTitle: 'My Project',
|
|
@@ -133,19 +168,34 @@ When both config files exist, Docula loads them in this order (first found wins)
|
|
|
133
168
|
| Option | Type | Default | Description |
|
|
134
169
|
|--------|------|---------|-------------|
|
|
135
170
|
| `templatePath` | `string` | `'./template'` | Path to custom template directory |
|
|
136
|
-
| `
|
|
171
|
+
| `output` | `string` | `'./dist'` | Output directory for built site |
|
|
137
172
|
| `sitePath` | `string` | `'./site'` | Directory containing site content |
|
|
138
173
|
| `githubPath` | `string` | - | GitHub repository path (e.g., `'user/repo'`) |
|
|
139
174
|
| `siteTitle` | `string` | `'docula'` | Website title |
|
|
140
175
|
| `siteDescription` | `string` | - | Website description |
|
|
141
176
|
| `siteUrl` | `string` | - | Website URL |
|
|
142
177
|
| `port` | `number` | `3000` | Port for local development server |
|
|
143
|
-
| `singlePage` | `boolean` | `true` | Single page or multi-page site |
|
|
144
178
|
| `homePage` | `boolean` | `true` | When `false`, Docula uses the first docs page as `/index.html` instead of rendering `home.hbs` |
|
|
145
179
|
| `sections` | `DoculaSection[]` | - | Documentation sections |
|
|
146
180
|
| `openApiUrl` | `string` | - | OpenAPI spec URL for API documentation (auto-detected if `api/swagger.json` exists) |
|
|
147
181
|
| `enableReleaseChangelog` | `boolean` | `true` | Convert GitHub releases to changelog entries |
|
|
148
182
|
| `enableLlmsTxt` | `boolean` | `true` | Generate `llms.txt` and `llms-full.txt` in the build output |
|
|
183
|
+
| `themeMode` | `'light'` \| `'dark'` | - | Override the default theme. By default the site follows the system preference. Set to `'light'` or `'dark'` to use that theme when no user preference is stored. |
|
|
184
|
+
| `allowedAssets` | `string[]` | *(see [Including Assets in Markdown](#including-images-and-assets-in-markdown))* | File extensions to copy from `docs/` and `changelog/` to output |
|
|
185
|
+
|
|
186
|
+
## Theme Mode
|
|
187
|
+
|
|
188
|
+
By default, the site follows the user's system color scheme preference. The theme toggle cycles through three modes: **system** (follows OS preference), **light**, and **dark**. The user's choice is persisted in `localStorage`.
|
|
189
|
+
|
|
190
|
+
To set the initial theme mode, use `themeMode`:
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
export const options = {
|
|
194
|
+
themeMode: 'dark',
|
|
195
|
+
};
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
When `themeMode` is set, new visitors see the specified theme instead of the system preference. Once a user clicks the theme toggle, their choice takes priority and is remembered across visits.
|
|
149
199
|
|
|
150
200
|
# Using Your own Template
|
|
151
201
|
|
|
@@ -187,6 +237,70 @@ export const options = {
|
|
|
187
237
|
};
|
|
188
238
|
```
|
|
189
239
|
|
|
240
|
+
# Including Assets in Markdown
|
|
241
|
+
|
|
242
|
+
Non-markdown files placed inside the `docs/` or `changelog/` directories are automatically copied to the build output, preserving their relative paths. This lets you keep images and other assets alongside the markdown that references them.
|
|
243
|
+
|
|
244
|
+
For `docs/`, only assets that are actually referenced in a document's markdown content are copied. If a file exists in the `docs/` directory but is not referenced by any document, it will not be included in the build output. For `changelog/`, all assets are copied regardless of whether they are referenced.
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
site
|
|
248
|
+
├───docs
|
|
249
|
+
│ ├───getting-started.md
|
|
250
|
+
│ ├───images
|
|
251
|
+
│ │ ├───architecture.png
|
|
252
|
+
│ │ └───screenshot.jpg
|
|
253
|
+
│ └───assets
|
|
254
|
+
│ └───example.pdf
|
|
255
|
+
├───changelog
|
|
256
|
+
│ ├───2025-01-15-initial-release.md
|
|
257
|
+
│ └───images
|
|
258
|
+
│ └───release-banner.png
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
After building, these files appear at the same relative paths under `dist/`:
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
dist
|
|
265
|
+
├───docs
|
|
266
|
+
│ ├───getting-started
|
|
267
|
+
│ │ └───index.html
|
|
268
|
+
│ ├───images
|
|
269
|
+
│ │ ├───architecture.png
|
|
270
|
+
│ │ └───screenshot.jpg
|
|
271
|
+
│ └───assets
|
|
272
|
+
│ └───example.pdf
|
|
273
|
+
├───changelog
|
|
274
|
+
│ ├───initial-release
|
|
275
|
+
│ │ └───index.html
|
|
276
|
+
│ └───images
|
|
277
|
+
│ └───release-banner.png
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Reference assets from your markdown using relative paths:
|
|
281
|
+
|
|
282
|
+
```md
|
|
283
|
+

|
|
284
|
+
[Download PDF](assets/example.pdf)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Supported Extensions
|
|
288
|
+
|
|
289
|
+
By default the following file extensions are copied:
|
|
290
|
+
|
|
291
|
+
**Images:** `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`, `.webp`, `.avif`, `.ico`
|
|
292
|
+
**Documents:** `.pdf`, `.zip`, `.tar`, `.gz`
|
|
293
|
+
**Media:** `.mp4`, `.webm`, `.ogg`, `.mp3`, `.wav`
|
|
294
|
+
**Data:** `.json`, `.xml`, `.csv`, `.txt`
|
|
295
|
+
|
|
296
|
+
Files with extensions not in this list are ignored. To customize the list, set `allowedAssets` in your config:
|
|
297
|
+
|
|
298
|
+
```js
|
|
299
|
+
export const options = {
|
|
300
|
+
allowedAssets: ['.png', '.jpg', '.gif', '.svg', '.pdf', '.custom'],
|
|
301
|
+
};
|
|
302
|
+
```
|
|
303
|
+
|
|
190
304
|
# Public Folder
|
|
191
305
|
|
|
192
306
|
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.
|
|
@@ -245,7 +359,7 @@ This is useful for:
|
|
|
245
359
|
|
|
246
360
|
# API Reference
|
|
247
361
|
|
|
248
|
-
Docula can generate an API Reference page from an OpenAPI (Swagger) specification. The
|
|
362
|
+
Docula can generate an API Reference page from an OpenAPI (Swagger) specification. The spec is parsed at build time and rendered as a native, interactive API reference (inspired by [Scalar](https://github.com/scalar/scalar)) with grouped endpoints, method badges, schema tables, code examples, and search — all with no external dependencies. The page is available at `/api`.
|
|
249
363
|
|
|
250
364
|
## Auto-Detection
|
|
251
365
|
|
package/dist/docula.d.ts
CHANGED
|
@@ -1,13 +1,85 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import http from 'node:http';
|
|
2
3
|
export { Writr } from 'writr';
|
|
3
4
|
|
|
4
|
-
type
|
|
5
|
+
type ApiSchemaProperty = {
|
|
5
6
|
name: string;
|
|
6
|
-
|
|
7
|
+
type: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
description: string;
|
|
10
|
+
enumValues?: string[];
|
|
11
|
+
};
|
|
12
|
+
type ApiOperationParameter = {
|
|
13
|
+
name: string;
|
|
14
|
+
in: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
type ApiRequestBody = {
|
|
20
|
+
contentType: string;
|
|
21
|
+
schemaProperties: ApiSchemaProperty[];
|
|
22
|
+
example: string;
|
|
23
|
+
};
|
|
24
|
+
type ApiResponse = {
|
|
25
|
+
statusCode: string;
|
|
26
|
+
statusClass: string;
|
|
27
|
+
description: string;
|
|
28
|
+
contentType: string;
|
|
29
|
+
schemaProperties: ApiSchemaProperty[];
|
|
30
|
+
example: string;
|
|
31
|
+
};
|
|
32
|
+
type ApiCodeExamples = {
|
|
33
|
+
curl: string;
|
|
34
|
+
javascript: string;
|
|
35
|
+
python: string;
|
|
36
|
+
};
|
|
37
|
+
type ApiOperation = {
|
|
38
|
+
id: string;
|
|
39
|
+
method: string;
|
|
40
|
+
methodUpper: string;
|
|
7
41
|
path: string;
|
|
8
|
-
|
|
42
|
+
summary: string;
|
|
43
|
+
description: string;
|
|
44
|
+
parameters: ApiOperationParameter[];
|
|
45
|
+
requestBody?: ApiRequestBody;
|
|
46
|
+
responses: ApiResponse[];
|
|
47
|
+
codeExamples: ApiCodeExamples;
|
|
48
|
+
};
|
|
49
|
+
type ApiGroup = {
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
id: string;
|
|
53
|
+
operations: ApiOperation[];
|
|
54
|
+
};
|
|
55
|
+
type ApiSpecData = {
|
|
56
|
+
info: {
|
|
57
|
+
title: string;
|
|
58
|
+
description: string;
|
|
59
|
+
version: string;
|
|
60
|
+
};
|
|
61
|
+
servers: Array<{
|
|
62
|
+
url: string;
|
|
63
|
+
description: string;
|
|
64
|
+
}>;
|
|
65
|
+
groups: ApiGroup[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type GithubData = {
|
|
69
|
+
releases: Record<string, unknown>;
|
|
70
|
+
contributors: Record<string, unknown>;
|
|
9
71
|
};
|
|
10
72
|
|
|
73
|
+
type DoculaCookieAuth = {
|
|
74
|
+
loginUrl: string;
|
|
75
|
+
cookieName?: string;
|
|
76
|
+
logoutUrl?: string;
|
|
77
|
+
};
|
|
78
|
+
type DoculaCacheOptions = {
|
|
79
|
+
github: {
|
|
80
|
+
ttl: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
11
83
|
declare class DoculaOptions {
|
|
12
84
|
/**
|
|
13
85
|
* Name of the built-in template to use (e.g., "modern", "classic")
|
|
@@ -20,7 +92,7 @@ declare class DoculaOptions {
|
|
|
20
92
|
/**
|
|
21
93
|
* Path to the output directory
|
|
22
94
|
*/
|
|
23
|
-
|
|
95
|
+
output: string;
|
|
24
96
|
/**
|
|
25
97
|
* Path to the site directory
|
|
26
98
|
*/
|
|
@@ -45,10 +117,6 @@ declare class DoculaOptions {
|
|
|
45
117
|
* Port to run the server
|
|
46
118
|
*/
|
|
47
119
|
port: number;
|
|
48
|
-
/**
|
|
49
|
-
* Single page website
|
|
50
|
-
*/
|
|
51
|
-
singlePage: boolean;
|
|
52
120
|
/**
|
|
53
121
|
* Sections
|
|
54
122
|
*/
|
|
@@ -73,15 +141,173 @@ declare class DoculaOptions {
|
|
|
73
141
|
* When true, generates llms.txt and llms-full.txt files for the built site.
|
|
74
142
|
*/
|
|
75
143
|
enableLlmsTxt: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Override the default theme toggle. By default the site follows the system
|
|
146
|
+
* preference. Set to "light" or "dark" to use that theme when no user
|
|
147
|
+
* preference is stored in localStorage.
|
|
148
|
+
*/
|
|
149
|
+
themeMode?: "light" | "dark";
|
|
150
|
+
/**
|
|
151
|
+
* When true, automatically adds generated paths (e.g., .cache) to the
|
|
152
|
+
* site directory's .gitignore file if not already present.
|
|
153
|
+
*/
|
|
154
|
+
autoUpdateIgnores: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* File extensions to copy as assets from docs/ and changelog/ directories.
|
|
157
|
+
* Override in docula.config to customize.
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* Cookie-based authentication. When set, shows a Login/Logout button
|
|
161
|
+
* in the header based on whether a JWT cookie is present.
|
|
162
|
+
*/
|
|
163
|
+
cookieAuth?: DoculaCookieAuth;
|
|
164
|
+
/**
|
|
165
|
+
* File extensions to copy as assets from docs/ and changelog/ directories.
|
|
166
|
+
* Override in docula.config to customize.
|
|
167
|
+
*/
|
|
168
|
+
/**
|
|
169
|
+
* Cache settings. Controls caching of external data (e.g., GitHub API responses)
|
|
170
|
+
* in the .cache directory within the site path.
|
|
171
|
+
*/
|
|
172
|
+
cache: DoculaCacheOptions;
|
|
173
|
+
/**
|
|
174
|
+
* File extensions to copy as assets from docs/ and changelog/ directories.
|
|
175
|
+
* Override in docula.config to customize.
|
|
176
|
+
*/
|
|
177
|
+
allowedAssets: string[];
|
|
76
178
|
constructor(options?: Record<string, unknown>);
|
|
77
179
|
parseOptions(options: Record<string, any>): void;
|
|
78
180
|
}
|
|
79
181
|
|
|
182
|
+
type DoculaChangelogEntry = {
|
|
183
|
+
title: string;
|
|
184
|
+
date: string;
|
|
185
|
+
formattedDate: string;
|
|
186
|
+
tag?: string;
|
|
187
|
+
tagClass?: string;
|
|
188
|
+
slug: string;
|
|
189
|
+
content: string;
|
|
190
|
+
generatedHtml: string;
|
|
191
|
+
urlPath: string;
|
|
192
|
+
};
|
|
193
|
+
type DoculaData = {
|
|
194
|
+
siteUrl: string;
|
|
195
|
+
siteTitle: string;
|
|
196
|
+
siteDescription: string;
|
|
197
|
+
sitePath: string;
|
|
198
|
+
templatePath: string;
|
|
199
|
+
output: string;
|
|
200
|
+
githubPath?: string;
|
|
201
|
+
github?: GithubData;
|
|
202
|
+
templates?: DoculaTemplates;
|
|
203
|
+
hasDocuments?: boolean;
|
|
204
|
+
hasChangelog?: boolean;
|
|
205
|
+
sections?: DoculaSection[];
|
|
206
|
+
documents?: DoculaDocument[];
|
|
207
|
+
sidebarItems?: DoculaSection[];
|
|
208
|
+
announcement?: string;
|
|
209
|
+
openApiUrl?: string;
|
|
210
|
+
hasApi?: boolean;
|
|
211
|
+
apiSpec?: ApiSpecData;
|
|
212
|
+
changelogEntries?: DoculaChangelogEntry[];
|
|
213
|
+
homePage?: boolean;
|
|
214
|
+
themeMode?: string;
|
|
215
|
+
cookieAuth?: {
|
|
216
|
+
loginUrl: string;
|
|
217
|
+
cookieName?: string;
|
|
218
|
+
logoutUrl?: string;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
type DoculaTemplates = {
|
|
222
|
+
home: string;
|
|
223
|
+
docPage?: string;
|
|
224
|
+
api?: string;
|
|
225
|
+
changelog?: string;
|
|
226
|
+
changelogEntry?: string;
|
|
227
|
+
};
|
|
228
|
+
type DoculaSection = {
|
|
229
|
+
name: string;
|
|
230
|
+
order?: number;
|
|
231
|
+
path: string;
|
|
232
|
+
children?: DoculaSection[];
|
|
233
|
+
};
|
|
234
|
+
type DoculaDocument = {
|
|
235
|
+
title: string;
|
|
236
|
+
navTitle: string;
|
|
237
|
+
description: string;
|
|
238
|
+
order?: number;
|
|
239
|
+
section?: string;
|
|
240
|
+
keywords: string[];
|
|
241
|
+
content: string;
|
|
242
|
+
markdown: string;
|
|
243
|
+
generatedHtml: string;
|
|
244
|
+
documentPath: string;
|
|
245
|
+
urlPath: string;
|
|
246
|
+
isRoot: boolean;
|
|
247
|
+
};
|
|
248
|
+
declare class DoculaBuilder {
|
|
249
|
+
private readonly _options;
|
|
250
|
+
private readonly _ecto;
|
|
251
|
+
private readonly _console;
|
|
252
|
+
constructor(options?: DoculaOptions, engineOptions?: any);
|
|
253
|
+
get options(): DoculaOptions;
|
|
254
|
+
build(): Promise<void>;
|
|
255
|
+
validateOptions(options: DoculaOptions): void;
|
|
256
|
+
getGithubData(githubPath: string): Promise<GithubData>;
|
|
257
|
+
getTemplates(templatePath: string, hasDocuments: boolean, hasChangelog?: boolean): Promise<DoculaTemplates>;
|
|
258
|
+
getTemplateFile(path: string, name: string): Promise<string | undefined>;
|
|
259
|
+
buildRobotsPage(options: DoculaOptions): Promise<void>;
|
|
260
|
+
buildSiteMapPage(data: DoculaData): Promise<void>;
|
|
261
|
+
buildLlmsFiles(data: DoculaData): Promise<void>;
|
|
262
|
+
private generateLlmsIndexContent;
|
|
263
|
+
private generateLlmsFullContent;
|
|
264
|
+
private buildAbsoluteSiteUrl;
|
|
265
|
+
private normalizePathForUrl;
|
|
266
|
+
private isRemoteUrl;
|
|
267
|
+
private resolveOpenApiSpecUrl;
|
|
268
|
+
private resolveLocalOpenApiPath;
|
|
269
|
+
private getSafeSiteOverrideFileContent;
|
|
270
|
+
private getSafeLocalOpenApiSpec;
|
|
271
|
+
private isPathWithinBasePath;
|
|
272
|
+
private toPosixPath;
|
|
273
|
+
buildIndexPage(data: DoculaData): Promise<void>;
|
|
274
|
+
buildDocsHomePage(data: DoculaData): Promise<void>;
|
|
275
|
+
buildReadmeSection(data: DoculaData): Promise<string>;
|
|
276
|
+
buildAnnouncementSection(data: DoculaData): Promise<string | undefined>;
|
|
277
|
+
buildDocsPages(data: DoculaData): Promise<void>;
|
|
278
|
+
buildApiPage(data: DoculaData): Promise<void>;
|
|
279
|
+
getChangelogEntries(changelogPath: string): DoculaChangelogEntry[];
|
|
280
|
+
parseChangelogEntry(filePath: string): DoculaChangelogEntry;
|
|
281
|
+
convertReleaseToChangelogEntry(release: Record<string, any>): DoculaChangelogEntry;
|
|
282
|
+
getReleasesAsChangelogEntries(releases: any[]): DoculaChangelogEntry[];
|
|
283
|
+
buildChangelogPage(data: DoculaData): Promise<void>;
|
|
284
|
+
buildChangelogEntryPages(data: DoculaData): Promise<void>;
|
|
285
|
+
generateSidebarItems(data: DoculaData): DoculaSection[];
|
|
286
|
+
getDocuments(sitePath: string, doculaData: DoculaData): DoculaDocument[];
|
|
287
|
+
getDocumentInDirectory(sitePath: string): DoculaDocument[];
|
|
288
|
+
getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
|
|
289
|
+
mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
|
|
290
|
+
parseDocumentData(documentPath: string): DoculaDocument;
|
|
291
|
+
private hasTableOfContents;
|
|
292
|
+
private directoryContainsMarkdown;
|
|
293
|
+
private mergeTemplateOverrides;
|
|
294
|
+
private ensureCacheInGitignore;
|
|
295
|
+
private isCacheFresh;
|
|
296
|
+
private listFilesRecursive;
|
|
297
|
+
private copyDirectory;
|
|
298
|
+
private copyPublicFolder;
|
|
299
|
+
private copyPublicDirectory;
|
|
300
|
+
private copyDocumentSiblingAssets;
|
|
301
|
+
private listContentAssets;
|
|
302
|
+
private copyContentAssets;
|
|
303
|
+
}
|
|
304
|
+
|
|
80
305
|
declare class Docula {
|
|
81
306
|
private _options;
|
|
82
307
|
private readonly _console;
|
|
83
308
|
private _configFileModule;
|
|
84
309
|
private _server;
|
|
310
|
+
private _watcher;
|
|
85
311
|
/**
|
|
86
312
|
* Initialize the Docula class
|
|
87
313
|
* @param {DoculaOptions} options
|
|
@@ -104,11 +330,23 @@ declare class Docula {
|
|
|
104
330
|
* @returns {http.Server | undefined}
|
|
105
331
|
*/
|
|
106
332
|
get server(): http.Server | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* The file watcher used in watch mode
|
|
335
|
+
* @returns {fs.FSWatcher | undefined}
|
|
336
|
+
*/
|
|
337
|
+
get watcher(): fs.FSWatcher | undefined;
|
|
107
338
|
/**
|
|
108
339
|
* The config file module. This is the module that is loaded from the docula.config.ts or docula.config.mjs file
|
|
109
340
|
* @returns {any}
|
|
110
341
|
*/
|
|
111
342
|
get configFileModule(): any;
|
|
343
|
+
/**
|
|
344
|
+
* Remove the .cache directory inside the site path.
|
|
345
|
+
* Resolves the path and verifies it stays within sitePath to prevent
|
|
346
|
+
* path-traversal attacks.
|
|
347
|
+
* @param {string} sitePath
|
|
348
|
+
*/
|
|
349
|
+
private cleanCache;
|
|
112
350
|
/**
|
|
113
351
|
* Check for updates
|
|
114
352
|
* @returns {void}
|
|
@@ -120,12 +358,6 @@ declare class Docula {
|
|
|
120
358
|
* @returns {Promise<void>}
|
|
121
359
|
*/
|
|
122
360
|
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
361
|
/**
|
|
130
362
|
* Generate the init files
|
|
131
363
|
* @param {string} sitePath
|
|
@@ -145,6 +377,13 @@ declare class Docula {
|
|
|
145
377
|
* @returns {Promise<void>}
|
|
146
378
|
*/
|
|
147
379
|
loadConfigFile(sitePath: string): Promise<void>;
|
|
380
|
+
/**
|
|
381
|
+
* Watch the site path for file changes and rebuild on change
|
|
382
|
+
* @param {DoculaOptions} options
|
|
383
|
+
* @param {DoculaBuilder} builder
|
|
384
|
+
* @returns {fs.FSWatcher}
|
|
385
|
+
*/
|
|
386
|
+
watch(options: DoculaOptions, builder: DoculaBuilder): fs.FSWatcher;
|
|
148
387
|
/**
|
|
149
388
|
* Serve the site based on the options (port and output path)
|
|
150
389
|
* @param {DoculaOptions} options
|
|
@@ -153,4 +392,4 @@ declare class Docula {
|
|
|
153
392
|
serve(options: DoculaOptions): Promise<http.Server>;
|
|
154
393
|
}
|
|
155
394
|
|
|
156
|
-
export { Docula as default };
|
|
395
|
+
export { type DoculaCacheOptions, type DoculaCookieAuth, DoculaOptions, Docula as default };
|