Gathering detailed insights and metrics for clean-jsdoc-theme-burndown
Gathering detailed insights and metrics for clean-jsdoc-theme-burndown
Gathering detailed insights and metrics for clean-jsdoc-theme-burndown
Gathering detailed insights and metrics for clean-jsdoc-theme-burndown
A beautifully crafted theme / template for JSDoc 3. https://ankdev.me/clean-jsdoc-theme/v4
npm install clean-jsdoc-theme-burndown
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
884 Commits
1 Branches
1 Contributors
Updated on 26 Nov 2023
HTML (85.4%)
JavaScript (9.67%)
CSS (4.92%)
Shell (0.01%)
Cumulative downloads
Total Downloads
Last day
0%
22
Compared to previous day
Last week
1,350%
29
Compared to previous week
Last month
71%
53
Compared to previous month
Last year
0%
682
Compared to previous year
1
clean-jsdoc-theme
is a beautifully crafted theme for JSDoc 3/JSDoc 4. It is a clean and fully responsive theme with loads of
customisation features.
Some salient features:
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 issue.
To view this theme, visit https://ankdev.me/clean-jsdoc-theme/v4.
If you want to see a demo repo to set up this theme,
visit clean-jsdoc-theme-example. This repo will guide
you step by step on how to set up JSDoc and clean-jsdoc-theme
in your existing repo.
Note : you must have
node
andnpm
installed on your machine.
In a terminal, type :
1npm install clean-jsdoc-theme --save-dev 2# or 3yarn add clean-jsdoc-theme -D
In your projects package.json
file, add a script to generate the documentation using JSDoc :
1"scripts": { 2 "generate-docs": "jsdoc --configure jsdoc.json --verbose" 3}
Heads Up! In the above
generate_docs
script, the value of the--configure
option isjsdoc.json
. Make sure thejsdoc.json
file exists as it contains the JSDoc configuration. If you have your JSDoc config in a different file, replacejsdoc.json
with its name.
In your jsdoc.json
file, add a template option to use clean-jsdoc-theme
instead of the default JSDoc theme:
1"opts": { 2 "template": "node_modules/clean-jsdoc-theme" 3}
Now, run the previously added script to generate the documentation :
1npm run generate-docs
For more information, look at the clean-jsdoc-theme-example repository.
1{ 2 "source": { 3 "include": ["lib", "package.json", "README.md"], 4 "includePattern": ".js$", 5 "excludePattern": "(node_modules/|docs)" 6 }, 7 "plugins": ["plugins/markdown"], 8 "opts": { 9 "encoding": "utf8", 10 "readme": "./README.md", 11 "destination": "docs/", 12 "recurse": true, 13 "verbose": true, 14 "template": "./node_modules/clean-jsdoc-theme", 15 "theme_opts": { 16 "default_theme": "dark" 17 } 18 }, 19 "markdown": { 20 "hardwrap": false, 21 "idInHeadings": true 22 // This is important for clean-jsdoc-theme, otherwise some features might not work. 23 } 24}
To set the default theme, add the following in your JSDoc config file:
1"theme_opts": { 2 "default_theme": "dark" // "light", "fallback-dark", "fallback-light" 3}
If you set default theme as "fallback-dark"
, then clean-jsdoc-theme
will try to detect user's preferred color scheme. If it will detect successfully then it will set user's preferred theme else fallback to dark theme.
Same if you set default theme as "fallback-light"
, it will try to detect user's preferred theme. If not then fallback to light theme.
To set the base url, add the following in your JSDoc config file:
1"theme_opts": { 2 "base_url": "https://ankdev.me/v4/" 3}
Make sure to add a forward slash (
/
) at the end of the URL.
The default value of base_url
is computed with the following code:
1const path = document.location.pathname; 2const baseURL = path.substr(0, path.lastIndexOf('/') + 1);
To set a favicon, add the following in your JSDoc config file:
1"theme_opts": { 2 "favicon": "path/to/img" 3}
You can use static_dir
option to copy all you static files to output dir and use that path instead
of path/to/img
. This will not flatten the output file path, it will preserve the directory structure. If you want to
flatten the output dir use jsdoc default copy static files options
To add the title of the homepage use the homepageTitle
property as follows:
1"theme_opts": { 2 "homepageTitle": "Clean JSDoc theme" 3}
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:
1"theme_opts": { 2 "title": "<img src='path/to/img' class='my-custom-class'/>" // or "title": "clean-jsodc-theme" 3}
You can use static_dir
option to copy all you static files to output dir and use that path in place
of path/to/img
.
By default clean-jsdoc-theme
will not include the list of files in the homepage. If you want to add them the do the following
1"theme_opts": { 2 "includeFilesListInHomepage": true // by default it is false. 3}
Note: You need to add @file tag in the .js if you want to include it in the file list. For more details on
@file
visit: https://jsdoc.app/tags-file.html
To render extra link(s) in navbar. It accepts an array of objects:
1"theme_opts": { 2 "menu": [ 3 { 4 "title": "Website", 5 "link": "https://ankdev.me/clean-jsdoc-theme/dark/", 6 "target": "_blank", 7 "class": "some-class", 8 "id": "some-id" 9 }, 10 { 11 // more if you want to. 12 } 13 ] 14}
menu
is an array of objects. Each object has five properties, out of which two are required (title
and link
). If
an object doesn't have the required properties, then you might expect an error.
Properties
name | type | required |
---|---|---|
title | string | required |
link | string | required |
target | string | optional |
class | string | optional |
id | string | optional |
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
of meta
tags into head
.
1"theme_opts": { 2 "sections": ["Classes", "Modules", "Global"] // Only three members will be in the sidebar. 3}
1// SECTION_TYPE 2[ 3 'Classes', 4 'Modules', 5 'Externals', 6 'Events', 7 'Namespaces', 8 'Mixins', 9 'Tutorials', 10 'Interfaces', 11 'Global' 12];
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
.
1"theme_opts": { 2 "meta": [ 3 { 4 "name": "author", 5 "content": "Ankit Kumar" 6 }, 7 { 8 "name": "description", 9 "content": "Best Clean and minimal JSDoc 3 Template/Theme" 10 } 11 ] 12}
meta
is an array of objects. Each objects can have any valid combination
of HTML metadata attributes.
By default, the search feature is enabled in the theme.
Make sure you have added the
base_url
option as well, otherwise your search query might fail.If you want to disable the search feature, you can do the following:
1"theme_opts": { 2 "search": false 3}
How does the search work?
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.
Note: currently, this feature is only enabled for the examples section.
1"theme_opts": { 2 "codepen": { 3 "enable_for": ["examples"], 4 "options": { 5 "js_external": "https://code.jquery.com/jquery-3.6.0.min.js", 6 "js_pre_processor": "babel" 7 } 8 } 9}
options
can be any valid CodePen option. For more
visit: Codepen Prefill options
If you want to add some js in the beginning of your example then you can use js
option.
1"theme_opts": { 2 "codepen": { 3 "enable_for": ["examples"], 4 "options": { 5 "js_external": "https://code.jquery.com/jquery-3.6.0.min.js", 6 "js_pre_processor": "babel" 7 "js": "import Something from 'some-package'" 8 } 9 } 10}
Let say you have an example as follows:
1/** 2 * @example 3 * let a = Something.fn() 4 * console.log(a) // Return value of something 5 */ 6const a;
In codepen the above @example
will look like:
1import Something from 'some-package'; 2 3let a = Something.fn(); 4console.log(a); // Return value of something
To include static files:
1"theme_opts": { 2 "static_dir": ["./static"], 3}
To create custom style rules. Example:
1"theme_opts": { 2 "create_style": ".sidebar-title { font-size: 2rem }" 3}
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
Note: you have to pass an array of objects. Each object key will be an attribute inside the generated style tag.
Example:
1"add_style_path": [ 2 { 3 "href": "https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css", 4 "integrity": "sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1", 5 "crossorigin": "anonymous" 6 } 7],
To include css files. Example:
1"theme_opts": { 2 "include_css": ["./static/index.css", "./src/docs/index.css"] 3}
Note: you are not required to manually copy file to output dir.
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.
If you wish to incorporate JavaScript functions that execute when a user accesses a webpage, you can utilize the add_scripts option for this purpose. For instance, suppose you want to display a notification dialog when a user visits the webpage located at https://place-where-my-docs-are/SomeClass.html. You want to notify users that they should refrain from utilizing this class. To accomplish this, you can proceed as follows:
1"theme_opts": { 2 "add_scripts": "function showAlert(){ if (window.location.pathname === '/SomeClass.html') { alert('Do not use this class') } } showAlert();", 3}
Writing js code like above can get tricky and complex. You can consider include_js
.
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
Note: you have to pass an array of objects, and object keys are actually the attributes which you want in you script tag.
Example:
1"add_script_path": [ 2 { 3 "href": "https://code.jquery.com/jquery-3.5.1.js", 4 "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=", 5 "crossorigin": "anonymous" 6 } 7],
This will copy the static folder to the output dir.
Note: if the directory doesn't exist then you may get an error. Also, directory is relative to your jsdoc config file.
This will not flatten the directory. Directory structure will be kept as it is.
If you wish to run some local/custom javascript then you can include them via include_js
.
Lets say you want to show some custom message depending on url. You can create a js file as follows:
1// static/showAlert.js 2function showCustomAlertMessage() { 3 const pathname = window.location.pathname; 4 5 switch (pathname) { 6 case '/SomeClass.html': 7 return alert("Please don't use this class"); 8 case '/OtherPage.html': 9 return alert('Wonderful!'); 10 default: 11 return; 12 } 13} 14 15showCustomAlert();
Assuming the above js file is stored in ./static/showAlert.js
. To include you can do:
1"theme_opts": { 2 "include_js": ["./static/showAlert.js"] 3}
Note: you are not required to manually copy file to output dir.
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.
If you want to add some script for some pages then you can do the following:
1"include_js": [ 2 "./demo/src/assets/script.js", 3 { 4 "filepath": "./demo/src/assets/random.js", 5 "targets": [ 6 "MyClass", 7 "tutorial-MyClassTutorial" 8 ] 9 } 10],
Here target is the name of the generated html file (don't include .html
).
The above config will add ./demo/src/assets/script.js
to all the generated html files. However, it will
add ./demo/src/assets/random.js
only to MyClass.html
and tutorial-MyClassTutorial.html
files.
The file name of the generated html generally follows the following convention:
.html
. Ex Alive.html
module-
+ module's name + .html
. Ex: module-SqlJs.html
tutorial-
+ tutorial's filename + .html
If you are not sure about the target name, then generate html for the first time, then look at the urls.
To ignore the sorting of members/methods/event in the page. If it is false
then the order of
members/methods/events will be in the order they are in code/source.
1"theme_opts": { 2 "sort": false 3}
1"theme_opts": { 2 "footer": "This is footer" // or <div class="footer-wrapper">This is a footer </div> 3}
To exclude inherited symbols. Example:
1"exclude_inherited": true
This will remove all symbols (members, methods ...) that come from inherited parents.
name | default | use case | expected value(s) |
---|---|---|---|
default_theme | "dark" | To set the default theme | "light", "dark" , "fallback-light" or "fallback-dark" |
homepageTitle | "Home" | To set the title of homepage | string |
title | null | To set the title | HTML or string |
base_url | / | To set the base URL | string |
menu | null | To render extra link in navbar | Array of Object(s) |
meta | null | Meta tag attributes | Array of Object(s) |
search | true | To render search or not | true or false |
codepen | {} | To open code in codepen | Object |
static_dir | null | To include static dir | Array of string |
create_style | null | To create custom style rules | string |
add_style_path | null | To add external css libraries/files | Array of Object(s) |
include_css | null | To include css files | Array of string |
add_scripts | null | To create custom script | string |
add_script_path | null | To add external js libraries/files | Array of Object(s) |
include_js | null | To include js files | string |
footer | null | To render footer | HTML or string |
exclude_inherited | false | To exclude inherited symbols | boolean |
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> |
displayModuleHeader | false | If you want the module name to appear on its page | boolean |
includeFilesListInHomepage | false | If you want to add or remove the list of files in homepage | boolean |
sort | true | To sort the output members/methods/events | boolean |
Don't forget to add the following in your jsdoc config file, otherwise toc will not work on some pages.
1"markdown": { 2 "idInHeadings": true // This is important for clean-jsdoc-theme, otherwise some features might not work. 3}
Changelog is moved to https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/CHANGELOG.md
Before starting please go through our contributing guide.
1git clone https://github.com/ankitskvmdam/clean-jsdoc-theme.git 2cd clean-jsdoc-theme 3npm install 4npm install jsdoc --no-save 5npm run build
npm run build
will generate files in output folder.
Thanks to fuse.js, hljs,tippy.js, and all awesome contributors.
If you like my work, then give me a star.
Mail me at: hello@ankdev.me
Licensed under the MIT license.
No vulnerabilities found.
No security vulnerabilities found.
clean-jsdoc-theme
A beautifully crafted theme/template for JSDoc 3. This theme/template looks and feels like a premium theme/template. This is a fully mobile responsive theme and also fully customizable theme.
docdash
A clean, responsive documentation template theme for JSDoc 3 inspired by lodash and minami
jsdoc-type-pratt-parser
[![Npm Package](https://badgen.net/npm/v/jsdoc-type-pratt-parser)](https://www.npmjs.com/package/jsdoc-type-pratt-parser) [![Test Status](https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/actions/workflows/test.yml/badge.svg?branch=main)]
eslint-plugin-jsdoc
JSDoc linting rules for ESLint.