clean-jsdoc-theme 4.3.0 → 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.
Files changed (86) hide show
  1. package/README.md +117 -625
  2. package/dist/publish.d.mts +218 -0
  3. package/dist/publish.d.ts +218 -0
  4. package/dist/publish.js +641 -0
  5. package/dist/publish.js.map +1 -0
  6. package/dist/publish.mjs +605 -0
  7. package/dist/publish.mjs.map +1 -0
  8. package/package.json +65 -55
  9. package/.eslintignore +0 -5
  10. package/.eslintrc.js +0 -3
  11. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -43
  12. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -27
  13. package/.github/dependabot.yml +0 -9
  14. package/.github/pull_request_template.md +0 -16
  15. package/.github/workflows/codeql.yml +0 -72
  16. package/.github/workflows/greetings.yml +0 -16
  17. package/.prettierignore +0 -2
  18. package/.prettierrc +0 -5
  19. package/.stylelintignore +0 -4
  20. package/.stylelintrc +0 -18
  21. package/.travis.yml +0 -30
  22. package/CHANGELOG.md +0 -260
  23. package/CODE_OF_CONDUCT.md +0 -76
  24. package/CODE_OF_CONDUCT_HINDI.md +0 -61
  25. package/CONTRIBUTING.md +0 -36
  26. package/LICENSE +0 -21
  27. package/SECURITY.md +0 -21
  28. package/clean-jsdoc-theme-defaults.js +0 -37
  29. package/clean-jsdoc-theme-helper.js +0 -186
  30. package/css-property-order-fix.js +0 -56
  31. package/helpers/Environment.html +0 -3
  32. package/helpers/down-arrow.js +0 -9
  33. package/jsdoc-config.json +0 -102
  34. package/minify.js +0 -72
  35. package/publish.js +0 -1104
  36. package/static/fonts/Inconsolata-Regular.ttf +0 -0
  37. package/static/fonts/OpenSans-Regular.ttf +0 -0
  38. package/static/fonts/WorkSans-Bold.ttf +0 -0
  39. package/static/scripts/core.js +0 -726
  40. package/static/scripts/core.min.js +0 -23
  41. package/static/scripts/resize.js +0 -90
  42. package/static/scripts/search.js +0 -265
  43. package/static/scripts/search.min.js +0 -6
  44. package/static/scripts/third-party/Apache-License-2.0.txt +0 -202
  45. package/static/scripts/third-party/fuse.js +0 -9
  46. package/static/scripts/third-party/hljs-line-num-original.js +0 -369
  47. package/static/scripts/third-party/hljs-line-num.js +0 -1
  48. package/static/scripts/third-party/hljs-original.js +0 -5171
  49. package/static/scripts/third-party/hljs.js +0 -1
  50. package/static/scripts/third-party/popper.js +0 -5
  51. package/static/scripts/third-party/tippy.js +0 -1
  52. package/static/scripts/third-party/tocbot.js +0 -672
  53. package/static/scripts/third-party/tocbot.min.js +0 -1
  54. package/static/styles/clean-jsdoc-theme-base.css +0 -1159
  55. package/static/styles/clean-jsdoc-theme-dark.css +0 -412
  56. package/static/styles/clean-jsdoc-theme-light.css +0 -482
  57. package/static/styles/clean-jsdoc-theme-scrollbar.css +0 -30
  58. package/static/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -1
  59. package/static/styles/clean-jsdoc-theme.min.css +0 -1
  60. package/tmpl/augments.tmpl +0 -10
  61. package/tmpl/container.tmpl +0 -208
  62. package/tmpl/details.tmpl +0 -207
  63. package/tmpl/example.tmpl +0 -3
  64. package/tmpl/examples.tmpl +0 -48
  65. package/tmpl/exceptions.tmpl +0 -32
  66. package/tmpl/icons.tmpl +0 -73
  67. package/tmpl/include-target-script-and-styles.tmpl +0 -43
  68. package/tmpl/layout.tmpl +0 -167
  69. package/tmpl/mainpage.tmpl +0 -10
  70. package/tmpl/members.tmpl +0 -42
  71. package/tmpl/method.tmpl +0 -175
  72. package/tmpl/mobile-sidebar.tmpl +0 -21
  73. package/tmpl/navbar-actions.tmpl +0 -19
  74. package/tmpl/navbar-menu.tmpl +0 -25
  75. package/tmpl/navbar.tmpl +0 -14
  76. package/tmpl/params.tmpl +0 -131
  77. package/tmpl/properties.tmpl +0 -109
  78. package/tmpl/returns.tmpl +0 -19
  79. package/tmpl/search.tmpl +0 -17
  80. package/tmpl/sidebar-items.tmpl +0 -24
  81. package/tmpl/sidebar-title.tmpl +0 -8
  82. package/tmpl/sidebar.tmpl +0 -9
  83. package/tmpl/source.tmpl +0 -13
  84. package/tmpl/toc.tmpl +0 -4
  85. package/tmpl/tutorial.tmpl +0 -32
  86. package/tmpl/type.tmpl +0 -13
package/README.md CHANGED
@@ -1,625 +1,117 @@
1
- # clean-jsdoc-theme
2
-
3
- [![Stars](https://img.shields.io/github/stars/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme) [![Fork](https://img.shields.io/github/forks/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork) ![Version](https://img.shields.io/badge/version-4.3.0-005bff) [![Issues Open](https://img.shields.io/github/issues/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues) [![Contributors](https://img.shields.io/github/contributors/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors) [![license](https://img.shields.io/github/license/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
4
- <br>
5
-
6
- `clean-jsdoc-theme` enhances your JSDoc 3 or 4 documentation with a beautiful and responsive design. It offers a variety of customization options to tailor the look and feel to your preferences.
7
-
8
- ## Key Features
9
-
10
- - **Widespread Device Compatibility:** `clean-jsdoc-theme` adapts seamlessly to desktops, laptops, tablets, and mobile devices, ensuring a smooth user experience across all platforms.
11
- - **Premium Aesthetics:** Choose between a sleek dark theme or a bright light theme, both designed to deliver a high-quality appearance for your documentation.
12
- - **Optimized File Size:** `clean-jsdoc-theme` automatically minifies the generated HTML files, reducing their overall size by several kilobytes without compromising functionality.
13
- - **Robust Search Functionality:** The built-in search feature allows users to quickly find specific information within your documentation, and it does so without adding extra weight to the output files.
14
- - **Regular Updates:** We actively maintain `clean-jsdoc-theme`, ensuring it remains up-to-date and compatible with the latest technologies.
15
- - **Exceptional Performance:** `clean-jsdoc-theme` prioritizes performance, delivering a fast and responsive user experience for your documentation consumers. You can view the [Lighthouse report](https://googlechrome.github.io/lighthouse/viewer/?psiurl=https%3A%2F%2Fankdev.me%2Fclean-jsdoc-theme%2Fv4%2Findex.html&strategy=desktop&category=performance&category=accessibility&category=best-practices&category=seo&category=pwa&utm_source=lh-chrome-ext#) for a detailed performance analysis.
16
- - **Open Communication:** The `clean-jsdoc-theme` team acknowledges that continuous improvement is essential. We welcome feedback from the community, so feel free to share your suggestions, questions, or bug reports by creating an issue on [GitHub](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues).
17
-
18
-
19
- ## Demo
20
-
21
- 1. To view this theme, visit [https://ankdev.me/clean-jsdoc-theme/v4](https://ankdev.me/clean-jsdoc-theme/v4).
22
-
23
- 2. If you want to see a demo repo to set up this theme,
24
- visit [clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example). This repo will guide
25
- you step by step on how to set up JSDoc and `clean-jsdoc-theme` in your existing repo.
26
-
27
- ## Screenshots
28
-
29
- ![Dark theme](./example/screen-1.png)
30
- ![Light theme](./example/screen-2.png)
31
- ![Mobile View](./example/screen-3.png)
32
- ![Search view](./example/screen-4.png)
33
- ![Class page](./example/screen-5.png)
34
- ![Code page](./example/screen-6.png)
35
-
36
- ## Installation
37
-
38
- > Note : you must have `node` and `npm` installed on your machine.
39
-
40
- In a terminal, type :
41
-
42
- ```bash
43
- npm install clean-jsdoc-theme --save-dev
44
- # or
45
- yarn add clean-jsdoc-theme -D
46
- ```
47
-
48
- In your projects `package.json` file, add a script to generate the documentation using JSDoc :
49
-
50
- ```json
51
- "scripts": {
52
- "generate-docs": "jsdoc --configure jsdoc.json --verbose"
53
- }
54
- ```
55
-
56
- > Heads Up! In the above `generate_docs` script, the value of the `--configure` option is `jsdoc.json`. Make sure
57
- > the `jsdoc.json` file exists as it contains the JSDoc configuration. If you have your JSDoc config in a different
58
- > file,
59
- > replace `jsdoc.json` with its name.
60
-
61
- In your `jsdoc.json` file, add a template option to use `clean-jsdoc-theme` instead of the default JSDoc theme:
62
-
63
- ```json
64
- "opts": {
65
- "template": "node_modules/clean-jsdoc-theme"
66
- }
67
- ```
68
-
69
- Now, run the previously added script to generate the documentation :
70
-
71
- ```bash
72
- npm run generate-docs
73
- ```
74
-
75
- For more information, look at the [clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example)
76
- repository.
77
-
78
- ## Example JSDoc Config
79
-
80
- ```json
81
- {
82
- "source": {
83
- "include": ["lib", "package.json", "README.md"],
84
- "includePattern": ".js$",
85
- "excludePattern": "(node_modules/|docs)"
86
- },
87
- "plugins": ["plugins/markdown"],
88
- "opts": {
89
- "encoding": "utf8",
90
- "readme": "./README.md",
91
- "destination": "docs/",
92
- "recurse": true,
93
- "verbose": true,
94
- "template": "./node_modules/clean-jsdoc-theme",
95
- "theme_opts": {
96
- "default_theme": "dark"
97
- }
98
- },
99
- "markdown": {
100
- "hardwrap": false,
101
- "idInHeadings": true
102
- // This is important for clean-jsdoc-theme, otherwise some features might not work.
103
- }
104
- }
105
- ```
106
-
107
- ## Options
108
-
109
- ### Set a default theme
110
-
111
- To set the default theme, add the following in your JSDoc config file:
112
-
113
- ```json
114
- "theme_opts": {
115
- "default_theme": "dark" // "light", "fallback-dark", "fallback-light"
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.