clean-jsdoc-theme 3.3.3 → 3.3.4

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 +216 -216
  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 +546 -546
  18. package/SECURITY.md +21 -21
  19. package/helpers/down-arrow.js +9 -9
  20. package/jsdoc-config.json +60 -60
  21. package/package.json +46 -46
  22. package/publish.js +1197 -1197
  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 -217
  30. package/static/scripts/resize.js +85 -85
  31. package/static/scripts/search.js +77 -77
  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 -351
  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 -208
  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 +165 -165
  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,546 +1,546 @@
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.3-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.
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
- In your projects `package.json` file add a generate script
53
-
54
- ```json
55
- "script": {
56
- "generate-docs": "node_modules/.bin/jsdoc --configure jsdoc.json --verbose"
57
- }
58
- ```
59
-
60
- In your `jsdoc.json` file, add a template option.
61
-
62
- ```json
63
- "opts": {
64
- "template": "node_modules/clean-jsdoc-theme"
65
- }
66
- ```
67
-
68
- Now to generate docs run
69
-
70
- ```bash
71
- npm run generate-docs
72
- ```
73
-
74
- For more information look at [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example)
75
-
76
- ## Example JSDoc Config
77
-
78
- ```json
79
- {
80
- "source": {
81
- "include": ["lib", "package.json", "README.md"],
82
- "includePattern": ".js$",
83
- "excludePattern": "(node_modules/|docs)"
84
- },
85
-
86
- "plugins": ["plugins/markdown"],
87
-
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
- "theme": "dark"
97
- }
98
- }
99
- }
100
- ```
101
-
102
- ## Options
103
-
104
- To use custom options (such as light and dark modes), pass an object called `theme_opts` in your config file under `opts`.
105
-
106
- ### `theme : "light" | "dark"`
107
-
108
- 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.
109
- `Default value is "light"`
110
-
111
- ### `favicon: string`
112
-
113
- This option sets the favicon of the document. It accepts strings defining the path of the icon.
114
-
115
- ```json
116
- "favion": "path/to/img"
117
- ```
118
-
119
- 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.
120
-
121
- ### `title: string | HTML`
122
-
123
- 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:
124
-
125
- ```json
126
- "title": "<img src='path/to/img' class='my-custom-class'/>"
127
- ```
128
-
129
- 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.
130
-
131
- ### `menu: Array<{}>`
132
-
133
- 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:
134
-
135
- ```json
136
- "menu" : [
137
- {
138
- "title": "Website",
139
- "link": "https://ankdev.me/clean-jsdoc-theme/dark/",
140
- "target": "_blank",
141
- "class": "some-class",
142
- "id": "some-id"
143
- }
144
- ]
145
- ```
146
-
147
- #### Required properties
148
-
149
- | name | type |
150
- | ------- | -------- |
151
- | `title` | `string` |
152
- | `link` | `string` |
153
-
154
- #### Optional Properties
155
-
156
- | name | type |
157
- | -------- | -------- |
158
- | `target` | `string` |
159
- | `class` | `string` |
160
- | `id` | `string` |
161
-
162
- ### `sections: Array<SECTION_TYPE>`
163
-
164
- This can be used to order the navbar sections. This can also be used to hide/remove any section.
165
-
166
- ```js
167
- // SECTION_TYPE
168
- [
169
- 'Classes',
170
- 'Modules',
171
- 'Externals',
172
- 'Events',
173
- 'Namespaces',
174
- 'Mixins',
175
- 'Tutorials',
176
- 'Interfaces',
177
- 'Global',
178
- 'Menu',
179
- ];
180
- ```
181
-
182
- ```json5
183
- "sections": ["Classes", "Modules", "Global", "Menu"] // Only 4 members will be in the navbar.
184
- ```
185
-
186
- ### `meta: Array<{}>`
187
-
188
- A list of `meta` tag attributes to add to the `head` of each page.
189
-
190
- ```json
191
- "meta" : [
192
- {
193
- "name": "author",
194
- "content": "Ankit Kumar"
195
- },
196
- {
197
- "name": "description",
198
- "content": "Best Clean and minimal JSDoc 3 Template/Theme"
199
- }
200
- ]
201
- ```
202
-
203
- #### Properties
204
-
205
- Any valid combination of [HTML metadata attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes).
206
-
207
- ### `search: {}`
208
-
209
- To render search. Default value:
210
-
211
- ```json
212
- "search": {
213
- "shouldSort": true,
214
- "threshold": 0.4,
215
- "location": 0,
216
- "distance": 100,
217
- "maxPatternLength": 32,
218
- "minMatchCharLength": 1,
219
- }
220
- ```
221
-
222
- If you don't want to render search box then do the following:
223
-
224
- ```json
225
- "search" false
226
- ```
227
-
228
- #### Properties
229
-
230
- Any valid [fuse.js properties](https://fusejs.io/api/options.html)
231
-
232
- ### `overlay_scrollbar: {}`
233
-
234
- Includes the OverlayScrollbars plugin. Simply passing an empty object will activate this feature.
235
-
236
- ```json
237
- "overlay_scrollbar": {
238
- "option": {}
239
- }
240
- ```
241
-
242
- #### Properties
243
-
244
- Any valid [overlay scrollbar properties](https://kingsora.github.io/OverlayScrollbars/#!documentation/options)
245
-
246
- ### `resizeable: {}`
247
-
248
- 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:
249
-
250
- ```json
251
- "resizeable": {
252
- "navbar": {
253
- "min": "300",
254
- "max": "600"
255
- }
256
- }
257
- ```
258
-
259
- Don't include any unit. Also, units of max and min is inferred in `px`.
260
-
261
- > Note: Navbar is not resizeable on mobile/small screens.
262
- > If you don't want to give min and max value and want to use the default values then pass empty object.
263
-
264
- ```json
265
- "resizeable": {
266
- "navbar": {}
267
- }
268
- ```
269
-
270
- If you didn't pass any thing in navbar then navbar is not resizeable.
271
-
272
- ### `codepen: {}`
273
-
274
- This will add a link to the codepen with prefilled data.
275
-
276
- > Note: Currently this feature is only enabled for examples section.
277
-
278
- ```json
279
- "codepen": {
280
- "enable_for": ["examples"],
281
- "options": {
282
- "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
283
- "js_pre_processor": "babel"
284
- }
285
- }
286
- ```
287
-
288
- `options` can be any valid codepen options. For more visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
289
- if you want default behaviour then don't pass anything in options.
290
-
291
- ### `create_style: string`
292
-
293
- To create custom style rules. Example:
294
-
295
- ```json
296
- "create_style": "nav{background: yellow} footer {background: green}"
297
- ```
298
-
299
- Here the nav and footer style rule is to attached to the HTML's `style` tag.
300
-
301
- ### `add_scripts: string`
302
-
303
- To create custom scripts. Example:
304
-
305
- ```json
306
- "add_scripts": "function foo(){console.log('foo')} function bar() {console.log('bar')}"
307
- ```
308
-
309
- Here the script is to attached to the HTML's `script` tag.
310
-
311
- ### `add_style_path: Array<{}>`
312
-
313
- Use this option to add third party css library.
314
-
315
- > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you link tag.
316
-
317
- Example:
318
-
319
- ```json
320
- "add_style_path": [
321
- {
322
- "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
323
- "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
324
- "crossorigin": "anonymous"
325
- }
326
- ],
327
- ```
328
-
329
- #### Properties
330
-
331
- Any valid [style tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
332
-
333
- ### `add_script_path: Array<{}>`
334
-
335
- Use this option to add third party js library.
336
-
337
- > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you script tag.
338
-
339
- Example:
340
-
341
- ```json
342
- "add_script_path": [
343
- {
344
- "href": "https://code.jquery.com/jquery-3.5.1.js",
345
- "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
346
- "crossorigin": "anonymous"
347
- }
348
- ],
349
- ```
350
-
351
- ### Properties
352
-
353
- Any valid [script tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
354
-
355
- ### `footer: string | HTML`
356
-
357
- Thing which you want to render as the footer. You can either pass a string or HTML.
358
- Use HTML to overwrite the default HTML.
359
-
360
- ```json
361
- "footer": "This is footer"
362
- ```
363
-
364
- ### `static_dir: Array<string>`
365
-
366
- To include static files. Example:
367
-
368
- ```json
369
- "static_dir": ["./static"],
370
- ```
371
-
372
- This will copy the static folder to the output dir.
373
-
374
- > Note: If the directory doesn't exists then you may get an error. Also directory is relative to your jsdoc config file.
375
-
376
- This will not flatten then directory it keep the directory structure as it is.
377
-
378
- ### `include_css: Array<string>`
379
-
380
- To include css files. Example:
381
-
382
- ```json
383
- "include_css": ["./static/index.css", "./src/docs/index.css"]
384
- ```
385
-
386
- > Note: You are not required to manually copy file to output dir
387
-
388
- 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.
389
-
390
- ### `include_js: Array<string>`
391
-
392
- To include js files. Example:
393
-
394
- ```json
395
- "include_js": ["./static/index.js", "./src/docs/index.js"]
396
- ```
397
-
398
- > Note: You are not required to manually copy file to output dir
399
-
400
- 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.
401
-
402
- ### `exclude_inherited: <boolean>`
403
-
404
- To exclude inherited symbols. Example:
405
-
406
- ```json
407
- "exclude_inherited": true
408
- ```
409
-
410
- This will remove all symbols (members, methods ...) that come from inherited parents.
411
-
412
- ### Example `theme_opts`
413
-
414
- ```json
415
- "opts":{
416
- "theme_opts":{
417
- "theme": "dark",
418
- "title": "clean-jsdoc-theme",
419
- "menu": [
420
- {
421
- "title": "Website",
422
- "link": "https://ankdev.me/clean-jsdoc-theme/index.html",
423
- "target": "_blank",
424
- "class": "some-class",
425
- "id": "some-id"
426
- },
427
- {
428
- "title": "Github",
429
- "link": "https://github.com/ankitskvmdam/clean-jsdoc-theme/",
430
- "target": "_blank",
431
- "class": "some-class",
432
- "id": "some-id"
433
- }
434
- ],
435
-
436
- "meta": [
437
- {
438
- "name": "author",
439
- "content": "Ankit Kumar"
440
- },
441
- {
442
- "name": "description",
443
- "content": "Best Clean and minimal JSDoc 3 Template/Theme"
444
- }
445
- ],
446
- "search": {},
447
- "create_style": "nav{background: yellow}",
448
- "add_style_path": [
449
- {
450
- "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
451
- "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
452
- "crossorigin": "anonymous"
453
- }
454
- ],
455
- "add_scripts": "function foo(){console.log('foo')}",
456
- "add_script_path": [
457
- {
458
- "src": "https://code.jquery.com/jquery-3.5.1.js",
459
- "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
460
- "crossorigin": "anonymous"
461
- }
462
- ],
463
-
464
- "footer": "This is footer",
465
- "static_dir": ["./static"],
466
- "include_css": ["./static/index.css", "./src/docs/index.css"],
467
- "include_js": ["./static/main.js", "./third-party/test/index.js"],
468
-
469
- "exclude_inherited": true,
470
-
471
- "overlay_scrollbar": {
472
- "options": {
473
- }
474
- },
475
- "resizeable": {
476
- "navbar": {
477
- "min": "300",
478
- "max": "600"
479
- }
480
- },
481
- "codepen": {
482
- "enable_for": ["examples"],
483
- "options": {
484
- "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
485
- "js_pre_processor": "babel"
486
- }
487
- }
488
- }
489
- }
490
- ```
491
-
492
- ### Cheat sheet
493
-
494
- | name | default | use case | expected value(s) |
495
- | ------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------- |
496
- | `theme` | `"light"` | To set the theme variant | `"light" or "dark"` |
497
- | `title` | `null` | To set the title | `HTML` or `string` |
498
- | `menu` | `null` | To render extra link in navbar | Array of Object(s) |
499
- | `meta` | `null` | Meta tag attributes | Array of Object(s) |
500
- | `search` | `{}` | To render search or not | Fuse.js options |
501
- | `resizeable` | `{}` | To make certain element resizeable | `Object` |
502
- | `codepen` | `{}` | To open code in codepen | `Object` |
503
- | `create_style` | `null` | To create custom style rules | `string` |
504
- | `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
505
- | `add_scripts` | `null` | To create custom script | `string` |
506
- | `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
507
- | `footer` | `null` | To render footer | `HTML` or `string` |
508
- | `static_dir` | `null` | To include static dir | Array of string |
509
- | `include_css` | `null` | To include css files | Array of string |
510
- | `include_js` | `null` | To include js files | `string` |
511
- | `exclude_inherited` | `false` | To exclude inherited symbols | `boolean` |
512
- | `overlay_scrollbar` | `null` | To use overlay scrollbar | Overlay Scrollbar options |
513
- | `sections` | `["Menu", "Modules", "Classes", "Externals", "Events", "Namespaces", "Mixins", "Tutorials", "Interfaces", "Global"]` | To order navbar/sidebar sections or to hide/remove navbar/sidebar sections | `Array<SECTION_TYPE>` |
514
-
515
- ## Changelog
516
-
517
- 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)
518
-
519
- ## Developing
520
-
521
- Before starting please go through our [contributing guide](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CONTRIBUTING.md).
522
-
523
- ```bash
524
- git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git
525
- cd clean-jsdoc-theme
526
- npm install
527
- npm install jsdoc --no-save
528
- npm run test
529
- ```
530
-
531
- `npm run test` will generate files in output folder.
532
-
533
- ## Contributors
534
-
535
- <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
536
- <img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" />
537
- </a>
538
-
539
- ## Contact
540
-
541
- 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>
542
- Mail me at: <a href="mailto:hello@ankdev.me">hello@ankdev.me</a> <br>
543
-
544
- ## License
545
-
546
- 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.3-4bff) [![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.
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
+ In your projects `package.json` file add a generate script
53
+
54
+ ```json
55
+ "script": {
56
+ "generate-docs": "node_modules/.bin/jsdoc --configure jsdoc.json --verbose"
57
+ }
58
+ ```
59
+
60
+ In your `jsdoc.json` file, add a template option.
61
+
62
+ ```json
63
+ "opts": {
64
+ "template": "node_modules/clean-jsdoc-theme"
65
+ }
66
+ ```
67
+
68
+ Now to generate docs run
69
+
70
+ ```bash
71
+ npm run generate-docs
72
+ ```
73
+
74
+ For more information look at [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example)
75
+
76
+ ## Example JSDoc Config
77
+
78
+ ```json
79
+ {
80
+ "source": {
81
+ "include": ["lib", "package.json", "README.md"],
82
+ "includePattern": ".js$",
83
+ "excludePattern": "(node_modules/|docs)"
84
+ },
85
+
86
+ "plugins": ["plugins/markdown"],
87
+
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
+ "theme": "dark"
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Options
103
+
104
+ To use custom options (such as light and dark modes), pass an object called `theme_opts` in your config file under `opts`.
105
+
106
+ ### `theme : "light" | "dark"`
107
+
108
+ 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.
109
+ `Default value is "light"`
110
+
111
+ ### `favicon: string`
112
+
113
+ This option sets the favicon of the document. It accepts strings defining the path of the icon.
114
+
115
+ ```json
116
+ "favion": "path/to/img"
117
+ ```
118
+
119
+ 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.
120
+
121
+ ### `title: string | HTML`
122
+
123
+ 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:
124
+
125
+ ```json
126
+ "title": "<img src='path/to/img' class='my-custom-class'/>"
127
+ ```
128
+
129
+ 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.
130
+
131
+ ### `menu: Array<{}>`
132
+
133
+ 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:
134
+
135
+ ```json
136
+ "menu" : [
137
+ {
138
+ "title": "Website",
139
+ "link": "https://ankdev.me/clean-jsdoc-theme/dark/",
140
+ "target": "_blank",
141
+ "class": "some-class",
142
+ "id": "some-id"
143
+ }
144
+ ]
145
+ ```
146
+
147
+ #### Required properties
148
+
149
+ | name | type |
150
+ | ------- | -------- |
151
+ | `title` | `string` |
152
+ | `link` | `string` |
153
+
154
+ #### Optional Properties
155
+
156
+ | name | type |
157
+ | -------- | -------- |
158
+ | `target` | `string` |
159
+ | `class` | `string` |
160
+ | `id` | `string` |
161
+
162
+ ### `sections: Array<SECTION_TYPE>`
163
+
164
+ This can be used to order the navbar sections. This can also be used to hide/remove any section.
165
+
166
+ ```js
167
+ // SECTION_TYPE
168
+ [
169
+ 'Classes',
170
+ 'Modules',
171
+ 'Externals',
172
+ 'Events',
173
+ 'Namespaces',
174
+ 'Mixins',
175
+ 'Tutorials',
176
+ 'Interfaces',
177
+ 'Global',
178
+ 'Menu',
179
+ ];
180
+ ```
181
+
182
+ ```json5
183
+ "sections": ["Classes", "Modules", "Global", "Menu"] // Only 4 members will be in the navbar.
184
+ ```
185
+
186
+ ### `meta: Array<{}>`
187
+
188
+ A list of `meta` tag attributes to add to the `head` of each page.
189
+
190
+ ```json
191
+ "meta" : [
192
+ {
193
+ "name": "author",
194
+ "content": "Ankit Kumar"
195
+ },
196
+ {
197
+ "name": "description",
198
+ "content": "Best Clean and minimal JSDoc 3 Template/Theme"
199
+ }
200
+ ]
201
+ ```
202
+
203
+ #### Properties
204
+
205
+ Any valid combination of [HTML metadata attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes).
206
+
207
+ ### `search: {}`
208
+
209
+ To render search. Default value:
210
+
211
+ ```json
212
+ "search": {
213
+ "shouldSort": true,
214
+ "threshold": 0.4,
215
+ "location": 0,
216
+ "distance": 100,
217
+ "maxPatternLength": 32,
218
+ "minMatchCharLength": 1,
219
+ }
220
+ ```
221
+
222
+ If you don't want to render search box then do the following:
223
+
224
+ ```json
225
+ "search" false
226
+ ```
227
+
228
+ #### Properties
229
+
230
+ Any valid [fuse.js properties](https://fusejs.io/api/options.html)
231
+
232
+ ### `overlay_scrollbar: {}`
233
+
234
+ Includes the OverlayScrollbars plugin. Simply passing an empty object will activate this feature.
235
+
236
+ ```json
237
+ "overlay_scrollbar": {
238
+ "option": {}
239
+ }
240
+ ```
241
+
242
+ #### Properties
243
+
244
+ Any valid [overlay scrollbar properties](https://kingsora.github.io/OverlayScrollbars/#!documentation/options)
245
+
246
+ ### `resizeable: {}`
247
+
248
+ 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:
249
+
250
+ ```json
251
+ "resizeable": {
252
+ "navbar": {
253
+ "min": "300",
254
+ "max": "600"
255
+ }
256
+ }
257
+ ```
258
+
259
+ Don't include any unit. Also, units of max and min is inferred in `px`.
260
+
261
+ > Note: Navbar is not resizeable on mobile/small screens.
262
+ > If you don't want to give min and max value and want to use the default values then pass empty object.
263
+
264
+ ```json
265
+ "resizeable": {
266
+ "navbar": {}
267
+ }
268
+ ```
269
+
270
+ If you didn't pass any thing in navbar then navbar is not resizeable.
271
+
272
+ ### `codepen: {}`
273
+
274
+ This will add a link to the codepen with prefilled data.
275
+
276
+ > Note: Currently this feature is only enabled for examples section.
277
+
278
+ ```json
279
+ "codepen": {
280
+ "enable_for": ["examples"],
281
+ "options": {
282
+ "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
283
+ "js_pre_processor": "babel"
284
+ }
285
+ }
286
+ ```
287
+
288
+ `options` can be any valid codepen options. For more visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
289
+ if you want default behaviour then don't pass anything in options.
290
+
291
+ ### `create_style: string`
292
+
293
+ To create custom style rules. Example:
294
+
295
+ ```json
296
+ "create_style": "nav{background: yellow} footer {background: green}"
297
+ ```
298
+
299
+ Here the nav and footer style rule is to attached to the HTML's `style` tag.
300
+
301
+ ### `add_scripts: string`
302
+
303
+ To create custom scripts. Example:
304
+
305
+ ```json
306
+ "add_scripts": "function foo(){console.log('foo')} function bar() {console.log('bar')}"
307
+ ```
308
+
309
+ Here the script is to attached to the HTML's `script` tag.
310
+
311
+ ### `add_style_path: Array<{}>`
312
+
313
+ Use this option to add third party css library.
314
+
315
+ > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you link tag.
316
+
317
+ Example:
318
+
319
+ ```json
320
+ "add_style_path": [
321
+ {
322
+ "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
323
+ "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
324
+ "crossorigin": "anonymous"
325
+ }
326
+ ],
327
+ ```
328
+
329
+ #### Properties
330
+
331
+ Any valid [style tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
332
+
333
+ ### `add_script_path: Array<{}>`
334
+
335
+ Use this option to add third party js library.
336
+
337
+ > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you script tag.
338
+
339
+ Example:
340
+
341
+ ```json
342
+ "add_script_path": [
343
+ {
344
+ "href": "https://code.jquery.com/jquery-3.5.1.js",
345
+ "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
346
+ "crossorigin": "anonymous"
347
+ }
348
+ ],
349
+ ```
350
+
351
+ ### Properties
352
+
353
+ Any valid [script tag attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
354
+
355
+ ### `footer: string | HTML`
356
+
357
+ Thing which you want to render as the footer. You can either pass a string or HTML.
358
+ Use HTML to overwrite the default HTML.
359
+
360
+ ```json
361
+ "footer": "This is footer"
362
+ ```
363
+
364
+ ### `static_dir: Array<string>`
365
+
366
+ To include static files. Example:
367
+
368
+ ```json
369
+ "static_dir": ["./static"],
370
+ ```
371
+
372
+ This will copy the static folder to the output dir.
373
+
374
+ > Note: If the directory doesn't exists then you may get an error. Also directory is relative to your jsdoc config file.
375
+
376
+ This will not flatten then directory it keep the directory structure as it is.
377
+
378
+ ### `include_css: Array<string>`
379
+
380
+ To include css files. Example:
381
+
382
+ ```json
383
+ "include_css": ["./static/index.css", "./src/docs/index.css"]
384
+ ```
385
+
386
+ > Note: You are not required to manually copy file to output dir
387
+
388
+ 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.
389
+
390
+ ### `include_js: Array<string>`
391
+
392
+ To include js files. Example:
393
+
394
+ ```json
395
+ "include_js": ["./static/index.js", "./src/docs/index.js"]
396
+ ```
397
+
398
+ > Note: You are not required to manually copy file to output dir
399
+
400
+ 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.
401
+
402
+ ### `exclude_inherited: <boolean>`
403
+
404
+ To exclude inherited symbols. Example:
405
+
406
+ ```json
407
+ "exclude_inherited": true
408
+ ```
409
+
410
+ This will remove all symbols (members, methods ...) that come from inherited parents.
411
+
412
+ ### Example `theme_opts`
413
+
414
+ ```json
415
+ "opts":{
416
+ "theme_opts":{
417
+ "theme": "dark",
418
+ "title": "clean-jsdoc-theme",
419
+ "menu": [
420
+ {
421
+ "title": "Website",
422
+ "link": "https://ankdev.me/clean-jsdoc-theme/index.html",
423
+ "target": "_blank",
424
+ "class": "some-class",
425
+ "id": "some-id"
426
+ },
427
+ {
428
+ "title": "Github",
429
+ "link": "https://github.com/ankitskvmdam/clean-jsdoc-theme/",
430
+ "target": "_blank",
431
+ "class": "some-class",
432
+ "id": "some-id"
433
+ }
434
+ ],
435
+
436
+ "meta": [
437
+ {
438
+ "name": "author",
439
+ "content": "Ankit Kumar"
440
+ },
441
+ {
442
+ "name": "description",
443
+ "content": "Best Clean and minimal JSDoc 3 Template/Theme"
444
+ }
445
+ ],
446
+ "search": {},
447
+ "create_style": "nav{background: yellow}",
448
+ "add_style_path": [
449
+ {
450
+ "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
451
+ "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
452
+ "crossorigin": "anonymous"
453
+ }
454
+ ],
455
+ "add_scripts": "function foo(){console.log('foo')}",
456
+ "add_script_path": [
457
+ {
458
+ "src": "https://code.jquery.com/jquery-3.5.1.js",
459
+ "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
460
+ "crossorigin": "anonymous"
461
+ }
462
+ ],
463
+
464
+ "footer": "This is footer",
465
+ "static_dir": ["./static"],
466
+ "include_css": ["./static/index.css", "./src/docs/index.css"],
467
+ "include_js": ["./static/main.js", "./third-party/test/index.js"],
468
+
469
+ "exclude_inherited": true,
470
+
471
+ "overlay_scrollbar": {
472
+ "options": {
473
+ }
474
+ },
475
+ "resizeable": {
476
+ "navbar": {
477
+ "min": "300",
478
+ "max": "600"
479
+ }
480
+ },
481
+ "codepen": {
482
+ "enable_for": ["examples"],
483
+ "options": {
484
+ "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
485
+ "js_pre_processor": "babel"
486
+ }
487
+ }
488
+ }
489
+ }
490
+ ```
491
+
492
+ ### Cheat sheet
493
+
494
+ | name | default | use case | expected value(s) |
495
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------- |
496
+ | `theme` | `"light"` | To set the theme variant | `"light" or "dark"` |
497
+ | `title` | `null` | To set the title | `HTML` or `string` |
498
+ | `menu` | `null` | To render extra link in navbar | Array of Object(s) |
499
+ | `meta` | `null` | Meta tag attributes | Array of Object(s) |
500
+ | `search` | `{}` | To render search or not | Fuse.js options |
501
+ | `resizeable` | `{}` | To make certain element resizeable | `Object` |
502
+ | `codepen` | `{}` | To open code in codepen | `Object` |
503
+ | `create_style` | `null` | To create custom style rules | `string` |
504
+ | `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
505
+ | `add_scripts` | `null` | To create custom script | `string` |
506
+ | `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
507
+ | `footer` | `null` | To render footer | `HTML` or `string` |
508
+ | `static_dir` | `null` | To include static dir | Array of string |
509
+ | `include_css` | `null` | To include css files | Array of string |
510
+ | `include_js` | `null` | To include js files | `string` |
511
+ | `exclude_inherited` | `false` | To exclude inherited symbols | `boolean` |
512
+ | `overlay_scrollbar` | `null` | To use overlay scrollbar | Overlay Scrollbar options |
513
+ | `sections` | `["Menu", "Modules", "Classes", "Externals", "Events", "Namespaces", "Mixins", "Tutorials", "Interfaces", "Global"]` | To order navbar/sidebar sections or to hide/remove navbar/sidebar sections | `Array<SECTION_TYPE>` |
514
+
515
+ ## Changelog
516
+
517
+ 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)
518
+
519
+ ## Developing
520
+
521
+ Before starting please go through our [contributing guide](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CONTRIBUTING.md).
522
+
523
+ ```bash
524
+ git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git
525
+ cd clean-jsdoc-theme
526
+ npm install
527
+ npm install jsdoc --no-save
528
+ npm run test
529
+ ```
530
+
531
+ `npm run test` will generate files in output folder.
532
+
533
+ ## Contributors
534
+
535
+ <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
536
+ <img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" />
537
+ </a>
538
+
539
+ ## Contact
540
+
541
+ 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>
542
+ Mail me at: <a href="mailto:hello@ankdev.me">hello@ankdev.me</a> <br>
543
+
544
+ ## License
545
+
546
+ Licensed under the MIT license.