clean-jsdoc-theme 4.1.7 → 4.1.9

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