View on GitHub

thought

A customizable documentation generator for github projects

Examples, License, JSDoc, Badges

If you want people to use your module, you probably want to add some more documentation

If you add all those files, your module might look like this:


example-project-2-example-license-jsdoc-badges/
├─┬ .thought/
│ └── config.js
├── .travis.yml
├── LICENSE.md
├─┬ examples/
│ └── example.js
├── index.js
└── package.json

About Example files

The example file for the project looks like this:

const multiply = require('../')

const x = 3
const y = 4
const xy = multiply(x, y)

console.log(xy)

Note that the example uses require('../') instead of require('example-project-2-example-license-jsdoc-badges') to reference the current project.

That is the case, because otherwise you could not run the example. If you cannot run it, how do you know it is still working? Still, you don’t want require('example-project-2-example-license-jsdoc-badges') in your README, which is why Thought detected references to the current module and replaces them by the module name.

Thought will also execute the example and include the output in the README, so that your users don’t have to download and run the example themselves.

Result

The complete project, after running thought run -a looks like this, you can click on the links to view the actual files:


example-project-2-example-license-jsdoc-badges/
├─┬ .thought/
│ └── config.js
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├─┬ examples/
│ └── example.js
├── index.js
└── package.json

Tutorial & Examples:

Back to the README