clean-jsdoc-theme 4.1.6 → 4.1.7

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 (67) 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/dependabot.yml +9 -9
  6. package/.github/pull_request_template.md +16 -16
  7. package/.github/workflows/codeql.yml +72 -72
  8. package/.github/workflows/greetings.yml +16 -16
  9. package/.prettierignore +2 -2
  10. package/.prettierrc +5 -5
  11. package/.stylelintignore +3 -3
  12. package/.stylelintrc +23 -23
  13. package/.travis.yml +30 -30
  14. package/CHANGELOG.md +235 -235
  15. package/CODE_OF_CONDUCT.md +76 -76
  16. package/CODE_OF_CONDUCT_HINDI.md +46 -46
  17. package/CONTRIBUTING.md +24 -24
  18. package/LICENSE +21 -21
  19. package/README.md +456 -457
  20. package/SECURITY.md +21 -21
  21. package/helpers/down-arrow.js +9 -9
  22. package/jsdoc-config.json +61 -61
  23. package/minify.js +56 -52
  24. package/package.json +50 -50
  25. package/publish.js +1129 -1129
  26. package/static/scripts/core.js +656 -644
  27. package/static/scripts/core.min.js +2 -2
  28. package/static/scripts/resize.js +90 -90
  29. package/static/scripts/search.js +262 -289
  30. package/static/scripts/search.min.js +5 -10
  31. package/static/scripts/third-party/Apache-License-2.0.txt +202 -202
  32. package/static/scripts/third-party/fuse.js +8 -8
  33. package/static/scripts/third-party/hljs-line-num-original.js +365 -0
  34. package/static/scripts/third-party/hljs-line-num.js +1 -1
  35. package/static/scripts/third-party/hljs-original.js +5162 -5162
  36. package/static/scripts/third-party/popper.js +5 -5
  37. package/static/scripts/third-party/tippy.js +1 -1
  38. package/static/styles/clean-jsdoc-theme-base.css +969 -952
  39. package/static/styles/clean-jsdoc-theme-dark.css +407 -407
  40. package/static/styles/clean-jsdoc-theme-light.css +388 -388
  41. package/static/styles/clean-jsdoc-theme.min.css +1 -1
  42. package/tmpl/augments.tmpl +10 -10
  43. package/tmpl/container.tmpl +190 -190
  44. package/tmpl/details.tmpl +207 -207
  45. package/tmpl/example.tmpl +3 -3
  46. package/tmpl/examples.tmpl +40 -40
  47. package/tmpl/exceptions.tmpl +32 -32
  48. package/tmpl/icons.tmpl +72 -72
  49. package/tmpl/layout.tmpl +157 -155
  50. package/tmpl/mainpage.tmpl +10 -10
  51. package/tmpl/members.tmpl +42 -42
  52. package/tmpl/method.tmpl +139 -139
  53. package/tmpl/mobile-sidebar.tmpl +20 -20
  54. package/tmpl/navbar-actions.tmpl +18 -18
  55. package/tmpl/navbar-menu.tmpl +24 -24
  56. package/tmpl/navbar.tmpl +13 -13
  57. package/tmpl/params.tmpl +124 -124
  58. package/tmpl/properties.tmpl +109 -109
  59. package/tmpl/returns.tmpl +18 -18
  60. package/tmpl/search.tmpl +16 -16
  61. package/tmpl/sidebar-items.tmpl +23 -23
  62. package/tmpl/sidebar-title.tmpl +9 -9
  63. package/tmpl/sidebar.tmpl +8 -8
  64. package/tmpl/source.tmpl +12 -12
  65. package/tmpl/toc.tmpl +3 -3
  66. package/tmpl/tutorial.tmpl +19 -19
  67. package/tmpl/type.tmpl +6 -6
package/README.md CHANGED
@@ -1,457 +1,456 @@
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.1.5-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)
4
- <br>
5
-
6
- clean-jsdoc-theme is a beautifully crafted theme for JSDoc 3. It is a clean and fully responsive theme with loads of customisation features.
7
-
8
- Some salient features:
9
-
10
- 1. It supports most screens, i.e., desktops, laptops, iPad and mobile devices.
11
- 1. It has a premium-looking dark and light theme.
12
- 1. It minifies all the output HTML files (this helps in saving a few KBs).
13
- 1. It has search support. The search feature doesn't increase the size of output HTML files.
14
- 1. It updates regularly.
15
- 1. It is highly performant. [Check lighthouse report here](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).
16
-
17
- We know that no library is perfect. That's why we are open to hearing from the community about the theme. For any suggestions, questions or bugs, feel free to create an <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/issues">issue</a>.
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
- 1. If you want to see a demo repo to set up this theme, visit [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example). This repo will guide you step by step on how to setup jsdoc and clean-jsdoc-theme in your existing repo.
24
-
25
- ## Screenshots
26
-
27
- ![Dark theme](./example/screen-1.png)
28
- ![Light theme](./example/screen-2.png)
29
- ![Mobile View](./example/screen-3.png)
30
- ![Search view](./example/screen-4.png)
31
- ![Class page](./example/screen-5.png)
32
- ![Code page](./example/screen-6.png)
33
-
34
- ## Installation
35
-
36
- > Note you must have `node` and `npm` installed on your machine.
37
-
38
- On your command line type
39
-
40
- ```bash
41
- npm install clean-jsdoc-theme --save-dev
42
- # or
43
- yarn add clean-jsdoc-theme -D
44
- ```
45
-
46
- In your projects `package.json` file add a generate script. You need to run this script when you want to generate documentation.
47
-
48
- ```json
49
- "script": {
50
- "generate-docs": "jsdoc --configure jsdoc.json --verbose"
51
- }
52
- ```
53
-
54
- In your `jsdoc.json` file, add a template option.
55
-
56
- ```json
57
- "opts": {
58
- "template": "node_modules/clean-jsdoc-theme"
59
- }
60
- ```
61
-
62
- > Heads Up! In the `generate_docs` script, there is a configure option. The value of that option is `jsdoc.json`. Make sure the `jsdoc.json` file exists. `jsdoc.json` contains configurations for JSDoc. If you have your JSDoc config in a different file, replace `jsdoc.json` with the name of the file in which you have your JSDoc config.
63
-
64
- Now to generate docs run
65
-
66
- ```bash
67
- npm run generate-docs
68
- ```
69
-
70
- For more information look at [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example)
71
-
72
- ## Example JSDoc Config
73
-
74
- ```json
75
- {
76
- "source": {
77
- "include": ["lib", "package.json", "README.md"],
78
- "includePattern": ".js$",
79
- "excludePattern": "(node_modules/|docs)"
80
- },
81
-
82
- "plugins": ["plugins/markdown"],
83
-
84
- "opts": {
85
- "encoding": "utf8",
86
- "readme": "./README.md",
87
- "destination": "docs/",
88
- "recurse": true,
89
- "verbose": true,
90
- "template": "./node_modules/clean-jsdoc-theme",
91
- "theme_opts": {
92
- "default_theme": "dark"
93
- }
94
- },
95
-
96
- "markdown": {
97
- "hardwrap": false,
98
- "idInHeadings": true // This is important for clean-jsdoc-theme, otherwise some features might not work.
99
- }
100
- }
101
- ```
102
-
103
- ## Options
104
-
105
- ### Set a default theme
106
-
107
- To set the default theme add the following in your jsodc config file:
108
-
109
- ```json
110
- "theme_opts": {
111
- "default_theme": "dark" // or "light"
112
- }
113
- ```
114
-
115
- ### Set base url
116
-
117
- If you want to set the base url:
118
-
119
- ```json
120
- "theme_opts": {
121
- "base_url": "https://ankdev.me/v4/"
122
- }
123
- ```
124
-
125
- > Make sure to add the ending forward slash (`/`).
126
-
127
- The default value of the `base_url` is calculated using the following code:
128
-
129
- ```js
130
- const path = document.location.pathname;
131
- const baseURL = path.substr(0, path.lastIndexOf('/') + 1);
132
- ```
133
-
134
- ### Add favicon
135
-
136
- To set favicon add the following in your jsodc config files.
137
-
138
- ```json
139
- "theme_opts": {
140
- "favicon": "path/to/img"
141
- }
142
-
143
- ```
144
-
145
- You can use [`static_dir`](#add-static-dir) option to copy all you static files to output dir and use that path in place of `path/to/img`.
146
-
147
- ### Add title
148
-
149
- 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:
150
-
151
- ```json
152
- "theme_opts": {
153
- "title": "<img src='path/to/img' class='my-custom-class'/>" // or "title": "clean-jsodc-theme"
154
- }
155
- ```
156
-
157
- You can use [`static_dir`](#add-static-dir) option to copy all you static files to output dir and use that path in place of `path/to/img`.
158
-
159
- ### Add navbar menu
160
-
161
- To render extra link(s) in navbar. It accepts an array of objects:
162
-
163
- ```json
164
- "theme_opts": {
165
- "menu" : [
166
- {
167
- "title": "Website",
168
- "link": "https://ankdev.me/clean-jsdoc-theme/dark/",
169
- "target": "_blank",
170
- "class": "some-class",
171
- "id": "some-id"
172
- },
173
- {
174
- // more if you want to.
175
- }
176
- ]
177
- }
178
- ```
179
-
180
- `menu` is an array of object. Each object has five properties, out of which two are required (`title` and `link`). If any object doesn't have the required properties then you might expect an error.
181
-
182
- <b>Properties</b>
183
-
184
- | name | type | required |
185
- | -------- | -------- | -------- |
186
- | `title` | `string` | required |
187
- | `link` | `string` | required |
188
- | `target` | `string` | optional |
189
- | `class` | `string` | optional |
190
- | `id` | `string` | optional |
191
-
192
- ### Sections
193
-
194
- There is an option to order the occurrence of sections in the sidebar. You can use this option to hide/remove any section.
195
-
196
- ```json
197
- "theme_opts": {
198
- "sections": ["Classes", "Modules", "Global"] // Only three members will be in the sidebar.
199
- }
200
- ```
201
-
202
- ```js
203
- // SECTION_TYPE
204
- [
205
- 'Classes',
206
- 'Modules',
207
- 'Externals',
208
- 'Events',
209
- 'Namespaces',
210
- 'Mixins',
211
- 'Tutorials',
212
- 'Interfaces',
213
- 'Global',
214
- ];
215
- ```
216
-
217
- ### Meta
218
-
219
- There is also an option to add meta tag to every generated HTML file. You can use `meta` option to include a list of `meta` tags into `head`.
220
-
221
- ```json
222
- "theme_opts": {
223
- "meta" : [
224
- {
225
- "name": "author",
226
- "content": "Ankit Kumar"
227
- },
228
- {
229
- "name": "description",
230
- "content": "Best Clean and minimal JSDoc 3 Template/Theme"
231
- }
232
- ]
233
- }
234
- ```
235
-
236
- `meta` is an array of object. Each objects can have any valid combination of [HTML metadata attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes).
237
-
238
- ### Search
239
-
240
- By default, the search feature is available in the theme. If you don't want the search feature, you can do the following:
241
-
242
- ```json
243
- "theme_opts": {
244
- "search": false
245
- }
246
- ```
247
-
248
- > Make sure you have added the `base_url` option as well, otherwise your search query might fail.
249
-
250
- How does the search work?
251
- If the search feature is enabled, you'll see a `data` folder in the output. This `data` folder contains a JSON called `search.json`. There is a fetch request when user types anything in the search box. That means search data is only loaded if user wants to search anything.
252
-
253
- ### CodePen
254
-
255
- > Note: Currently this feature is only enabled for the examples section.
256
-
257
- ```json
258
- "theme_opts": {
259
- "codepen": {
260
- "enable_for": ["examples"],
261
- "options": {
262
- "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
263
- "js_pre_processor": "babel"
264
- }
265
- }
266
- }
267
- ```
268
-
269
- `options` can be any valid CodePen options. For more visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
270
-
271
- ### Add static dir
272
-
273
- To include static files:
274
-
275
- ```json
276
- "theme_opts": {
277
- "static_dir": ["./static"],
278
- }
279
- ```
280
-
281
- ### Add styles
282
-
283
- To create custom style rules. Example:
284
-
285
- ```json
286
- "theme_opts" {
287
- "create_style": ".sidebar-title { font-size: 2rem }"
288
- }
289
- ```
290
-
291
- ### Add style paths
292
-
293
- Use this option to add third party css library. If you want to add your own custom css file then consider using [Add custom css files](#add-custom-css-files)
294
-
295
- > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you link tag.
296
-
297
- Example:
298
-
299
- ```json
300
- "add_style_path": [
301
- {
302
- "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
303
- "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
304
- "crossorigin": "anonymous"
305
- }
306
- ],
307
- ```
308
-
309
- ### Add custom css files
310
-
311
- To include css files. Example:
312
-
313
- ```json
314
- "theme_opts" {
315
- "include_css": ["./static/index.css", "./src/docs/index.css"]
316
- }
317
- ```
318
-
319
- > Note: You are not required to manually copy file to output dir
320
-
321
- 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.
322
-
323
- ### Add scripts
324
-
325
- To create custom scripts. Example:
326
-
327
- ```json
328
- "theme_opts": {
329
- "add_scripts": "function foo(){console.log('foo')} function bar() {console.log('bar')}"
330
- }
331
- ```
332
-
333
- ### Add script paths
334
-
335
- Use this option to add third party js library. If you want to add your own custom script file then consider using [Add custom script files](#add-custom-script-files)
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
- This will copy the static folder to the output dir.
352
-
353
- > Note: If the directory doesn't exists then you may get an error. Also directory is relative to your jsdoc config file.
354
-
355
- This will not flatten the directory it keep the directory structure as it is.
356
-
357
- ### Add custom script files
358
-
359
- To include js files. Example:
360
-
361
- ```json
362
- "theme_opts": {
363
- "include_js": ["./static/index.js", "./src/docs/index.js"]
364
- }
365
- ```
366
-
367
- > Note: You are not required to manually copy file to output dir
368
-
369
- 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.
370
-
371
- ### Footer
372
-
373
- ```json
374
- "theme_opts": {
375
-
376
- "footer": "This is footer" // or <div class="footer-wrapper">This is a footer </div>
377
- }
378
- ```
379
-
380
- ### To exclude inherited
381
-
382
- To exclude inherited symbols. Example:
383
-
384
- ```json
385
- "exclude_inherited": true
386
- ```
387
-
388
- This will remove all symbols (members, methods ...) that come from inherited parents.
389
-
390
- ## Cheat sheet
391
-
392
- | name | default | use case | expected value(s) |
393
- | ------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | --------------------- |
394
- | `default_theme` | `"dark"` | To set the default theme | `"light" or "dark"` |
395
- | `title` | `null` | To set the title | `HTML` or `string` |
396
- | `base_url` | `/` | To set the base URL | `string` |
397
- | `menu` | `null` | To render extra link in navbar | Array of Object(s) |
398
- | `meta` | `null` | Meta tag attributes | Array of Object(s) |
399
- | `search` | `true` | To render search or not | `true` or `false` |
400
- | `codepen` | `{}` | To open code in codepen | `Object` |
401
- | `static_dir` | `null` | To include static dir | Array of string |
402
- | `create_style` | `null` | To create custom style rules | `string` |
403
- | `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
404
- | `include_css` | `null` | To include css files | Array of string |
405
- | `add_scripts` | `null` | To create custom script | `string` |
406
- | `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
407
- | `include_js` | `null` | To include js files | `string` |
408
- | `footer` | `null` | To render footer | `HTML` or `string` |
409
- | `exclude_inherited` | `false` | To exclude inherited symbols | `boolean` |
410
- | `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>` |
411
-
412
- Don't forget to add the following in your jsdoc config file, otherwise toc will not work on some pages.
413
-
414
- ```json
415
- "markdown": {
416
- "idInHeadings": true // This is important for clean-jsdoc-theme, otherwise some features might not work.
417
- }
418
-
419
- ```
420
-
421
- ## Changelog
422
-
423
- 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)
424
-
425
- ## Developing
426
-
427
- Before starting please go through our [contributing guide](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CONTRIBUTING.md).
428
-
429
- ```bash
430
- git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git
431
- cd clean-jsdoc-theme
432
- npm install
433
- npm install jsdoc --no-save
434
- npm run build
435
- ```
436
-
437
- `npm run build` will generate files in output folder.
438
-
439
- ## Contributors
440
-
441
- <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
442
- <img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" alt="clean-jsdoc-contributors" />
443
- </a>
444
-
445
- ## Thanks
446
-
447
- Thanks to [fuse.js](https://fusejs.io/), [hljs](https://highlightjs.org/),[tippy.js](https://tippyjs.bootcss.com/), and all awesome contributors.
448
-
449
- ## Contact
450
-
451
- 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>.
452
-
453
- Mail me at: <a href="mailto:hello@ankdev.me">hello@ankdev.me</a> <br>
454
-
455
- ## License
456
-
457
- Licensed under the MIT license.
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.1.7-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)
4
+ <br>
5
+
6
+ clean-jsdoc-theme is a beautifully crafted theme for JSDoc 3. It is a clean and fully responsive theme with loads of customisation features.
7
+
8
+ Some salient features:
9
+
10
+ 1. It supports most screens, i.e., desktops, laptops, iPad and mobile devices.
11
+ 1. It has a premium-looking dark and light theme.
12
+ 1. It minifies all the output HTML files (this helps in saving a few KBs).
13
+ 1. It has search support. The search feature doesn't increase the size of output HTML files.
14
+ 1. It updates regularly.
15
+ 1. It is highly performant. [Check lighthouse report here](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).
16
+
17
+ We know that no library is perfect. That's why we are open to hearing from the community about the theme. For any suggestions, questions or bugs, feel free to create an <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/issues">issue</a>.
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
+ 1. If you want to see a demo repo to set up this theme, visit [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example). This repo will guide you step by step on how to setup jsdoc and clean-jsdoc-theme in your existing repo.
24
+
25
+ ## Screenshots
26
+
27
+ ![Dark theme](./example/screen-1.png)
28
+ ![Light theme](./example/screen-2.png)
29
+ ![Mobile View](./example/screen-3.png)
30
+ ![Search view](./example/screen-4.png)
31
+ ![Class page](./example/screen-5.png)
32
+ ![Code page](./example/screen-6.png)
33
+
34
+ ## Installation
35
+
36
+ > Note you must have `node` and `npm` installed on your machine.
37
+
38
+ On your command line type
39
+
40
+ ```bash
41
+ npm install clean-jsdoc-theme --save-dev
42
+ # or
43
+ yarn add clean-jsdoc-theme -D
44
+ ```
45
+
46
+ In your projects `package.json` file add a generate script. You need to run this script when you want to generate documentation.
47
+
48
+ ```json
49
+ "script": {
50
+ "generate-docs": "jsdoc --configure jsdoc.json --verbose"
51
+ }
52
+ ```
53
+
54
+ In your `jsdoc.json` file, add a template option.
55
+
56
+ ```json
57
+ "opts": {
58
+ "template": "node_modules/clean-jsdoc-theme"
59
+ }
60
+ ```
61
+
62
+ > Heads Up! In the `generate_docs` script, there is a configure option. The value of that option is `jsdoc.json`. Make sure the `jsdoc.json` file exists. `jsdoc.json` contains configurations for JSDoc. If you have your JSDoc config in a different file, replace `jsdoc.json` with the name of the file in which you have your JSDoc config.
63
+
64
+ Now to generate docs run
65
+
66
+ ```bash
67
+ npm run generate-docs
68
+ ```
69
+
70
+ For more information look at [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example)
71
+
72
+ ## Example JSDoc Config
73
+
74
+ ```json
75
+ {
76
+ "source": {
77
+ "include": ["lib", "package.json", "README.md"],
78
+ "includePattern": ".js$",
79
+ "excludePattern": "(node_modules/|docs)"
80
+ },
81
+
82
+ "plugins": ["plugins/markdown"],
83
+
84
+ "opts": {
85
+ "encoding": "utf8",
86
+ "readme": "./README.md",
87
+ "destination": "docs/",
88
+ "recurse": true,
89
+ "verbose": true,
90
+ "template": "./node_modules/clean-jsdoc-theme",
91
+ "theme_opts": {
92
+ "default_theme": "dark"
93
+ }
94
+ },
95
+
96
+ "markdown": {
97
+ "hardwrap": false,
98
+ "idInHeadings": true // This is important for clean-jsdoc-theme, otherwise some features might not work.
99
+ }
100
+ }
101
+ ```
102
+
103
+ ## Options
104
+
105
+ ### Set a default theme
106
+
107
+ To set the default theme add the following in your jsodc config file:
108
+
109
+ ```json
110
+ "theme_opts": {
111
+ "default_theme": "dark" // or "light"
112
+ }
113
+ ```
114
+
115
+ ### Set base url
116
+
117
+ If you want to set the base url:
118
+
119
+ ```json
120
+ "theme_opts": {
121
+ "base_url": "https://ankdev.me/v4/"
122
+ }
123
+ ```
124
+
125
+ > Make sure to add the ending forward slash (`/`).
126
+
127
+ The default value of the `base_url` is calculated using the following code:
128
+
129
+ ```js
130
+ const path = document.location.pathname;
131
+ const baseURL = path.substr(0, path.lastIndexOf('/') + 1);
132
+ ```
133
+
134
+ ### Add favicon
135
+
136
+ To set favicon add the following in your jsodc config files.
137
+
138
+ ```json
139
+ "theme_opts": {
140
+ "favicon": "path/to/img"
141
+ }
142
+ ```
143
+
144
+ You can use [`static_dir`](#add-static-dir) option to copy all you static files to output dir and use that path in place of `path/to/img`.
145
+
146
+ ### Add title
147
+
148
+ 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:
149
+
150
+ ```json
151
+ "theme_opts": {
152
+ "title": "<img src='path/to/img' class='my-custom-class'/>" // or "title": "clean-jsodc-theme"
153
+ }
154
+ ```
155
+
156
+ You can use [`static_dir`](#add-static-dir) option to copy all you static files to output dir and use that path in place of `path/to/img`.
157
+
158
+ ### Add navbar menu
159
+
160
+ To render extra link(s) in navbar. It accepts an array of objects:
161
+
162
+ ```json
163
+ "theme_opts": {
164
+ "menu" : [
165
+ {
166
+ "title": "Website",
167
+ "link": "https://ankdev.me/clean-jsdoc-theme/dark/",
168
+ "target": "_blank",
169
+ "class": "some-class",
170
+ "id": "some-id"
171
+ },
172
+ {
173
+ // more if you want to.
174
+ }
175
+ ]
176
+ }
177
+ ```
178
+
179
+ `menu` is an array of object. Each object has five properties, out of which two are required (`title` and `link`). If any object doesn't have the required properties then you might expect an error.
180
+
181
+ <b>Properties</b>
182
+
183
+ | name | type | required |
184
+ | -------- | -------- | -------- |
185
+ | `title` | `string` | required |
186
+ | `link` | `string` | required |
187
+ | `target` | `string` | optional |
188
+ | `class` | `string` | optional |
189
+ | `id` | `string` | optional |
190
+
191
+ ### Sections
192
+
193
+ There is an option to order the occurrence of sections in the sidebar. You can use this option to hide/remove any section.
194
+
195
+ ```json
196
+ "theme_opts": {
197
+ "sections": ["Classes", "Modules", "Global"] // Only three members will be in the sidebar.
198
+ }
199
+ ```
200
+
201
+ ```js
202
+ // SECTION_TYPE
203
+ [
204
+ 'Classes',
205
+ 'Modules',
206
+ 'Externals',
207
+ 'Events',
208
+ 'Namespaces',
209
+ 'Mixins',
210
+ 'Tutorials',
211
+ 'Interfaces',
212
+ 'Global',
213
+ ];
214
+ ```
215
+
216
+ ### Meta
217
+
218
+ There is also an option to add meta tag to every generated HTML file. You can use `meta` option to include a list of `meta` tags into `head`.
219
+
220
+ ```json
221
+ "theme_opts": {
222
+ "meta" : [
223
+ {
224
+ "name": "author",
225
+ "content": "Ankit Kumar"
226
+ },
227
+ {
228
+ "name": "description",
229
+ "content": "Best Clean and minimal JSDoc 3 Template/Theme"
230
+ }
231
+ ]
232
+ }
233
+ ```
234
+
235
+ `meta` is an array of object. Each objects can have any valid combination of [HTML metadata attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes).
236
+
237
+ ### Search
238
+
239
+ By default, the search feature is available in the theme. If you don't want the search feature, you can do the following:
240
+
241
+ ```json
242
+ "theme_opts": {
243
+ "search": false
244
+ }
245
+ ```
246
+
247
+ > Make sure you have added the `base_url` option as well, otherwise your search query might fail.
248
+
249
+ How does the search work?
250
+ If the search feature is enabled, you'll see a `data` folder in the output. This `data` folder contains a JSON called `search.json`. There is a fetch request when user types anything in the search box. That means search data is only loaded if user wants to search anything.
251
+
252
+ ### CodePen
253
+
254
+ > Note: Currently this feature is only enabled for the examples section.
255
+
256
+ ```json
257
+ "theme_opts": {
258
+ "codepen": {
259
+ "enable_for": ["examples"],
260
+ "options": {
261
+ "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
262
+ "js_pre_processor": "babel"
263
+ }
264
+ }
265
+ }
266
+ ```
267
+
268
+ `options` can be any valid CodePen options. For more visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
269
+
270
+ ### Add static dir
271
+
272
+ To include static files:
273
+
274
+ ```json
275
+ "theme_opts": {
276
+ "static_dir": ["./static"],
277
+ }
278
+ ```
279
+
280
+ ### Add styles
281
+
282
+ To create custom style rules. Example:
283
+
284
+ ```json
285
+ "theme_opts" {
286
+ "create_style": ".sidebar-title { font-size: 2rem }"
287
+ }
288
+ ```
289
+
290
+ ### Add style paths
291
+
292
+ Use this option to add third party css library. If you want to add your own custom css file then consider using [Add custom css files](#add-custom-css-files)
293
+
294
+ > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you link tag.
295
+
296
+ Example:
297
+
298
+ ```json
299
+ "add_style_path": [
300
+ {
301
+ "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css",
302
+ "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1",
303
+ "crossorigin": "anonymous"
304
+ }
305
+ ],
306
+ ```
307
+
308
+ ### Add custom css files
309
+
310
+ To include css files. Example:
311
+
312
+ ```json
313
+ "theme_opts" {
314
+ "include_css": ["./static/index.css", "./src/docs/index.css"]
315
+ }
316
+ ```
317
+
318
+ > Note: You are not required to manually copy file to output dir
319
+
320
+ 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.
321
+
322
+ ### Add scripts
323
+
324
+ To create custom scripts. Example:
325
+
326
+ ```json
327
+ "theme_opts": {
328
+ "add_scripts": "function foo(){console.log('foo')} function bar() {console.log('bar')}"
329
+ }
330
+ ```
331
+
332
+ ### Add script paths
333
+
334
+ Use this option to add third party js library. If you want to add your own custom script file then consider using [Add custom script files](#add-custom-script-files)
335
+
336
+ > Note: You have to pass an array of object, and object keys are actually the attributes which you want in you script tag.
337
+
338
+ Example:
339
+
340
+ ```json
341
+ "add_script_path": [
342
+ {
343
+ "href": "https://code.jquery.com/jquery-3.5.1.js",
344
+ "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
345
+ "crossorigin": "anonymous"
346
+ }
347
+ ],
348
+ ```
349
+
350
+ This will copy the static folder to the output dir.
351
+
352
+ > Note: If the directory doesn't exists then you may get an error. Also directory is relative to your jsdoc config file.
353
+
354
+ This will not flatten the directory it keep the directory structure as it is.
355
+
356
+ ### Add custom script files
357
+
358
+ To include js files. Example:
359
+
360
+ ```json
361
+ "theme_opts": {
362
+ "include_js": ["./static/index.js", "./src/docs/index.js"]
363
+ }
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
+ ### Footer
371
+
372
+ ```json
373
+ "theme_opts": {
374
+ "footer": "This is footer" // or <div class="footer-wrapper">This is a footer </div>
375
+ }
376
+ ```
377
+
378
+ ### To exclude inherited
379
+
380
+ To exclude inherited symbols. Example:
381
+
382
+ ```json
383
+ "exclude_inherited": true
384
+ ```
385
+
386
+ This will remove all symbols (members, methods ...) that come from inherited parents.
387
+
388
+ ## Cheat sheet
389
+
390
+ | name | default | use case | expected value(s) |
391
+ | ------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | --------------------- |
392
+ | `default_theme` | `"dark"` | To set the default theme | `"light" or "dark"` |
393
+ | `title` | `null` | To set the title | `HTML` or `string` |
394
+ | `base_url` | `/` | To set the base URL | `string` |
395
+ | `menu` | `null` | To render extra link in navbar | Array of Object(s) |
396
+ | `meta` | `null` | Meta tag attributes | Array of Object(s) |
397
+ | `search` | `true` | To render search or not | `true` or `false` |
398
+ | `codepen` | `{}` | To open code in codepen | `Object` |
399
+ | `static_dir` | `null` | To include static dir | Array of string |
400
+ | `create_style` | `null` | To create custom style rules | `string` |
401
+ | `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
402
+ | `include_css` | `null` | To include css files | Array of string |
403
+ | `add_scripts` | `null` | To create custom script | `string` |
404
+ | `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
405
+ | `include_js` | `null` | To include js files | `string` |
406
+ | `footer` | `null` | To render footer | `HTML` or `string` |
407
+ | `exclude_inherited` | `false` | To exclude inherited symbols | `boolean` |
408
+ | `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>` |
409
+
410
+ Don't forget to add the following in your jsdoc config file, otherwise toc will not work on some pages.
411
+
412
+ ```json
413
+ "markdown": {
414
+ "idInHeadings": true // This is important for clean-jsdoc-theme, otherwise some features might not work.
415
+ }
416
+
417
+ ```
418
+
419
+ ## Changelog
420
+
421
+ 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)
422
+
423
+ ## Developing
424
+
425
+ Before starting please go through our [contributing guide](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CONTRIBUTING.md).
426
+
427
+ ```bash
428
+ git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git
429
+ cd clean-jsdoc-theme
430
+ npm install
431
+ npm install jsdoc --no-save
432
+ npm run build
433
+ ```
434
+
435
+ `npm run build` will generate files in output folder.
436
+
437
+ ## Contributors
438
+
439
+ <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
440
+ <img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" alt="clean-jsdoc-contributors" />
441
+ </a>
442
+
443
+ ## Thanks
444
+
445
+ Thanks to [fuse.js](https://fusejs.io/), [hljs](https://highlightjs.org/),[tippy.js](https://tippyjs.bootcss.com/), and all awesome contributors.
446
+
447
+ ## Contact
448
+
449
+ 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>.
450
+
451
+ Mail me at: <a href="mailto:hello@ankdev.me">hello@ankdev.me</a> <br>
452
+
453
+ ## License
454
+
455
+ Licensed under the MIT license.
456
+