Skip to content

Create a README template

Lloyd Brookes edited this page Oct 9, 2016 · 1 revision

jsdoc2md currently uses handlebars to generate the output. The partials and helpers involved in creating the output are managed by the dmd project.

The default template content is simply '{{>main}}', which renders the output of this handlebars partial. So, a README template could be created by dropping {{>main}} into your standard README structure. Step by step tutorial:

1. Create a file name README.hbs with this content.

[![view on npm](http://img.shields.io/npm/v/example.svg)](https://www.npmjs.org/package/example)

{{>main}}

* * *

© 1942-2016 Muhammad Ali

2. Write some documented source code, e.g.

/**
 * A module for adding two values.
 * @module add-two-values
 */

/**
 * Add two values.
 * @alias module:add-two-values
 */
function add (a, b) {
  return a + b
}

module.exports = add

3. Use the custom template by passing its filename to the --template option:

$ jsdoc2md --template README.hbs --files example.js

4. Output:

view on npm

add-two-values

A module for adding two values.

add() ⏏

Add two values.

Kind: Exported function


© 1942-2016 Muhammad Ali

Clone this wiki locally