Documentation

Documentation

new Documentation(configopt)

Source:

Generates API documentation

The default JSDoc plugin specified in jsdocConfig strips out all of the code from a file while retaining newlines (unlike the built in commentsOnly plugin that ships with JSDoc3).

That way:

  1. line numbers are preserved in the source view
  2. you don't need to use a pre-compiler, you will always see the same code as you wrote in the docs source view
  3. since JSDoc only sees comments you can use any code syntax you like - ES2015, ES7, JSX, it doesn't even have to be JavaScript.

The markdown plugin is also included by default.

Example
import {Documentation} from 'webcompiler';
// or - import {Documentation} from 'webcompiler/lib/Documentation';
// or - var Documentation = require('webcompiler').Documentation;
// or - var Documentation = require('webcompiler/lib/Documentation').Documentation;

const docs = new Documentation();

docs.run();
Parameters:
Name Type Attributes Default Description
config DocumentationConfig <optional>
{}

a configuration object

Methods

run(callbackopt)

Source:

Generate the documentation

Parameters:
Name Type Attributes Default Description
callback function <optional>
function () {}

a callback function

watch(callbackopt)

Source:

Watch for changes and automatically re-build the documentation.

Please install, enable and, optionally, allow access to file urls (if you want to be able to browse the generated documentation without the need for a server) to the LiveReload browser extension.

Parameters:
Name Type Attributes Default Description
callback function <optional>
function () {}

a callback function