Skip to content

Commit

Permalink
API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Oct 6, 2016
1 parent c2e3185 commit 5536e3b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 20 deletions.
28 changes: 22 additions & 6 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const jsdoc2md = require('jsdoc-to-markdown')
* [.getTemplateData([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateData) ⇒ <code>Promise</code>
* [.getJsdocData([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocData) ⇒ <code>Promise</code>
* [.clear()](#module_jsdoc-to-markdown--JsdocToMarkdown+clear) ⇒ <code>Promise</code>
* [.getNamepaths(options)](#module_jsdoc-to-markdown--JsdocToMarkdown+getNamepaths) ⇒ <code>object</code>
* _sync_
* [.renderSync([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+renderSync) ⇒ <code>string</code>
* [.getTemplateDataSync([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateDataSync) ⇒ <code>Array.&lt;object&gt;</code>
Expand Down Expand Up @@ -67,7 +68,7 @@ Pass in filepaths (`**` glob matching supported) of javascript source files:
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateData"></a>

### jsdoc2md.getTemplateData([options]) ⇒ <code>Promise</code>
Returns template data (jsdoc-parse output).
Returns the template data (jsdoc-parse output) which is fed into the output template (dmd).

**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: async
Expand All @@ -83,7 +84,7 @@ Returns template data (jsdoc-parse output).
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocData"></a>

### jsdoc2md.getJsdocData([options]) ⇒ <code>Promise</code>
Returns raw jsdoc data.
Returns raw data direct from the underlying [jsdoc3](https://github.com/jsdoc3/jsdoc).

**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: async
Expand All @@ -95,7 +96,7 @@ Returns raw jsdoc data.
| [options.cache] | <code>boolean</code> | Set to false to disable memoisation cache. Defaults to true. |
| [options.files] | <code>string</code> &#124; <code>Array.&lt;string&gt;</code> | One or more filenames to process. Accepts globs (e.g. `*.js`). Either `files`, `source` or `data` must be supplied. |
| [options.source] | <code>string</code> | A string containing source code to process. Either `files`, `source` or `data` must be supplied. |
| [options.configure] | <code>string</code> | The path to the configuration file. Default: path/to/jsdoc/conf.json. |
| [options.configure] | <code>string</code> | The path to the [jsdoc configuration file](http://usejsdoc.org/about-configuring-jsdoc.html). Default: path/to/jsdoc/conf.json. |
| [options.html] | <code>boolean</code> | Enable experimental documentation of `.html` files. |


Expand All @@ -109,12 +110,27 @@ Clear the cache.
**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: async

-

<a name="module_jsdoc-to-markdown--JsdocToMarkdown+getNamepaths"></a>

### jsdoc2md.getNamepaths(options) ⇒ <code>object</code>
Returns all [jsdoc namepaths](http://usejsdoc.org/about-namepaths.html) found in the supplied source code.

**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: async

| Param | Type | Description |
| --- | --- | --- |
| options | <code>object</code> | options to pass to [getTemplateData](#module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateData) |


-

<a name="module_jsdoc-to-markdown--JsdocToMarkdown+renderSync"></a>

### jsdoc2md.renderSync([options]) ⇒ <code>string</code>
Sync version of `render`.
Sync version of [render](#module_jsdoc-to-markdown--JsdocToMarkdown+render).

**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: sync
Expand All @@ -134,7 +150,7 @@ const docs = jsdoc2md.renderSync('lib/*.js')
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateDataSync"></a>

### jsdoc2md.getTemplateDataSync([options]) ⇒ <code>Array.&lt;object&gt;</code>
Sync version of `getTemplateData`.
Sync version of [getTemplateData](#module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateData).

**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: sync
Expand All @@ -149,7 +165,7 @@ Sync version of `getTemplateData`.
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocDataSync"></a>

### jsdoc2md.getJsdocDataSync([options]) ⇒ <code>Array.&lt;object&gt;</code>
Sync version of `getJsdocData`.
Sync version of [getJsdocData](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocData).

**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: sync
Expand Down
3 changes: 3 additions & 0 deletions es5/test/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ try {
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4');
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json';
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json';
process.on('beforeExit', function () {
return jsdoc2md._usage.send();
});

var runner = new TestRunner();
var inputFile = 'src/test/fixture/ignore.js';
Expand Down
4 changes: 0 additions & 4 deletions es5/test/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ var fs = require('fs');
try {
fs.mkdirSync('tmp-test');
} catch (err) {}
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4');
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json';
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json';

var runner = new TestRunner();
var inputFile = 'src/test/fixture/ignore.js';

Expand Down
18 changes: 12 additions & 6 deletions src/lib/jsdoc-to-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class JsdocToMarkdown {
}

/**
* Sync version of `render`.
* Sync version of {@link module:jsdoc-to-markdown#render}.
*
* @param [options] {object} - Identical options to {@link module:jsdoc-to-markdown#render}.
* @return {string}
Expand All @@ -77,7 +77,7 @@ class JsdocToMarkdown {
}

/**
* Returns template data (jsdoc-parse output).
* Returns the template data (jsdoc-parse output) which is fed into the output template (dmd).
*
* @param [options] {object} - Identical options to {@link module:jsdoc-to-markdown#getJsdocData}.
* @return {Promise}
Expand All @@ -92,7 +92,7 @@ class JsdocToMarkdown {
}

/**
* Sync version of `getTemplateData`.
* Sync version of {@link module:jsdoc-to-markdown#getTemplateData}.
*
* @param [options] {object} - Identical options to {@link module:jsdoc-to-markdown#getJsdocData}.
* @return {object[]}
Expand All @@ -106,13 +106,13 @@ class JsdocToMarkdown {
}

/**
* Returns raw jsdoc data.
* Returns raw data direct from the underlying [jsdoc3](https://github.com/jsdoc3/jsdoc).
*
* @param [options] {object} - the options
* @param [options.cache] {boolean} - Set to false to disable memoisation cache. Defaults to true.
* @param [options.files] {string|string[]} - One or more filenames to process. Accepts globs (e.g. `*.js`). Either `files`, `source` or `data` must be supplied.
* @param [options.source] {string} - A string containing source code to process. Either `files`, `source` or `data` must be supplied.
* @param [options.configure] {string} - The path to the configuration file. Default: path/to/jsdoc/conf.json.
* @param [options.configure] {string} - The path to the [jsdoc configuration file](http://usejsdoc.org/about-configuring-jsdoc.html). Default: path/to/jsdoc/conf.json.
* @param [options.html] {boolean} - Enable experimental documentation of `.html` files.
* @return {Promise}
* @fulfil {object[]}
Expand All @@ -124,7 +124,7 @@ class JsdocToMarkdown {
}

/**
* Sync version of `getJsdocData`.
* Sync version of {@link module:jsdoc-to-markdown#getJsdocData}.
*
* @param [options] {object} - Identical options to {@link module:jsdoc-to-markdown#getJsdocData}.
* @return {object[]}
Expand All @@ -144,6 +144,12 @@ class JsdocToMarkdown {
return jsdocApi.cache.clear().then(() => dmd.cache.clear())
}

/**
* Returns all [jsdoc namepaths](http://usejsdoc.org/about-namepaths.html) found in the supplied source code.
* @param {object} - options to pass to {@link module:jsdoc-to-markdown#getTemplateData}
* @returns {object}
* @category async
*/
getNamepaths (options) {
return this.getTemplateData(options)
.then(data => {
Expand Down
1 change: 1 addition & 0 deletions src/test/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ try {
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4')
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json'
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json'
process.on('beforeExit', () => jsdoc2md._usage.send())

const runner = new TestRunner()
const inputFile = 'src/test/fixture/ignore.js'
Expand Down
4 changes: 0 additions & 4 deletions src/test/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ try {
} catch (err) {
// exists
}
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4')
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json'
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json'

const runner = new TestRunner()
const inputFile = 'src/test/fixture/ignore.js'

Expand Down

0 comments on commit 5536e3b

Please sign in to comment.