Before reading this documentation, I sincerely suggest that you read the README before that if you haven't done so.
It's not very long, but it's worth it.
docgenerator requires a dependency before anything else:
Once you've installed it, you can:
npm install docgenerator
This will create a node_modules folder, within which the docgenerator
module will live.
docgenerator provides two methods:
set: sets a value to a property.generate: generates the documentation with the properties.Basically, you need to provide docgenerator enough properties for it to generate your documentation.
This is a typical example of what a generator should look like:
var generator = require( 'docgenerator' );
// Create the array of original files
var files = [
'original/1. Chapter One.md',
'original/2. Chapter Two.md',
'original/3. Chapter Three.md'
];
// Now that we have the files, we can set the options
// and generate the documentation.
generator
.set( 'option', 'value' )
// The "files" options expects an array of files.
// Good! We just built this array before :-)
.set( 'files', files )
// Run!
.generate();
Here is the list of options supported and their type expected:
files: Array expected. These are the original markdown files to be converted.output: String expected. This is the HTML file to generate.table: Boolean expected. Enables the table extension of markdown_py.theme: String expected. Chooses the theme to use for the generated documentation.title: String expected. Sets the title of the documentation.toc: Boolean expected. Enables the creation of a table of contents.docgenerator provides some themes by default.
These themes are:
However, it also provides you a way to define your own themes.
When setting the theme, use a string like custom:path/to/theme. Example:
generator
.set( 'theme', 'custom:themes/mytheme' )
.generate();
This code will look in the themes/mytheme folder for CSS and JS files and add
them to the generated documentation. For convenience, these files are sorted
with the javascript sort() method.