
Dokker.js creates professional Javascript code documentations.
See Dokker.js documentation as example.
Dokker is available as npm package. So the easiest way is to install dokker as local module into your project:
npm install dokker
After installation you can execute Dokker with the help of several terminal commands.
Bootstrap Dokker project
Dokker needs a configuration file to execute, such as a .travis or .jshintrc. You can easily create .dokker.json file with the ./node_modules/dokker/bin/init command from the root directory of your project or copy an example file.
Dokker provides a default template for your project. The template is based on an ejs file. Either you use the default template or modify it. If you choose for the latter you can copy the templates directory and tweak the ejs files how you like.
Create documentation
Creating a documentation is really simple with the help of Dokker. You just configure the .dokker.json file and execute ./node_modules/dokker/bin/dokker. Then you’re done.
Live edit your documentation
If you want to work on your source file and see how the documentation evolves, you can do ./node_modules/dokker/bin/watch and it will open a browser with live preview.
Deploy to Github Pages
If you want to deploy your documentation to Github Pages, run ./node_modules/dokker/bin/gh-pages. Finally a separate branch, named gh-pages is created from the docs folder. That is enough for Github to serve your documentation. Please do not forget to git commit your changes before your run gh-pages command.
Some examples by our users. Let us know what you did with Dokker too!
“Github Pages” MethodsDokker.ghPages()Runs a terminal shell with the git command to extract the docs branch into a seperate gh-pages branch and finally pushes that branch to Github, so that the Github page is updated.
(Promise): Returns a resolved promise if file was created.
Dokker.ghPages()
.then(function(){
// => resolved promise
});
“JSDoc” MethodsDokker.injectTemplate([options])Creates a HTML file that transcludes the HTML snippet that was created by the docdown module into an ejs template which is defined by the .dokker.json configuration file.
[options] (Object): The options object.[options.template='template/index.ejs.html'] (String): The path to the ejs template file.[options.html='docs/index.html'] (string): The path to the docdown generated JSDoc documentation.[options.readme='README.md'] (string): The path to the README.md file.[options.title=''] (string): The title for the documentation.(Promise): Returns a resolved promise if file was created.
var options = {
template: 'template/index.ejs.html',
html: 'docs/index.html',
readme: 'docs/README.md',
title: 'Dokker.js API Documentation'
};
Dokker.injectTemplate(options)
.then(function(){
// => resolved promise
});
Dokker.jsdocHtml([options])Create an HTML file from the Markdown file that was create with Dokker.jsdocMarkdown()
[options] (Object): The options object.[options.markdown='docs/READMDE.md'] (string): The path where to save the Markdown file.(Promise): Returns a resolved promise if file was created.
var options = {
markdown: 'docs/README.md'
};
Dokker.jsdocHtml()
.then(function(){
// => resolved promise
});
Dokker.jsdocMarkdown([options])Create a Markdown file from JSDoc tags.
[options] (Object): The options object.[options.source='app.js'] (String): The path the source code with JSDoc tags.[options.github =''] (String): The path the Github repository.[options.markdown='docs/READMDE.md'] (string): The path where to save the Markdown file.(Promise): Returns a resolved promise if file was created.
var options = {
source: 'app.js',
markdown: 'docs/README.md'
};
Dokker.jsdocMarkdown()
.then(function(){
// => resolved promise
});
“Literate programming” MethodsDokker.literate([options])Create a styled HTML file from your source code with the help of docco module.
[options] (Object): The options object.[options.source='app.js'] (String): The path the source code with comments[options.dir='docs/annotated'] (string): The directory where to save the generated HTML file.(Promise): Returns a resolved promise if file was created.
var options = {
dir: 'docs',
source: 'app.js'
};
Dokker.literate()
.then(function(){
// => resolved promise
});
“Mocha” MethodsDokker.createTests([options])Creates an HTML file to describe the features of your module from your Mocha tests. The module is using the mocha doc reporter to generate the HTML contents.
[options] (Object): The options object.[options.path='docs.html'] (String): The path where to save the HTML file(Promise): Returns a resolved promise if file was created.
var options = {
path: 'docs/tests.html',
};
Dokker.createTests(options)
.then(function(){
// => resolved promise
});
“Utility” MethodsDokker.configure([options])Helper function that takes a couple of options arguments and normalises them and subsequently returns them.
[options] (Object): The options object.[options.li.markdown='docs/READMDE.md'] (string): The path where to[options.source='app.js'] (String): The path the source code with JSDoc tags.[options.jsdoc.markdown='docs/READMDE.md'] (string): The path where to save the Markdown file.[options.jsdoc.README ='READMDE.md'] (string): The path to the project’s README.md file[options.jsodc.template ='templates/index.ejs.html'] (String): The path to the ejs template.[options.mocha.template='templates/tests.ejs.html'] (String): The path to the mocha template.[options.dir='docs'] (String): The path where to store the generated files(Promise): Returns a resolved promise with edited options object
var options = {
dir: 'docs',
literate: {
source: 'dokker.js',
dir: 'annotated'
},
jsdoc: {
title: 'Dokker.js',
source: 'dokker.js',
markdown: 'README.md',
html: 'index.html',
readme: 'README.md',
}
};
Dokker.jsdocHtml()
.then(function(){
// => object with absolute pathes to the directory from
// which the command was executed
});
Dokker.copyTemplate([options])Copy the template to local directory so that one can make changes to ejs files.
[options] (Object): The options object.[options.dir='templates'] (string): The path where to save the template files(Promise): Returns a resolved promise if files were created.
var options = {
dir: 'template'
};
Dokker.copyTemplate()
.then(function(){
// => resolved promise
});