clean-jsdoc-theme 3.2.8 → 3.3.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 (59) hide show
  1. package/.eslintignore +4 -4
  2. package/.eslintrc.js +3 -3
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +43 -43
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +27 -27
  5. package/.github/pull_request_template.md +16 -16
  6. package/.github/workflows/codeql-analysis.yml +67 -67
  7. package/.prettierignore +2 -2
  8. package/.prettierrc +5 -5
  9. package/.stylelintignore +3 -3
  10. package/.stylelintrc +23 -23
  11. package/.travis.yml +30 -30
  12. package/CHANGELOG.md +210 -191
  13. package/CODE_OF_CONDUCT.md +76 -76
  14. package/CODE_OF_CONDUCT_HINDI.md +46 -46
  15. package/CONTRIBUTING.md +24 -24
  16. package/LICENSE +21 -21
  17. package/README.md +535 -500
  18. package/SECURITY.md +21 -21
  19. package/helpers/down-arrow.js +9 -9
  20. package/jsdoc-config.json +60 -59
  21. package/package.json +46 -46
  22. package/publish.js +1195 -941
  23. package/static/fonts/Montserrat-Regular.ttf +0 -0
  24. package/static/fonts/OFL-hind.txt +0 -0
  25. package/static/fonts/OFL-montserrat.txt +0 -0
  26. package/static/scripts/fix-code-block.js +53 -53
  27. package/static/scripts/fix-navbar.js +25 -25
  28. package/static/scripts/linenumber.js +25 -25
  29. package/static/scripts/misc.js +217 -210
  30. package/static/scripts/resize.js +85 -85
  31. package/static/scripts/search.js +83 -83
  32. package/static/scripts/third-party/Apache-License-2.0.txt +202 -202
  33. package/static/scripts/third-party/fuse.js +8 -8
  34. package/static/scripts/third-party/lang-css.js +2 -2
  35. package/static/scripts/third-party/prettify.js +28 -28
  36. package/static/styles/clean-jsdoc-theme-base.css +393 -393
  37. package/static/styles/clean-jsdoc-theme-dark.css +324 -324
  38. package/static/styles/clean-jsdoc-theme-light.css +319 -319
  39. package/static/styles/reset.css +351 -346
  40. package/static/styles/third-party/ionicons.min.css +11 -11
  41. package/static/styles/third-party/prettify-jsdoc.css +111 -111
  42. package/static/styles/third-party/prettify-tomorrow.css +5 -5
  43. package/tmpl/augments.tmpl +10 -10
  44. package/tmpl/container.tmpl +189 -189
  45. package/tmpl/details.tmpl +208 -209
  46. package/tmpl/example.tmpl +3 -3
  47. package/tmpl/examples.tmpl +38 -38
  48. package/tmpl/exceptions.tmpl +32 -32
  49. package/tmpl/icons.tmpl +34 -34
  50. package/tmpl/layout.tmpl +171 -167
  51. package/tmpl/mainpage.tmpl +10 -10
  52. package/tmpl/members.tmpl +43 -43
  53. package/tmpl/method.tmpl +140 -140
  54. package/tmpl/params.tmpl +124 -124
  55. package/tmpl/properties.tmpl +109 -109
  56. package/tmpl/returns.tmpl +18 -18
  57. package/tmpl/source.tmpl +7 -7
  58. package/tmpl/tutorial.tmpl +19 -19
  59. package/tmpl/type.tmpl +6 -6
package/README.md CHANGED
@@ -1,500 +1,535 @@
1
- <hr>
2
- <h1 align="center">clean-jsdoc-theme</h1>
3
- <p align=center><i align="center">A beautiful, responsive, customizable theme for JSDoc</i></p>
4
- <hr>
5
-
6
- [![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-3.2.8-%23007bff) [![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) [![Build Status](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme.svg?branch=production)](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [![license](https://img.shields.io/github/license/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
7
- <br>
8
-
9
- Clean-jsdoc-theme is a beautifully crafted theme/template for JSDoc 3. This theme/template looks and feels like a premium theme/template as it's mobile responsive and also highly customizable. For more options [look below at the options section](#options).
10
-
11
- For any suggestions, questions or bugs, feel free to create an <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/issues">issue</a> in this repo.
12
-
13
- ## Demo
14
-
15
- Live demo (dark): <a href="https://ankdev.me/clean-jsdoc-theme/dark/index.html">https://ankdev.me/clean-jsdoc-theme/dark/index.html</a> <br>
16
- Live demo (light): <a href="https://ankdev.me/clean-jsdoc-theme/light/index.html">https://ankdev.me/clean-jsdoc-theme/light/index.html</a>
17
-
18
- #### Screenshot
19
-
20
- ![Screen-1](./example/screen-1.png)
21
- ![Screen-2](./example/screen-2.png)
22
- ![Screen-3](./example/screen-3.png)
23
- ![Screen-4](./example/screen-4.png)
24
- ![Screen-5](./example/screen-5.png)
25
- ![Screen-6](./example/screen-6.png)
26
-
27
- ## Libraries Used
28
-
29
- 1. [Fuse.js](https://fusejs.io/) - Fuse.js is a powerful, lightweight fuzzy-search library, with zero dependencies.
30
- 1. [Overlay Scrollbars](https://kingsora.github.io/OverlayScrollbars/#!overview) - A javascript scrollbar plugin which hides native scrollbars, provides
31
- custom styleable overlay scrollbars and keeps the native functionality and feeling of native scrollbars.
32
-
33
- ## Motivation
34
-
35
- When I was new to JavaScript documentation and [JSDoc](https://jsdoc.app/), it was hard for me to find a theme for JSDoc which was highly customizable or regularly maintained. Features that these lacked included responsiveness, a working search bar, and customization.
36
- To tackle these problems I created this project, an easy to use, responsive theme for JSDoc. I am actively working on this project and I try to make changes to the project frequently to make sure it's up to date, and suggestions and bugs are fixed.
37
-
38
- ## Installation
39
-
40
- > Note you must have `npm` installed on your machine.
41
-
42
- On your command line type
43
-
44
- ```bash
45
- npm install clean-jsdoc-theme
46
- ```
47
-
48
- ## Usage
49
-
50
- Clone repository to your designated JSDoc template directory, then run the following command:
51
-
52
- ```bash
53
- jsdoc entry-file.js -t path/to/clean-jsdoc-theme
54
- ```
55
-
56
- ## Node.js Dependency
57
-
58
- In your projects `package.json` file add a generate script
59
-
60
- ```json
61
- "script": {
62
- "generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
63
- }
64
- ```
65
-
66
- In your `jsdoc.json` file, add a template option.
67
-
68
- ```json
69
- "opts": {
70
- "template": "node_modules/clean-jsdoc-theme"
71
- }
72
- ```
73
-
74
- ## Example JSDoc Config
75
-
76
- ```json
77
- {
78
- "source": {
79
- "include": ["lib", "package.json", "README.md"],
80
- "includePattern": ".js$",
81
- "excludePattern": "(node_modules/|docs)"
82
- },
83
-
84
- "plugins": ["plugins/markdown"],
85
-
86
- "opts": {
87
- "encoding": "utf8",
88
- "readme": "./README.md",
89
- "destination": "docs/",
90
- "recurse": true,
91
- "verbose": true,
92
- "template": "./node_modules/clean-jsdoc-theme",
93
- "theme_opts": {
94
- "theme": "dark"
95
- }
96
- }
97
- }
98
- ```
99
-
100
- ## Options
101
-
102
- To use custom options (such as light and dark modes), pass an object called `theme_opts` in your config file under `opts`.
103
-
104
- ### `theme : "light" | "dark"`
105
-
106
- To set the overall theme of the documentation file(s). Currently there is only two variant `"light"` and `"dark"` but in future I will try to add more.
107
- `Default value is "light"`
108
-
109
- ### `title: string | HTML`
110
-
111
- This option sets the title of the document in the navbar. Both strings and HTML are accepted; use HTML to overwrite the default HTML, and a string to set a plaintext title. One example of this is below:
112
-
113
- ```json
114
- "title": "<img src='path/to/img' class='my-custom-class'/>"
115
- ```
116
-
117
- You can use `static_dir` to copy all you static files to output dir and use that path in place of `path/to/img`. For more details look `static_dir` section.
118
-
119
- ### `menu: Array<{}>`
120
-
121
- This options allows rendering of extra link(s) in navbar to the side of the documentation. It accepts an array of objects, such as in the following example example:
122
-
123
- ```json
124
- "menu" : [
125
- {
126
- "title": "Website",
127
- "link": "https://ankdev.me/clean-jsdoc-theme/dark/",
128
- "target": "_blank",
129
- "class": "some-class",
130
- "id": "some-id"
131
- }
132
- ]
133
- ```
134
-
135
- #### Required properties
136
-
137
- | name | type |
138
- | ------- | -------- |
139
- | `title` | `string` |
140
- | `link` | `string` |
141
-
142
- #### Optional Properties
143
-
144
- | name | type |
145
- | -------- | -------- |
146
- | `target` | `string` |
147
- | `class` | `string` |
148
- | `id` | `string` |
149
-
150
- ### `menuLocation: "up" | "down"`
151
-
152
- This options allows to adjust the location of the menu items listed in `menu` array, either at the top or at the bottom among all navbar items. `Default value is "up".`
153
-
154
- ### `meta: Array<{}>`
155
-
156
- A list of `meta` tag attributes to add to the `head` of each page.
157
-
158
- ```json
159
- "meta" : [
160
- {
161
- "name": "author",
162
- "content": "Ankit Kumar"
163
- },
164
- {
165
- "name": "description",
166
- "content": "Best Clean and minimal JSDoc 3 Template/Theme"
167
- }
168
- ]
169
- ```
170
-
171
- #### Properties
172
-
173
- Any valid combination of [HTML metadata attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes).
174
-
175
- ### `search: {}`
176
-
177
- To render search. Default value:
178
-
179
- ```json
180
- "search": {
181
- "shouldSort": true,
182
- "threshold": 0.4,
183
- "location": 0,
184
- "distance": 100,
185
- "maxPatternLength": 32,
186
- "minMatchCharLength": 1,
187
- }
188
- ```
189
-
190
- If you don't want to render search box then do the following:
191
-
192
- ```json
193
- "search" false
194
- ```
195
-
196
- #### Properties
197
-
198
- Any valid [fuse.js properties](https://fusejs.io/api/options.html)
199
-
200
- ### `overlay_scrollbar: {}`
201
-
202
- Includes the OverlayScrollbars plugin. Simply passing an empty object will activate this feature.
203
-
204
- ```json
205
- "overlay_scrollbar": {
206
- "option": {}
207
- }
208
- ```
209
-
210
- #### Properties
211
-
212
- Any valid [overlay scrollbar properties](https://kingsora.github.io/OverlayScrollbars/#!documentation/options)
213
-
214
- ### `resizeable: {}`
215
-
216
- This will make certain element in DOM resizeable. Currently we only support navbar to be resizeable. By default navbar is not resizeable. To make navbar resizeable you have to do the following:
217
-
218
- ```json
219
- "resizeable": {
220
- "navbar": {
221
- "min": "300",
222
- "max": "600"
223
- }
224
- }
225
- ```
226
-
227
- Don't include any unit. Also, units of max and min is inferred in `px`.
228
-
229
- > Note: Navbar is not resizeable on mobile/small screens.
230
- > If you don't want to give min and max value and want to use the default values then pass empty object.
231
-
232
- ```json
233
- "resizeable": {
234
- "navbar": {}
235
- }
236
- ```
237
-
238
- If you didn't pass any thing in navbar then navbar is not resizeable.
239
-
240
- ### `codepen: {}`
241
-
242
- This will add a link to the codepen with prefilled data.
243
-
244
- > Note: Currently this feature is only enabled for examples section.
245
-
246
- ```json
247
- "codepen": {
248
- "enable_for": ["examples"],
249
- "options": {
250
- "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
251
- "js_pre_processor": "babel"
252
- }
253
- }
254
- ```
255
-
256
- `options` can be any valid codepen options. For more visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
257
- if you want default behaviour then don't pass anything in options.
258
-
259
- ### `create_style: string`
260
-
261
- To create custom style rules. Example:
262
-
263
- ```json
264
- "create_style": "nav{background: yellow} footer {background: green}"
265
- ```
266
-
267
- Here the nav and footer style rule is to attached to the HTML's `style` tag.
268
-
269
- ### `add_scripts: string`
270
-
271
- To create custom scripts. Example:
272
-
273
- ```json
274
- "create_style": "function foo(){console.log('foo')} function bar() {console.log('bar')}"
275
- ```
276
-
277
- Here the script is to attached to the HTML's `script` tag.
278
-
279
- ### `add_style_path: Array<{}>`
280
-
281
- Use this option to add third party css library.
282
-
283
- > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you link tag.
284
-
285
- Example:
286
-
287
- ```json
288
- "add_style_path": [
289
- {
290
- "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
291
- "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
292
- "crossorigin": "anonymous"
293
- }
294
- ],
295
- ```
296
-
297
- #### Properties
298
-
299
- Any valid [style tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
300
-
301
- ### `add_script_path: Array<{}>`
302
-
303
- Use this option to add third party js library.
304
-
305
- > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you script tag.
306
-
307
- Example:
308
-
309
- ```json
310
- "add_script_path": [
311
- {
312
- "href": "https://code.jquery.com/jquery-3.5.1.js",
313
- "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
314
- "crossorigin": "anonymous"
315
- }
316
- ],
317
- ```
318
-
319
- ### Properties
320
-
321
- Any valid [script tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
322
-
323
- ### `footer: string | HTML`
324
-
325
- Thing which you want to render as the footer. You can either pass a string or HTML.
326
- Use HTML to overwrite the default HTML.
327
-
328
- ```json
329
- "footer": "This is footer"
330
- ```
331
-
332
- ### `static_dir: Array<string>`
333
-
334
- To include static files. Example:
335
-
336
- ```json
337
- "static_dir": ["./static"],
338
- ```
339
-
340
- This will copy the static folder to the output dir.
341
-
342
- > Note: If the directory doesn't exists then you may get an error. Also directory is relative to your jsdoc config file.
343
-
344
- This will not flatten then directory it keep the directory structure as it is.
345
-
346
- ### `include_css: Array<string>`
347
-
348
- To include css files. Example:
349
-
350
- ```json
351
- "include_css": ["./static/index.css", "./src/docs/index.css"]
352
- ```
353
-
354
- > Note: You are not required to manually copy file to output dir
355
-
356
- It will include the css files to the output dir and also attach a link tag to the html pointing to the included css file.
357
-
358
- ### `include_js: Array<string>`
359
-
360
- To include js files. Example:
361
-
362
- ```json
363
- "include_js": ["./static/index.js", "./src/docs/index.js"]
364
- ```
365
-
366
- > Note: You are not required to manually copy file to output dir
367
-
368
- It will include the js files to the output dir and also attach a script tag to the html pointing to the included js file.
369
-
370
- ### Example `theme_opts`
371
-
372
- ```json
373
- "opts":{
374
- "theme_opts":{
375
- "theme": "dark",
376
- "title": "clean-jsdoc-theme",
377
- "menu": [
378
- {
379
- "title": "Website",
380
- "link": "https://ankdev.me/clean-jsdoc-theme/index.html",
381
- "target": "_blank",
382
- "class": "some-class",
383
- "id": "some-id"
384
- },
385
- {
386
- "title": "Github",
387
- "link": "https://github.com/ankitskvmdam/clean-jsdoc-theme/",
388
- "target": "_blank",
389
- "class": "some-class",
390
- "id": "some-id"
391
- }
392
- ],
393
-
394
- "meta": [
395
- {
396
- "name": "author",
397
- "content": "Ankit Kumar"
398
- },
399
- {
400
- "name": "description",
401
- "content": "Best Clean and minimal JSDoc 3 Template/Theme"
402
- }
403
- ],
404
- "search": {},
405
- "create_style": "nav{background: yellow}",
406
- "add_style_path": [
407
- {
408
- "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
409
- "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
410
- "crossorigin": "anonymous"
411
- }
412
- ],
413
- "add_scripts": "function foo(){console.log('foo')}",
414
- "add_script_path": [
415
- {
416
- "src": "https://code.jquery.com/jquery-3.5.1.js",
417
- "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
418
- "crossorigin": "anonymous"
419
- }
420
- ],
421
-
422
- "footer": "This is footer",
423
- "static_dir": ["./static"],
424
- "include_css": ["./static/index.css", "./src/docs/index.css"],
425
- "include_js": ["./static/main.js", "./third-party/test/index.js"],
426
-
427
- "overlay_scrollbar": {
428
- "options": {
429
- }
430
- },
431
- "resizeable": {
432
- "navbar": {
433
- "min": "300",
434
- "max": "600"
435
- }
436
- },
437
- "codepen": {
438
- "enable_for": ["examples"],
439
- "options": {
440
- "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
441
- "js_pre_processor": "babel"
442
- }
443
- }
444
- }
445
- }
446
- ```
447
-
448
- ### Cheat sheet
449
-
450
- | name | default | use case | expected value(s) |
451
- | ------------------- | --------- | ----------------------------------- | ------------------------- |
452
- | `theme` | `"light"` | To set the theme variant | `"light" or "dark"` |
453
- | `title` | `null` | To set the title | `HTML` or `string` |
454
- | `menu` | `null` | To render extra link in navbar | Array of Object(s) |
455
- | `meta` | `null` | Meta tag attributes | Array of Object(s) |
456
- | `search` | `{}` | To render search or not | Fuse.js options |
457
- | `resizeable` | `{}` | To make certain element resizeable | `Object` |
458
- | `codepen` | `{}` | To open code in codepen | `Object` |
459
- | `create_style` | `null` | To create custom style rules | `string` |
460
- | `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
461
- | `add_scripts` | `null` | To create custom script | `string` |
462
- | `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
463
- | `footer` | `null` | To render footer | `HTML` or `string` |
464
- | `static_dir` | `null` | To include static dir | Array of string |
465
- | `include_css` | `null` | To include css files | Array of string |
466
- | `include_js` | `null` | To include js files | `string` |
467
- | `overlay_scrollbar` | `null` | To use overlay scrollbar | Overlay Scrollbar options |
468
-
469
- ## Changelog
470
-
471
- Changelog is moved to [https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CHANGELOG.md](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CHANGELOG.md)
472
-
473
- ## Developing
474
-
475
- Before starting please go through our [contributing guide](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CONTRIBUTING.md).
476
-
477
- ```bash
478
- git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git
479
- cd clean-jsdoc-theme
480
- npm install
481
- npm install jsdoc --no-save
482
- npm run test
483
- ```
484
-
485
- `npm run test` will generate files in output folder.
486
-
487
- ## Contributors
488
-
489
- <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
490
- <img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" />
491
- </a>
492
-
493
- ## Contact
494
-
495
- If you like my work, then give me a <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme" data-icon="octicon-star" aria-label="Star ankitskvmdam/clean-jsdoc-theme on GitHub">star</a>. This will act as a driving force to add new feature more frequently. <br>
496
- Mail me at: <a href="mailto:hello@ankdev.me">hello@ankdev.me</a> <br>
497
-
498
- ## License
499
-
500
- Licensed under the MIT license.
1
+ <hr>
2
+ <h1 align="center">clean-jsdoc-theme</h1>
3
+ <p align=center><i align="center">A beautiful, responsive, customizable theme for JSDoc</i></p>
4
+ <hr>
5
+
6
+ [![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-3.3.1-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) [![Build Status](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme.svg?branch=production)](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [![license](https://img.shields.io/github/license/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
7
+ <br>
8
+
9
+ Clean-jsdoc-theme is a beautifully crafted theme/template for JSDoc 3. This theme/template looks and feels like a premium theme/template as it's mobile responsive and also highly customizable. For more options [look below at the options section](#options).
10
+
11
+ For any suggestions, questions or bugs, feel free to create an <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/issues">issue</a> in this repo.
12
+
13
+ ## Demo
14
+
15
+ 1. Live demo (dark): <a href="https://ankdev.me/clean-jsdoc-theme/dark/index.html">https://ankdev.me/clean-jsdoc-theme/dark/index.html</a> <br>
16
+ 1. Live demo (light): <a href="https://ankdev.me/clean-jsdoc-theme/light/index.html">https://ankdev.me/clean-jsdoc-theme/light/index.html</a>
17
+
18
+ ## Examples
19
+
20
+ 1. [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example) - This repo will give an overview of how to setup clean-jsdoc-theme.
21
+
22
+ #### Screenshot
23
+
24
+ ![Screen-1](./example/screen-1.png)
25
+ ![Screen-2](./example/screen-2.png)
26
+ ![Screen-3](./example/screen-3.png)
27
+ ![Screen-4](./example/screen-4.png)
28
+ ![Screen-5](./example/screen-5.png)
29
+ ![Screen-6](./example/screen-6.png)
30
+
31
+ ## Libraries Used
32
+
33
+ 1. [Fuse.js](https://fusejs.io/) - Fuse.js is a powerful, lightweight fuzzy-search library, with zero dependencies.
34
+ 1. [Overlay Scrollbars](https://kingsora.github.io/OverlayScrollbars/#!overview) - A javascript scrollbar plugin which hides native scrollbars, provides
35
+ custom styleable overlay scrollbars and keeps the native functionality and feeling of native scrollbars.
36
+
37
+ ## Motivation
38
+
39
+ When I was new to JavaScript documentation and [JSDoc](https://jsdoc.app/), it was hard for me to find a theme for JSDoc which was highly customizable or regularly maintained. Features that these lacked included responsiveness, a working search bar, and customization.
40
+ To tackle these problems I created this project, an easy to use, responsive theme for JSDoc. I am actively working on this project and I try to make changes to the project frequently to make sure it's up to date, and suggestions and bugs are fixed.
41
+
42
+ ## Installation
43
+
44
+ > Note you must have `npm` installed on your machine.
45
+
46
+ On your command line type
47
+
48
+ ```bash
49
+ npm install clean-jsdoc-theme
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ Clone repository to your designated JSDoc template directory, then run the following command:
55
+
56
+ ```bash
57
+ jsdoc entry-file.js -t path/to/clean-jsdoc-theme
58
+ ```
59
+
60
+ ## Node.js Dependency
61
+
62
+ In your projects `package.json` file add a generate script
63
+
64
+ ```json
65
+ "script": {
66
+ "generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
67
+ }
68
+ ```
69
+
70
+ In your `jsdoc.json` file, add a template option.
71
+
72
+ ```json
73
+ "opts": {
74
+ "template": "node_modules/clean-jsdoc-theme"
75
+ }
76
+ ```
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
+
88
+ "plugins": ["plugins/markdown"],
89
+
90
+ "opts": {
91
+ "encoding": "utf8",
92
+ "readme": "./README.md",
93
+ "destination": "docs/",
94
+ "recurse": true,
95
+ "verbose": true,
96
+ "template": "./node_modules/clean-jsdoc-theme",
97
+ "theme_opts": {
98
+ "theme": "dark"
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ ## Options
105
+
106
+ To use custom options (such as light and dark modes), pass an object called `theme_opts` in your config file under `opts`.
107
+
108
+ ### `theme : "light" | "dark"`
109
+
110
+ To set the overall theme of the documentation file(s). Currently there is only two variant `"light"` and `"dark"` but in future I will try to add more.
111
+ `Default value is "light"`
112
+
113
+ ### `favicon: string`
114
+
115
+ This option sets the favicon of the document. It accepts strings defining the path of the icon.
116
+
117
+ ```json
118
+ "favion": "path/to/img"
119
+ ```
120
+
121
+ You can use `static_dir` to copy all you static files to output dir and use that path in place of `path/to/img`. For more details look `static_dir` section.
122
+
123
+ ### `title: string | HTML`
124
+
125
+ This option sets the title of the document in the navbar. Both strings and HTML are accepted; use HTML to overwrite the default HTML, and a string to set a plaintext title. One example of this is below:
126
+
127
+ ```json
128
+ "title": "<img src='path/to/img' class='my-custom-class'/>"
129
+ ```
130
+
131
+ You can use `static_dir` to copy all you static files to output dir and use that path in place of `path/to/img`. For more details look `static_dir` section.
132
+
133
+ ### `menu: Array<{}>`
134
+
135
+ This options allows rendering of extra link(s) in navbar to the side of the documentation. It accepts an array of objects, such as in the following example example:
136
+
137
+ ```json
138
+ "menu" : [
139
+ {
140
+ "title": "Website",
141
+ "link": "https://ankdev.me/clean-jsdoc-theme/dark/",
142
+ "target": "_blank",
143
+ "class": "some-class",
144
+ "id": "some-id"
145
+ }
146
+ ]
147
+ ```
148
+
149
+ #### Required properties
150
+
151
+ | name | type |
152
+ | ------- | -------- |
153
+ | `title` | `string` |
154
+ | `link` | `string` |
155
+
156
+ #### Optional Properties
157
+
158
+ | name | type |
159
+ | -------- | -------- |
160
+ | `target` | `string` |
161
+ | `class` | `string` |
162
+ | `id` | `string` |
163
+
164
+ ### `sections: Array<SECTION_TYPE>`
165
+
166
+ This can be used to order the navbar sections. This can also be used to hide/remove any section.
167
+
168
+ ```js
169
+ // SECTION_TYPE
170
+ [
171
+ 'Classes',
172
+ 'Modules',
173
+ 'Externals',
174
+ 'Events',
175
+ 'Namespaces',
176
+ 'Mixins',
177
+ 'Tutorials',
178
+ 'Interfaces',
179
+ 'Global',
180
+ 'Menu',
181
+ ];
182
+ ```
183
+
184
+ ```json5
185
+ "sections": ["Classes", "Modules", "Global", "Menu"] // Only 4 members will be in the navbar.
186
+ ```
187
+
188
+ ### `meta: Array<{}>`
189
+
190
+ A list of `meta` tag attributes to add to the `head` of each page.
191
+
192
+ ```json
193
+ "meta" : [
194
+ {
195
+ "name": "author",
196
+ "content": "Ankit Kumar"
197
+ },
198
+ {
199
+ "name": "description",
200
+ "content": "Best Clean and minimal JSDoc 3 Template/Theme"
201
+ }
202
+ ]
203
+ ```
204
+
205
+ #### Properties
206
+
207
+ Any valid combination of [HTML metadata attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes).
208
+
209
+ ### `search: {}`
210
+
211
+ To render search. Default value:
212
+
213
+ ```json
214
+ "search": {
215
+ "shouldSort": true,
216
+ "threshold": 0.4,
217
+ "location": 0,
218
+ "distance": 100,
219
+ "maxPatternLength": 32,
220
+ "minMatchCharLength": 1,
221
+ }
222
+ ```
223
+
224
+ If you don't want to render search box then do the following:
225
+
226
+ ```json
227
+ "search" false
228
+ ```
229
+
230
+ #### Properties
231
+
232
+ Any valid [fuse.js properties](https://fusejs.io/api/options.html)
233
+
234
+ ### `overlay_scrollbar: {}`
235
+
236
+ Includes the OverlayScrollbars plugin. Simply passing an empty object will activate this feature.
237
+
238
+ ```json
239
+ "overlay_scrollbar": {
240
+ "option": {}
241
+ }
242
+ ```
243
+
244
+ #### Properties
245
+
246
+ Any valid [overlay scrollbar properties](https://kingsora.github.io/OverlayScrollbars/#!documentation/options)
247
+
248
+ ### `resizeable: {}`
249
+
250
+ This will make certain element in DOM resizeable. Currently we only support navbar to be resizeable. By default navbar is not resizeable. To make navbar resizeable you have to do the following:
251
+
252
+ ```json
253
+ "resizeable": {
254
+ "navbar": {
255
+ "min": "300",
256
+ "max": "600"
257
+ }
258
+ }
259
+ ```
260
+
261
+ Don't include any unit. Also, units of max and min is inferred in `px`.
262
+
263
+ > Note: Navbar is not resizeable on mobile/small screens.
264
+ > If you don't want to give min and max value and want to use the default values then pass empty object.
265
+
266
+ ```json
267
+ "resizeable": {
268
+ "navbar": {}
269
+ }
270
+ ```
271
+
272
+ If you didn't pass any thing in navbar then navbar is not resizeable.
273
+
274
+ ### `codepen: {}`
275
+
276
+ This will add a link to the codepen with prefilled data.
277
+
278
+ > Note: Currently this feature is only enabled for examples section.
279
+
280
+ ```json
281
+ "codepen": {
282
+ "enable_for": ["examples"],
283
+ "options": {
284
+ "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
285
+ "js_pre_processor": "babel"
286
+ }
287
+ }
288
+ ```
289
+
290
+ `options` can be any valid codepen options. For more visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
291
+ if you want default behaviour then don't pass anything in options.
292
+
293
+ ### `create_style: string`
294
+
295
+ To create custom style rules. Example:
296
+
297
+ ```json
298
+ "create_style": "nav{background: yellow} footer {background: green}"
299
+ ```
300
+
301
+ Here the nav and footer style rule is to attached to the HTML's `style` tag.
302
+
303
+ ### `add_scripts: string`
304
+
305
+ To create custom scripts. Example:
306
+
307
+ ```json
308
+ "create_style": "function foo(){console.log('foo')} function bar() {console.log('bar')}"
309
+ ```
310
+
311
+ Here the script is to attached to the HTML's `script` tag.
312
+
313
+ ### `add_style_path: Array<{}>`
314
+
315
+ Use this option to add third party css library.
316
+
317
+ > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you link tag.
318
+
319
+ Example:
320
+
321
+ ```json
322
+ "add_style_path": [
323
+ {
324
+ "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
325
+ "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
326
+ "crossorigin": "anonymous"
327
+ }
328
+ ],
329
+ ```
330
+
331
+ #### Properties
332
+
333
+ Any valid [style tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
334
+
335
+ ### `add_script_path: Array<{}>`
336
+
337
+ Use this option to add third party js library.
338
+
339
+ > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you script tag.
340
+
341
+ Example:
342
+
343
+ ```json
344
+ "add_script_path": [
345
+ {
346
+ "href": "https://code.jquery.com/jquery-3.5.1.js",
347
+ "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
348
+ "crossorigin": "anonymous"
349
+ }
350
+ ],
351
+ ```
352
+
353
+ ### Properties
354
+
355
+ Any valid [script tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
356
+
357
+ ### `footer: string | HTML`
358
+
359
+ Thing which you want to render as the footer. You can either pass a string or HTML.
360
+ Use HTML to overwrite the default HTML.
361
+
362
+ ```json
363
+ "footer": "This is footer"
364
+ ```
365
+
366
+ ### `static_dir: Array<string>`
367
+
368
+ To include static files. Example:
369
+
370
+ ```json
371
+ "static_dir": ["./static"],
372
+ ```
373
+
374
+ This will copy the static folder to the output dir.
375
+
376
+ > Note: If the directory doesn't exists then you may get an error. Also directory is relative to your jsdoc config file.
377
+
378
+ This will not flatten then directory it keep the directory structure as it is.
379
+
380
+ ### `include_css: Array<string>`
381
+
382
+ To include css files. Example:
383
+
384
+ ```json
385
+ "include_css": ["./static/index.css", "./src/docs/index.css"]
386
+ ```
387
+
388
+ > Note: You are not required to manually copy file to output dir
389
+
390
+ It will include the css files to the output dir and also attach a link tag to the html pointing to the included css file.
391
+
392
+ ### `include_js: Array<string>`
393
+
394
+ To include js files. Example:
395
+
396
+ ```json
397
+ "include_js": ["./static/index.js", "./src/docs/index.js"]
398
+ ```
399
+
400
+ > Note: You are not required to manually copy file to output dir
401
+
402
+ It will include the js files to the output dir and also attach a script tag to the html pointing to the included js file.
403
+
404
+ ### Example `theme_opts`
405
+
406
+ ```json
407
+ "opts":{
408
+ "theme_opts":{
409
+ "theme": "dark",
410
+ "title": "clean-jsdoc-theme",
411
+ "menu": [
412
+ {
413
+ "title": "Website",
414
+ "link": "https://ankdev.me/clean-jsdoc-theme/index.html",
415
+ "target": "_blank",
416
+ "class": "some-class",
417
+ "id": "some-id"
418
+ },
419
+ {
420
+ "title": "Github",
421
+ "link": "https://github.com/ankitskvmdam/clean-jsdoc-theme/",
422
+ "target": "_blank",
423
+ "class": "some-class",
424
+ "id": "some-id"
425
+ }
426
+ ],
427
+
428
+ "meta": [
429
+ {
430
+ "name": "author",
431
+ "content": "Ankit Kumar"
432
+ },
433
+ {
434
+ "name": "description",
435
+ "content": "Best Clean and minimal JSDoc 3 Template/Theme"
436
+ }
437
+ ],
438
+ "search": {},
439
+ "create_style": "nav{background: yellow}",
440
+ "add_style_path": [
441
+ {
442
+ "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
443
+ "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
444
+ "crossorigin": "anonymous"
445
+ }
446
+ ],
447
+ "add_scripts": "function foo(){console.log('foo')}",
448
+ "add_script_path": [
449
+ {
450
+ "src": "https://code.jquery.com/jquery-3.5.1.js",
451
+ "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
452
+ "crossorigin": "anonymous"
453
+ }
454
+ ],
455
+
456
+ "footer": "This is footer",
457
+ "static_dir": ["./static"],
458
+ "include_css": ["./static/index.css", "./src/docs/index.css"],
459
+ "include_js": ["./static/main.js", "./third-party/test/index.js"],
460
+
461
+ "overlay_scrollbar": {
462
+ "options": {
463
+ }
464
+ },
465
+ "resizeable": {
466
+ "navbar": {
467
+ "min": "300",
468
+ "max": "600"
469
+ }
470
+ },
471
+ "codepen": {
472
+ "enable_for": ["examples"],
473
+ "options": {
474
+ "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
475
+ "js_pre_processor": "babel"
476
+ }
477
+ }
478
+ }
479
+ }
480
+ ```
481
+
482
+ ### Cheat sheet
483
+
484
+ | name | default | use case | expected value(s) |
485
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------- |
486
+ | `theme` | `"light"` | To set the theme variant | `"light" or "dark"` |
487
+ | `title` | `null` | To set the title | `HTML` or `string` |
488
+ | `menu` | `null` | To render extra link in navbar | Array of Object(s) |
489
+ | `meta` | `null` | Meta tag attributes | Array of Object(s) |
490
+ | `search` | `{}` | To render search or not | Fuse.js options |
491
+ | `resizeable` | `{}` | To make certain element resizeable | `Object` |
492
+ | `codepen` | `{}` | To open code in codepen | `Object` |
493
+ | `create_style` | `null` | To create custom style rules | `string` |
494
+ | `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
495
+ | `add_scripts` | `null` | To create custom script | `string` |
496
+ | `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
497
+ | `footer` | `null` | To render footer | `HTML` or `string` |
498
+ | `static_dir` | `null` | To include static dir | Array of string |
499
+ | `include_css` | `null` | To include css files | Array of string |
500
+ | `include_js` | `null` | To include js files | `string` |
501
+ | `overlay_scrollbar` | `null` | To use overlay scrollbar | Overlay Scrollbar options |
502
+ | `sections` | `["Menu", "Modules", "Classes", "Externals", "Events", "Namespaces", "Mixins", "Tutorials", "Interfaces", "Global"]` | To order navbar sections or to hide/remove sidebar sections | `Array<SECTION_TYPE>` |
503
+
504
+ ## Changelog
505
+
506
+ Changelog is moved to [https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CHANGELOG.md](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CHANGELOG.md)
507
+
508
+ ## Developing
509
+
510
+ Before starting please go through our [contributing guide](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CONTRIBUTING.md).
511
+
512
+ ```bash
513
+ git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git
514
+ cd clean-jsdoc-theme
515
+ npm install
516
+ npm install jsdoc --no-save
517
+ npm run test
518
+ ```
519
+
520
+ `npm run test` will generate files in output folder.
521
+
522
+ ## Contributors
523
+
524
+ <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
525
+ <img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" />
526
+ </a>
527
+
528
+ ## Contact
529
+
530
+ If you like my work, then give me a <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme" data-icon="octicon-star" aria-label="Star ankitskvmdam/clean-jsdoc-theme on GitHub">star</a>. This will act as a driving force to add new feature more frequently. <br>
531
+ Mail me at: <a href="mailto:hello@ankdev.me">hello@ankdev.me</a> <br>
532
+
533
+ ## License
534
+
535
+ Licensed under the MIT license.