clean-jsdoc-theme 4.3.2 → 5.0.0-alpha.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/README.md +117 -625
- package/dist/publish.d.mts +218 -0
- package/dist/publish.d.ts +218 -0
- package/dist/publish.js +641 -0
- package/dist/publish.js.map +1 -0
- package/dist/publish.mjs +605 -0
- package/dist/publish.mjs.map +1 -0
- package/package.json +65 -55
- package/.eslintignore +0 -5
- package/.eslintrc.js +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -43
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -27
- package/.github/dependabot.yml +0 -9
- package/.github/pull_request_template.md +0 -16
- package/.github/workflows/codeql.yml +0 -72
- package/.github/workflows/greetings.yml +0 -16
- package/.prettierignore +0 -2
- package/.prettierrc +0 -5
- package/.stylelintignore +0 -4
- package/.stylelintrc +0 -18
- package/.travis.yml +0 -30
- package/CHANGELOG.md +0 -260
- package/CODE_OF_CONDUCT.md +0 -76
- package/CODE_OF_CONDUCT_HINDI.md +0 -61
- package/CONTRIBUTING.md +0 -36
- package/LICENSE +0 -21
- package/SECURITY.md +0 -21
- package/clean-jsdoc-theme-defaults.js +0 -37
- package/clean-jsdoc-theme-helper.js +0 -186
- package/css-property-order-fix.js +0 -56
- package/helpers/Environment.html +0 -3
- package/helpers/down-arrow.js +0 -9
- package/jsdoc-config.json +0 -102
- package/minify.js +0 -72
- package/publish.js +0 -1110
- package/static/fonts/Inconsolata-Regular.ttf +0 -0
- package/static/fonts/OpenSans-Regular.ttf +0 -0
- package/static/fonts/WorkSans-Bold.ttf +0 -0
- package/static/scripts/core.js +0 -726
- package/static/scripts/core.min.js +0 -23
- package/static/scripts/resize.js +0 -90
- package/static/scripts/search.js +0 -265
- package/static/scripts/search.min.js +0 -6
- package/static/scripts/third-party/Apache-License-2.0.txt +0 -202
- package/static/scripts/third-party/fuse.js +0 -9
- package/static/scripts/third-party/hljs-line-num-original.js +0 -369
- package/static/scripts/third-party/hljs-line-num.js +0 -1
- package/static/scripts/third-party/hljs-original.js +0 -5171
- package/static/scripts/third-party/hljs.js +0 -1
- package/static/scripts/third-party/popper.js +0 -5
- package/static/scripts/third-party/tippy.js +0 -1
- package/static/scripts/third-party/tocbot.js +0 -672
- package/static/scripts/third-party/tocbot.min.js +0 -1
- package/static/styles/clean-jsdoc-theme-base.css +0 -1159
- package/static/styles/clean-jsdoc-theme-dark.css +0 -412
- package/static/styles/clean-jsdoc-theme-light.css +0 -482
- package/static/styles/clean-jsdoc-theme-scrollbar.css +0 -30
- package/static/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -1
- package/static/styles/clean-jsdoc-theme.min.css +0 -1
- package/tmpl/augments.tmpl +0 -10
- package/tmpl/container.tmpl +0 -208
- package/tmpl/details.tmpl +0 -207
- package/tmpl/example.tmpl +0 -3
- package/tmpl/examples.tmpl +0 -48
- package/tmpl/exceptions.tmpl +0 -32
- package/tmpl/icons.tmpl +0 -73
- package/tmpl/include-target-script-and-styles.tmpl +0 -43
- package/tmpl/layout.tmpl +0 -167
- package/tmpl/mainpage.tmpl +0 -10
- package/tmpl/members.tmpl +0 -42
- package/tmpl/method.tmpl +0 -175
- package/tmpl/mobile-sidebar.tmpl +0 -21
- package/tmpl/navbar-actions.tmpl +0 -19
- package/tmpl/navbar-menu.tmpl +0 -25
- package/tmpl/navbar.tmpl +0 -14
- package/tmpl/params.tmpl +0 -131
- package/tmpl/properties.tmpl +0 -109
- package/tmpl/returns.tmpl +0 -19
- package/tmpl/search.tmpl +0 -17
- package/tmpl/sidebar-items.tmpl +0 -24
- package/tmpl/sidebar-title.tmpl +0 -8
- package/tmpl/sidebar.tmpl +0 -9
- package/tmpl/source.tmpl +0 -13
- package/tmpl/toc.tmpl +0 -4
- package/tmpl/tutorial.tmpl +0 -32
- package/tmpl/type.tmpl +0 -13
package/README.md
CHANGED
|
@@ -1,625 +1,117 @@
|
|
|
1
|
-
# clean-jsdoc-theme
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
If you set default theme as `"fallback-dark"`, then `clean-jsdoc-theme` will try to detect user's preferred color scheme. If it will detect successfully then it will set user's preferred theme else fallback to dark theme.
|
|
120
|
-
|
|
121
|
-
Same if you set default theme as `"fallback-light"`, it will try to detect user's preferred theme. If not then fallback to light theme.
|
|
122
|
-
|
|
123
|
-
### Set base url
|
|
124
|
-
|
|
125
|
-
To set the base url, add the following in your JSDoc config file:
|
|
126
|
-
|
|
127
|
-
```json
|
|
128
|
-
"theme_opts": {
|
|
129
|
-
"base_url": "https://ankdev.me/v4/"
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
> Make sure to add a forward slash (`/`) at the end of the URL.
|
|
134
|
-
|
|
135
|
-
The default value of `base_url` is computed with the following code:
|
|
136
|
-
|
|
137
|
-
```js
|
|
138
|
-
const path = document.location.pathname;
|
|
139
|
-
const baseURL = path.substr(0, path.lastIndexOf('/') + 1);
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Add favicon
|
|
143
|
-
|
|
144
|
-
To set a favicon, add the following in your JSDoc config file:
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
"theme_opts": {
|
|
148
|
-
"favicon": "path/to/img"
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
You can use [`static_dir`](#add-static-dir) option to copy all you static files to output dir and use that path instead
|
|
153
|
-
of `path/to/img`. This will not flatten the output file path, it will preserve the directory structure. If you want to
|
|
154
|
-
flatten the output dir use jsdoc default [copy static files options](https://jsdoc.app/about-configuring-default-template.html)
|
|
155
|
-
|
|
156
|
-
### Add homepage title
|
|
157
|
-
|
|
158
|
-
To add the title of the homepage use the `homepageTitle` property as follows:
|
|
159
|
-
|
|
160
|
-
```json
|
|
161
|
-
"theme_opts": {
|
|
162
|
-
"homepageTitle": "Clean JSDoc theme"
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Add title
|
|
167
|
-
|
|
168
|
-
Both strings and HTML are accepted. Use HTML to overwrite the default HTML, and a string to set a plaintext title. One
|
|
169
|
-
example of this is below:
|
|
170
|
-
|
|
171
|
-
```json
|
|
172
|
-
"theme_opts": {
|
|
173
|
-
"title": "<img src='path/to/img' class='my-custom-class'/>" // or "title": "clean-jsodc-theme"
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
You can use [`static_dir`](#add-static-dir) option to copy all you static files to output dir and use that path in place
|
|
178
|
-
of `path/to/img`.
|
|
179
|
-
|
|
180
|
-
### Add files list in homepage
|
|
181
|
-
|
|
182
|
-
By default `clean-jsdoc-theme` will not include the list of files in the homepage. If you want to add them the do the following
|
|
183
|
-
|
|
184
|
-
```json
|
|
185
|
-
"theme_opts": {
|
|
186
|
-
"includeFilesListInHomepage": true // by default it is false.
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
> Note: You need to add @file tag in the .js if you want to include it in the file list. For more details on `@file` visit: https://jsdoc.app/tags-file.html
|
|
191
|
-
|
|
192
|
-
### Add navbar menu
|
|
193
|
-
|
|
194
|
-
To render extra link(s) in navbar. It accepts an array of objects:
|
|
195
|
-
|
|
196
|
-
```json
|
|
197
|
-
"theme_opts": {
|
|
198
|
-
"menu": [
|
|
199
|
-
{
|
|
200
|
-
"title": "Website",
|
|
201
|
-
"link": "https://ankdev.me/clean-jsdoc-theme/dark/",
|
|
202
|
-
"target": "_blank",
|
|
203
|
-
"class": "some-class",
|
|
204
|
-
"id": "some-id"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
// more if you want to.
|
|
208
|
-
}
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
`menu` is an array of objects. Each object has five properties, out of which two are required (`title` and `link`). If
|
|
214
|
-
an object doesn't have the required properties, then you might expect an error.
|
|
215
|
-
|
|
216
|
-
<b>Properties</b>
|
|
217
|
-
|
|
218
|
-
| name | type | required |
|
|
219
|
-
| -------- | -------- | -------- |
|
|
220
|
-
| `title` | `string` | required |
|
|
221
|
-
| `link` | `string` | required |
|
|
222
|
-
| `target` | `string` | optional |
|
|
223
|
-
| `class` | `string` | optional |
|
|
224
|
-
| `id` | `string` | optional |
|
|
225
|
-
|
|
226
|
-
### Sections
|
|
227
|
-
|
|
228
|
-
There is also an option to add a meta tag to every generated HTML file. You can use the `meta` option to include a list
|
|
229
|
-
of `meta` tags into `head`.
|
|
230
|
-
|
|
231
|
-
```json
|
|
232
|
-
"theme_opts": {
|
|
233
|
-
"sections": ["Classes", "Modules", "Global"] // Only three members will be in the sidebar.
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
```js
|
|
238
|
-
// SECTION_TYPE
|
|
239
|
-
[
|
|
240
|
-
'Classes',
|
|
241
|
-
'Modules',
|
|
242
|
-
'Externals',
|
|
243
|
-
'Events',
|
|
244
|
-
'Namespaces',
|
|
245
|
-
'Mixins',
|
|
246
|
-
'Tutorials',
|
|
247
|
-
'Interfaces',
|
|
248
|
-
'Global',
|
|
249
|
-
];
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### Meta
|
|
253
|
-
|
|
254
|
-
There is also an option to add meta tag to every generated HTML file. You can use `meta` option to include a list
|
|
255
|
-
of `meta` tags into `head`.
|
|
256
|
-
|
|
257
|
-
```json
|
|
258
|
-
"theme_opts": {
|
|
259
|
-
"meta": [
|
|
260
|
-
{
|
|
261
|
-
"name": "author",
|
|
262
|
-
"content": "Ankit Kumar"
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
"name": "description",
|
|
266
|
-
"content": "Best Clean and minimal JSDoc 3 Template/Theme"
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
`meta` is an array of objects. Each objects can have any valid combination
|
|
273
|
-
of [HTML metadata attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes).
|
|
274
|
-
|
|
275
|
-
### Search
|
|
276
|
-
|
|
277
|
-
By default, the search feature is enabled in the theme.
|
|
278
|
-
|
|
279
|
-
> Make sure you have added the `base_url` option as well, otherwise your search query might fail.
|
|
280
|
-
>
|
|
281
|
-
> If you want to disable the search feature, you can do the following:
|
|
282
|
-
|
|
283
|
-
```json
|
|
284
|
-
"theme_opts": {
|
|
285
|
-
"search": false
|
|
286
|
-
}
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
**How does the search work?**
|
|
290
|
-
|
|
291
|
-
If the search feature is enabled, you'll see a `data` folder in the output. This `data` folder contains a JSON
|
|
292
|
-
called `search.json`. There is a fetch request when user types anything in the search box. That means search data is
|
|
293
|
-
only loaded if user wants to search anything.
|
|
294
|
-
|
|
295
|
-
### CodePen
|
|
296
|
-
|
|
297
|
-
> Note: currently, this feature is only enabled for the examples section.
|
|
298
|
-
|
|
299
|
-
```json
|
|
300
|
-
"theme_opts": {
|
|
301
|
-
"codepen": {
|
|
302
|
-
"enable_for": ["examples"],
|
|
303
|
-
"options": {
|
|
304
|
-
"js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
|
|
305
|
-
"js_pre_processor": "babel"
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
`options` can be any valid CodePen option. For more
|
|
312
|
-
visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
|
|
313
|
-
|
|
314
|
-
If you want to add some js in the beginning of your example then you can use `js` option.
|
|
315
|
-
|
|
316
|
-
```json
|
|
317
|
-
"theme_opts": {
|
|
318
|
-
"codepen": {
|
|
319
|
-
"enable_for": ["examples"],
|
|
320
|
-
"options": {
|
|
321
|
-
"js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
|
|
322
|
-
"js_pre_processor": "babel"
|
|
323
|
-
"js": "import Something from 'some-package'"
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
Let say you have an example as follows:
|
|
330
|
-
|
|
331
|
-
```js
|
|
332
|
-
/**
|
|
333
|
-
* @example
|
|
334
|
-
* let a = Something.fn()
|
|
335
|
-
* console.log(a) // Return value of something
|
|
336
|
-
*/
|
|
337
|
-
const a;
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
In codepen the above `@example` will look like:
|
|
341
|
-
|
|
342
|
-
```js
|
|
343
|
-
import Something from 'some-package';
|
|
344
|
-
|
|
345
|
-
let a = Something.fn();
|
|
346
|
-
console.log(a); // Return value of something
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### Add static dir
|
|
350
|
-
|
|
351
|
-
To include static files:
|
|
352
|
-
|
|
353
|
-
```json
|
|
354
|
-
"theme_opts": {
|
|
355
|
-
"static_dir": ["./static"],
|
|
356
|
-
}
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
### Add styles
|
|
360
|
-
|
|
361
|
-
To create custom style rules. Example:
|
|
362
|
-
|
|
363
|
-
```json
|
|
364
|
-
"theme_opts": {
|
|
365
|
-
"create_style": ".sidebar-title { font-size: 2rem }"
|
|
366
|
-
}
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### Add style paths
|
|
370
|
-
|
|
371
|
-
Use this option to add third party css library. If you want to add your own custom css file then consider
|
|
372
|
-
using [Add custom css files](#add-custom-css-files)
|
|
373
|
-
|
|
374
|
-
> Note: you have to pass an array of objects. Each object key will be an attribute inside the generated style tag.
|
|
375
|
-
|
|
376
|
-
Example:
|
|
377
|
-
|
|
378
|
-
```json
|
|
379
|
-
"add_style_path": [
|
|
380
|
-
{
|
|
381
|
-
"href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
|
|
382
|
-
"integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
|
|
383
|
-
"crossorigin": "anonymous"
|
|
384
|
-
}
|
|
385
|
-
],
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### Add custom css files
|
|
389
|
-
|
|
390
|
-
To include css files. Example:
|
|
391
|
-
|
|
392
|
-
```json
|
|
393
|
-
"theme_opts": {
|
|
394
|
-
"include_css": ["./static/index.css", "./src/docs/index.css"]
|
|
395
|
-
}
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
> Note: you are not required to manually copy file to output dir.
|
|
399
|
-
|
|
400
|
-
It will include the css files to the output dir and also attach a link tag to the html pointing to the included css
|
|
401
|
-
file.
|
|
402
|
-
|
|
403
|
-
### Add scripts
|
|
404
|
-
|
|
405
|
-
If you wish to incorporate JavaScript functions that execute when a user accesses a webpage, you can utilize the add_scripts option for this purpose. For instance, suppose you want to display a notification dialog when a user visits the webpage located at https://place-where-my-docs-are/SomeClass.html. You want to notify users that they should refrain from utilizing this class. To accomplish this, you can proceed as follows:
|
|
406
|
-
|
|
407
|
-
```json
|
|
408
|
-
"theme_opts": {
|
|
409
|
-
"add_scripts": "function showAlert(){ if (window.location.pathname === '/SomeClass.html') { alert('Do not use this class') } } showAlert();",
|
|
410
|
-
}
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
Writing js code like above can get tricky and complex. You can consider `include_js`.
|
|
414
|
-
|
|
415
|
-
### Add script paths
|
|
416
|
-
|
|
417
|
-
Use this option to add third party js library. If you want to add your own custom script file then consider
|
|
418
|
-
using [Add custom script files](#add-custom-script-files)
|
|
419
|
-
|
|
420
|
-
> Note: you have to pass an array of objects, and object keys are actually the attributes which you want in you script
|
|
421
|
-
> tag.
|
|
422
|
-
|
|
423
|
-
Example:
|
|
424
|
-
|
|
425
|
-
```json
|
|
426
|
-
"add_script_path": [
|
|
427
|
-
{
|
|
428
|
-
"href": "https://code.jquery.com/jquery-3.5.1.js",
|
|
429
|
-
"integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
|
|
430
|
-
"crossorigin": "anonymous"
|
|
431
|
-
}
|
|
432
|
-
],
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
This will copy the static folder to the output dir.
|
|
436
|
-
|
|
437
|
-
> Note: if the directory doesn't exist then you may get an error. Also, directory is relative to your jsdoc config file.
|
|
438
|
-
|
|
439
|
-
This will not flatten the directory. Directory structure will be kept as it is.
|
|
440
|
-
|
|
441
|
-
### Add custom script files
|
|
442
|
-
|
|
443
|
-
If you wish to run some local/custom javascript then you can include them via `include_js`.
|
|
444
|
-
|
|
445
|
-
Lets say you want to show some custom message depending on url. You can create a js file as follows:
|
|
446
|
-
|
|
447
|
-
```js
|
|
448
|
-
// static/showAlert.js
|
|
449
|
-
function showCustomAlertMessage() {
|
|
450
|
-
const pathname = window.location.pathname;
|
|
451
|
-
|
|
452
|
-
switch (pathname) {
|
|
453
|
-
case '/SomeClass.html':
|
|
454
|
-
return alert("Please don't use this class");
|
|
455
|
-
case '/OtherPage.html':
|
|
456
|
-
return alert('Wonderful!');
|
|
457
|
-
default:
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
showCustomAlert();
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
Assuming the above js file is stored in `./static/showAlert.js`. To include you can do:
|
|
466
|
-
|
|
467
|
-
```json
|
|
468
|
-
"theme_opts": {
|
|
469
|
-
"include_js": ["./static/showAlert.js"]
|
|
470
|
-
}
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
> Note: you are not required to manually copy file to output dir.
|
|
474
|
-
|
|
475
|
-
It will include the js files to the output dir and also attach a script tag to the html pointing to the included js
|
|
476
|
-
file.
|
|
477
|
-
|
|
478
|
-
If you want to add some script for some pages then you can do the following:
|
|
479
|
-
|
|
480
|
-
```json
|
|
481
|
-
"include_js": [
|
|
482
|
-
"./demo/src/assets/script.js",
|
|
483
|
-
{
|
|
484
|
-
"filepath": "./demo/src/assets/random.js",
|
|
485
|
-
"targets": [
|
|
486
|
-
"MyClass",
|
|
487
|
-
"tutorial-MyClassTutorial"
|
|
488
|
-
]
|
|
489
|
-
}
|
|
490
|
-
],
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
Here target is the name of the generated html file (don't include `.html`).
|
|
494
|
-
|
|
495
|
-
The above config will add `./demo/src/assets/script.js` to all the generated html files. However, it will
|
|
496
|
-
add `./demo/src/assets/random.js` only to `MyClass.html` and `tutorial-MyClassTutorial.html` files.
|
|
497
|
-
|
|
498
|
-
The file name of the generated html generally follows the following convention:
|
|
499
|
-
|
|
500
|
-
- Class: class's name + `.html`. Ex `Alive.html`
|
|
501
|
-
- Module: `module-` + module's name + `.html`. Ex: `module-SqlJs.html`
|
|
502
|
-
- Tutorials: `tutorial-` + tutorial's filename + `.html`
|
|
503
|
-
|
|
504
|
-
If you are not sure about the target name, then generate html for the first time, then look at the urls.
|
|
505
|
-
|
|
506
|
-
### To ignore sorting
|
|
507
|
-
|
|
508
|
-
To ignore the sorting of members/methods/event in the page. If it is `false` then the order of
|
|
509
|
-
members/methods/events will be in the order they are in code/source.
|
|
510
|
-
|
|
511
|
-
```json
|
|
512
|
-
"theme_opts": {
|
|
513
|
-
"sort": false
|
|
514
|
-
}
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
### Footer
|
|
518
|
-
|
|
519
|
-
```json
|
|
520
|
-
"theme_opts": {
|
|
521
|
-
"footer": "This is footer" // or <div class="footer-wrapper">This is a footer </div>
|
|
522
|
-
}
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### To exclude inherited
|
|
526
|
-
|
|
527
|
-
To exclude inherited symbols. Example:
|
|
528
|
-
|
|
529
|
-
```json
|
|
530
|
-
"exclude_inherited": true
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
This will remove all symbols (members, methods ...) that come from inherited parents.
|
|
534
|
-
|
|
535
|
-
### To remove styled applied to scrollbar
|
|
536
|
-
|
|
537
|
-
By default `clean-jsdoc-theme` applies some styles to browser's scroll bar. However if you want to remove this style do the following
|
|
538
|
-
|
|
539
|
-
```json
|
|
540
|
-
{
|
|
541
|
-
"theme_opts": {
|
|
542
|
-
"shouldRemoveScrollbarStyle": false
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
This will remove all symbols (members, methods ...) that come from inherited parents.
|
|
548
|
-
|
|
549
|
-
## Cheat sheet
|
|
550
|
-
|
|
551
|
-
| name | default | use case | expected value(s) |
|
|
552
|
-
| ---------------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
553
|
-
| `default_theme` | `"dark"` | To set the default theme | `"light", "dark"`, `"fallback-light"` or `"fallback-dark"` |
|
|
554
|
-
| `homepageTitle` | "Home" | To set the title of homepage. This will update HTML `<title>`. | `string` |
|
|
555
|
-
| `title` | `null` | To set the title of the sidebar. | `HTML` or `string` |
|
|
556
|
-
| `base_url` | `/` | To set the base URL | `string` |
|
|
557
|
-
| `menu` | `null` | To render extra link in navbar | Array of Object(s) |
|
|
558
|
-
| `meta` | `null` | Meta tag attributes | Array of Object(s) |
|
|
559
|
-
| `search` | `true` | To render search or not | `true` or `false` |
|
|
560
|
-
| `codepen` | `{}` | To open code in codepen | `Object` |
|
|
561
|
-
| `static_dir` | `null` | To include static dir | Array of string |
|
|
562
|
-
| `create_style` | `null` | To create custom style rules | `string` |
|
|
563
|
-
| `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
|
|
564
|
-
| `include_css` | `null` | To include css files | Array of string |
|
|
565
|
-
| `add_scripts` | `null` | To create custom script | `string` |
|
|
566
|
-
| `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
|
|
567
|
-
| `include_js` | `null` | To include js files | `string` |
|
|
568
|
-
| `footer` | `null` | To render footer | `HTML` or `string` |
|
|
569
|
-
| `exclude_inherited` | `false` | To exclude inherited symbols | `boolean` |
|
|
570
|
-
| `sections` | `["Modules", "Classes", "Externals", "Events", "Namespaces", "Mixins", "Tutorials", "Interfaces", "Global"]` | To order navbar/sidebar sections or to hide/remove navbar/sidebar sections | `Array<SECTION_TYPE>` |
|
|
571
|
-
| `displayModuleHeader` | `false` | If you want the module name to appear on its page | `boolean` |
|
|
572
|
-
| `includeFilesListInHomepage` | `false` | If you want to add or remove the list of files in homepage | `boolean` |
|
|
573
|
-
| `sort` | `true` | To sort the output members/methods/events | `boolean` |
|
|
574
|
-
| `shouldRemoveScrollbarStyle` | `false` | To remove styles applied to browser's scrollbar | `boolean` |
|
|
575
|
-
|
|
576
|
-
Don't forget to add the following in your jsdoc config file, otherwise toc will not work on some pages.
|
|
577
|
-
|
|
578
|
-
```json
|
|
579
|
-
"markdown": {
|
|
580
|
-
"idInHeadings": true // This is important for clean-jsdoc-theme, otherwise some features might not work.
|
|
581
|
-
}
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
## Changelog
|
|
585
|
-
|
|
586
|
-
Changelog is moved
|
|
587
|
-
to [https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CHANGELOG.md](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CHANGELOG.md)
|
|
588
|
-
|
|
589
|
-
## Developing
|
|
590
|
-
|
|
591
|
-
Before starting please go through
|
|
592
|
-
our [contributing guide](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CONTRIBUTING.md).
|
|
593
|
-
|
|
594
|
-
```bash
|
|
595
|
-
git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git
|
|
596
|
-
cd clean-jsdoc-theme
|
|
597
|
-
npm install
|
|
598
|
-
npm install jsdoc --no-save
|
|
599
|
-
npm run build
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
`npm run build` will generate files in output folder.
|
|
603
|
-
|
|
604
|
-
## Contributors
|
|
605
|
-
|
|
606
|
-
<a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
|
|
607
|
-
<img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" alt="clean-jsdoc-contributors" />
|
|
608
|
-
</a>
|
|
609
|
-
|
|
610
|
-
## Thanks
|
|
611
|
-
|
|
612
|
-
Thanks to [fuse.js](https://fusejs.io/), [hljs](https://highlightjs.org/),[tippy.js](https://tippyjs.bootcss.com/), and
|
|
613
|
-
all awesome contributors.
|
|
614
|
-
|
|
615
|
-
## Contact
|
|
616
|
-
|
|
617
|
-
If you like my work, then give me
|
|
618
|
-
a <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme" data-icon="octicon-star" aria-label="Star ankitskvmdam/clean-jsdoc-theme on GitHub">
|
|
619
|
-
star</a>.
|
|
620
|
-
|
|
621
|
-
Mail me at: <a href="mailto:hello@ankdev.me">hello@ankdev.me</a> <br>
|
|
622
|
-
|
|
623
|
-
## License
|
|
624
|
-
|
|
625
|
-
Licensed under the MIT license.
|
|
1
|
+
# clean-jsdoc-theme
|
|
2
|
+
|
|
3
|
+
JSDoc theme entry for v5. A thin bridge that JSDoc invokes via `require()` and that wires the four boundary packages — [setu](../setu) (JSDoc → `SiteManifest`), [dwar](../dwar) (`SiteManifest` → HTML/CSS/JS), and [Pagefind](https://pagefind.app/) (post-write search index) — into a single `publish(data, opts, tutorials)` call.
|
|
4
|
+
|
|
5
|
+
> v5 is in alpha. To stay on v4, pin `"clean-jsdoc-theme": "^4"` in your `package.json`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add -D clean-jsdoc-theme jsdoc
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Add a `jsdoc.json` to your project:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"source": {
|
|
20
|
+
"include": ["./src", "./README.md"]
|
|
21
|
+
},
|
|
22
|
+
"plugins": ["plugins/markdown"],
|
|
23
|
+
"opts": {
|
|
24
|
+
"encoding": "utf8",
|
|
25
|
+
"destination": "dist",
|
|
26
|
+
"recurse": true,
|
|
27
|
+
"template": "./node_modules/clean-jsdoc-theme/dist"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Run JSDoc:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
jsdoc -c jsdoc.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then serve `dist/` over HTTP (Pagefind requires HTTP for the search index to load):
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
pnpm dlx serve dist
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## What gets generated
|
|
45
|
+
|
|
46
|
+
The theme emits a page per documented container (class / interface / mixin / module / namespace / typedef), one aggregated **Globals** page, the **README** as the home page, and **tutorials** as guide pages. For each page:
|
|
47
|
+
|
|
48
|
+
- `<slug>/index.html` — a server-rendered page with a pre-hydration theme script, layout chrome (header / sidebar / TOC / footer), island markers, and the lazy island loader.
|
|
49
|
+
- `<slug>/index.md` — the page's Markdown, written verbatim alongside the HTML, so LLMs (and the copy-page button) can fetch the source for any page. Source-viewer pages have none.
|
|
50
|
+
|
|
51
|
+
Plus, once per build:
|
|
52
|
+
|
|
53
|
+
- `_assets/styles.<buildId>.css` — combined theme-variable layer + static utility CSS, content-hashed for caching.
|
|
54
|
+
- `_assets/search-index.<buildId>.json` — the fuzzy search index the command palette (`Ctrl/⌘ K`) fetches on first open.
|
|
55
|
+
- `_islands/<name>.js` — one ESM chunk per island (`sidebar`, `mobile-nav`, `toc`, `toc-mobile`, `cmdk`, `code-tabs`, `copy-btn`, `copy-page`, `theme-toggle`, `settings`, `code-viewer`). Each page loads only the chunks whose markers are present.
|
|
56
|
+
- `pagefind/…` — an optional Pagefind full-text index, built against the on-disk HTML.
|
|
57
|
+
|
|
58
|
+
When `templates.default.outputSourceFiles` is on (default), every documented source file also becomes a read-only viewer page, with a flat **Source Files** index and a `Source: file:line` link on each member.
|
|
59
|
+
|
|
60
|
+
`opts.package` (the path to your `package.json` if you pass `--package`) flows into the manifest as `pkg.name` / `pkg.version` / `pkg.repository` / etc. for footer and `<meta>` tags. If not provided, the theme falls back to JSDoc's automatic `kind: 'package'` doclet, then to no metadata.
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
All keys go under `opts` in `jsdoc.json` (unless noted):
|
|
65
|
+
|
|
66
|
+
| Key | Type | Description |
|
|
67
|
+
| --------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
68
|
+
| `siteName` | `string` \| `{ default?, dark?, light?, alt? }` | Header/footer identity + `<title>` suffix. A string, or a per-theme logo set (local images are copied to `_assets/logo-*`). |
|
|
69
|
+
| `fonts` | `{ heading?, body?, mono? }` | Google Fonts family names for `heading`/`body`; `mono` is a CSS stack. |
|
|
70
|
+
| `sectionOrder` | `string[]` | Orders **and** filters the sidebar sections (e.g. `["Classes","Modules","Tutorials"]`). |
|
|
71
|
+
| `menu` | `{ id?, title?, link?/href?, icon? }[]` | Full sidebar top region (built-in `home`/`source` links + external links). Takes precedence over `sectionOrder`'s built-ins. |
|
|
72
|
+
| `clubSidebarItems` | `boolean` | Club related entries into collapsible `parent → children` groups by path prefix (e.g. all `queue/*` under `queue`). Off by default. |
|
|
73
|
+
| `aiPrompt` | `string` | Custom prompt for the copy-page "Open in …" actions. `{siteName}`, `{url}`, `{mdUrl}` are substituted; only the prompt + links are sent (the AI fetches `{mdUrl}`). |
|
|
74
|
+
| `copyPage` | `boolean` \| `{ enabled?, actions? }` | The copy-page button. `false` hides it; `actions` is an ordered subset of `["copy","view","claude","chatgpt","perplexity"]` (`[]` = primary button only). On by default. |
|
|
75
|
+
| `templates.default.outputSourceFiles` | `boolean` | Emit source-viewer pages + `Source:` links. On by default. |
|
|
76
|
+
| `templates.default.sourceLinkToComment` | `boolean` | Make `Source:` links land on the doc-comment line instead of the declaration. Off by default. |
|
|
77
|
+
|
|
78
|
+
The default theme uses a light/dark OKLCH palette, system fonts, and the [GitHub Light](https://github.com/shikijs/textmate-grammars-themes/blob/main/packages/tm-themes/themes/github-light.json) / [GitHub Dark](https://github.com/shikijs/textmate-grammars-themes/blob/main/packages/tm-themes/themes/github-dark.json) shiki themes. Full token + component overrides land before stable.
|
|
79
|
+
|
|
80
|
+
> **Pagefind is optional.** If `pagefind` isn't installed in the consuming project, the publish step warns and continues without the full-text index (the fuzzy palette still works).
|
|
81
|
+
|
|
82
|
+
## How it works
|
|
83
|
+
|
|
84
|
+
`publish.ts` is small by design — every non-trivial concern lives in one of the boundary packages:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
JSDoc 4 invokes publish(data, opts, tutorials)
|
|
88
|
+
│
|
|
89
|
+
├── setu.generateSite(data, { pkg, readme, tutorials, sources, … }) → SiteManifest
|
|
90
|
+
│ (one MDX page per container + globals + home + tutorials)
|
|
91
|
+
│
|
|
92
|
+
├── dwar.render(manifest, { theme, destination }) → RenderResult
|
|
93
|
+
│ (Preact SSR + esbuild island bundles + CSS)
|
|
94
|
+
│
|
|
95
|
+
├── writeOutputFiles(destination, result.files)
|
|
96
|
+
│ (mkdir -p + writeFile loop; Windows-safe via node:path)
|
|
97
|
+
│
|
|
98
|
+
└── dwar.runPagefindAgainstDir(destination)
|
|
99
|
+
(post-write search index; optional)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The CJS bundle dynamic-`import()`s setu and dwar via `file://` URLs because both are ESM-only with `"type":"module"` while JSDoc 4 loads themes via `require()`. The bridge walks `node_modules` from its own location, so it works regardless of where JSDoc was invoked.
|
|
103
|
+
|
|
104
|
+
See the per-package READMEs for deeper detail:
|
|
105
|
+
|
|
106
|
+
- [`@clean-jsdoc-theme/utils`](../utils) — type contracts and slug rules
|
|
107
|
+
- [`@clean-jsdoc-theme/setu`](../setu) — JSDoc → SiteManifest
|
|
108
|
+
- [`@clean-jsdoc-theme/rang`](../rang) — Preact components + island registry
|
|
109
|
+
- [`@clean-jsdoc-theme/dwar`](../dwar) — SiteManifest → OutputFile[]
|
|
110
|
+
|
|
111
|
+
## End-to-end example
|
|
112
|
+
|
|
113
|
+
[`examples/basic/`](../../examples/basic) is the working reference: a tree of JSDoc-annotated source files in `src/`, tutorials, a `jsdoc.json` exercising the config above, and `pnpm run docs` produces the full `dist/`.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT.
|