Socket
Socket
Sign inDemoInstall

jsdoc-to-markdown

Package Overview
Dependencies
81
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-alpha.16 to 2.0.0-alpha.17

es5/lib/dmd-options.js

276

docs/API.md
<a name="module_jsdoc-to-markdown"></a>
## jsdoc-to-markdown
# jsdoc-to-markdown
**Example**

@@ -10,35 +10,12 @@ ```js

* [jsdoc-to-markdown](#module_jsdoc-to-markdown)
* _static_
* [.clear()](#module_jsdoc-to-markdown.clear) ⇒ <code>Promise</code>
* [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown) ⇐ <code>JsdocToMarkdownCore</code> ⏏
* _async_
* [.render([options])](#module_jsdoc-to-markdown.render) ⇒ <code>Promise</code>
* [.getTemplateData([options])](#module_jsdoc-to-markdown.getTemplateData) ⇒ <code>Promise</code>
* [.getJsdocData([options])](#module_jsdoc-to-markdown.getJsdocData) ⇒ <code>Promise</code>
* [.render([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+render) ⇒ <code>Promise</code>
* [.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>
* _sync_
* [.renderSync([options])](#module_jsdoc-to-markdown.renderSync) ⇒ <code>string</code>
* [.getTemplateDataSync([options])](#module_jsdoc-to-markdown.getTemplateDataSync) ⇒ <code>Array.&lt;object&gt;</code>
* [.getJsdocDataSync([options])](#module_jsdoc-to-markdown.getJsdocDataSync) ⇒ <code>Array.&lt;object&gt;</code>
* _inner_
* [~JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)
* [.cache](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+cache)
* [.files](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+files) : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
* [.source](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+source) : <code>string</code>
* [.configure](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+configure) : <code>string</code>
* [.html](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+html) : <code>boolean</code>
* [~DmdOptions](#module_jsdoc-to-markdown..DmdOptions)
* [.template](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+template) : <code>string</code>
* [.heading-depth](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+heading-depth) : <code>number</code>
* [.example-lang](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+example-lang) : <code>string</code>
* [.plugin](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+plugin) : <code>array</code>
* [.helper](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+helper) : <code>array</code>
* [.partial](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+partial) : <code>array</code>
* [.name-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+name-format) : <code>string</code>
* [.no-gfm](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+no-gfm) : <code>boolean</code>
* [.separators](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+separators) : <code>boolean</code>
* [.module-index-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+module-index-format) : <code>string</code>
* [.global-index-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+global-index-format) : <code>string</code>
* [.param-list-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+param-list-format) : <code>string</code>
* [.property-list-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+property-list-format) : <code>string</code>
* [.member-index-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+member-index-format) : <code>string</code>
* [.private](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+private) : <code>boolean</code>
* [.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>
* [.getJsdocDataSync([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocDataSync) ⇒ <code>Array.&lt;object&gt;</code>

@@ -48,12 +25,11 @@

<a name="module_jsdoc-to-markdown.clear"></a>
<a name="exp_module_jsdoc-to-markdown--JsdocToMarkdown"></a>
### jsdoc2md.clear() ⇒ <code>Promise</code>
Clear the cache.
## JsdocToMarkdown ⇐ <code>JsdocToMarkdownCore</code> ⏏
**Kind**: Exported class
**Extends:** <code>JsdocToMarkdownCore</code>
**Kind**: static method of <code>[jsdoc-to-markdown](#module_jsdoc-to-markdown)</code>
-
<a name="module_jsdoc-to-markdown.render"></a>
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+render"></a>

@@ -63,3 +39,3 @@ ### jsdoc2md.render([options]) ⇒ <code>Promise</code>

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

@@ -70,3 +46,3 @@ **Fulfil**: <code>string</code> - the rendered docs

| --- | --- | --- |
| [options] | <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code> &#124; <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code> | the options |
| [options] | <code>[JsdocOptions](#JsdocOptions)</code> &#124; <code>[DmdOptions](#DmdOptions)</code> | the options |

@@ -81,3 +57,3 @@ **Example**

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

@@ -87,3 +63,3 @@ ### jsdoc2md.getTemplateData([options]) ⇒ <code>Promise</code>

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

@@ -94,3 +70,3 @@ **Fulfil**: <code>object[]</code> - the json data

| --- | --- | --- |
| [options] | <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code> | the options |
| [options] | <code>[JsdocOptions](#JsdocOptions)</code> | the options |

@@ -100,3 +76,3 @@

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

@@ -106,3 +82,3 @@ ### jsdoc2md.getJsdocData([options]) ⇒ <code>Promise</code>

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

@@ -113,3 +89,3 @@ **Fulfil**: <code>object[]</code>

| --- | --- | --- |
| [options] | <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code> | the options |
| [options] | <code>[JsdocOptions](#JsdocOptions)</code> | the options |

@@ -119,8 +95,18 @@

<a name="module_jsdoc-to-markdown.renderSync"></a>
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+clear"></a>
### jsdoc2md.clear() ⇒ <code>Promise</code>
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+renderSync"></a>
### jsdoc2md.renderSync([options]) ⇒ <code>string</code>
Returns markdown documentation from jsdoc-annoted source code.
**Kind**: static method of <code>[jsdoc-to-markdown](#module_jsdoc-to-markdown)</code>
**Kind**: instance method of <code>[JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)</code>
**Category**: sync

@@ -131,3 +117,3 @@ **Engine**: nodejs >= 0.12

| --- | --- | --- |
| [options] | <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code> &#124; <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code> | the options |
| [options] | <code>[JsdocOptions](#JsdocOptions)</code> &#124; <code>[DmdOptions](#DmdOptions)</code> | the options |

@@ -141,3 +127,3 @@ **Example**

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

@@ -147,3 +133,3 @@ ### jsdoc2md.getTemplateDataSync([options]) ⇒ <code>Array.&lt;object&gt;</code>

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

@@ -153,3 +139,3 @@

| --- | --- | --- |
| [options] | <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code> | the options |
| [options] | <code>[JsdocOptions](#JsdocOptions)</code> | the options |

@@ -159,3 +145,3 @@

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

@@ -165,3 +151,3 @@ ### jsdoc2md.getJsdocDataSync([options]) ⇒ <code>Array.&lt;object&gt;</code>

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

@@ -171,3 +157,3 @@

| --- | --- | --- |
| [options] | <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code> | the options |
| [options] | <code>[JsdocOptions](#JsdocOptions)</code> | the options |

@@ -177,169 +163,169 @@

<a name="module_jsdoc-to-markdown..JsdocOptions"></a>
### jsdoc2md~JsdocOptions
jsdoc options
**Kind**: inner class of <code>[jsdoc-to-markdown](#module_jsdoc-to-markdown)</code>
<a name="JsdocOptions"></a>
* [~JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)
* [.cache](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+cache)
* [.files](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+files) : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
* [.source](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+source) : <code>string</code>
* [.configure](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+configure) : <code>string</code>
* [.html](#module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+html) : <code>boolean</code>
# JsdocOptions
**Kind**: global class
* [JsdocOptions](#JsdocOptions)
* [.cache](#JsdocOptions+cache)
* [.files](#JsdocOptions+files) : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
* [.source](#JsdocOptions+source) : <code>string</code>
* [.configure](#JsdocOptions+configure) : <code>string</code>
* [.html](#JsdocOptions+html) : <code>boolean</code>
-
<a name="module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+cache"></a>
<a name="JsdocOptions+cache"></a>
#### jsdocOptions.cache
## options.cache
Set to false to disable memoisation cache. Defaults to true.
**Kind**: instance property of <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code>
**Kind**: instance property of <code>[JsdocOptions](#JsdocOptions)</code>
-
<a name="module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+files"></a>
<a name="JsdocOptions+files"></a>
#### jsdocOptions.files : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
## options.files : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
One or more filenames to process. Either this or `source` must be supplied.
**Kind**: instance property of <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code>
**Kind**: instance property of <code>[JsdocOptions](#JsdocOptions)</code>
-
<a name="module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+source"></a>
<a name="JsdocOptions+source"></a>
#### jsdocOptions.source : <code>string</code>
## options.source : <code>string</code>
A string containing source code to process. Either this or `source` must be supplied.
**Kind**: instance property of <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code>
**Kind**: instance property of <code>[JsdocOptions](#JsdocOptions)</code>
-
<a name="module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+configure"></a>
<a name="JsdocOptions+configure"></a>
#### jsdocOptions.configure : <code>string</code>
## options.configure : <code>string</code>
The path to the configuration file. Default: path/to/jsdoc/conf.json.
**Kind**: instance property of <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code>
**Kind**: instance property of <code>[JsdocOptions](#JsdocOptions)</code>
-
<a name="module_jsdoc-to-markdown..JsdocOptions.JsdocOptions+html"></a>
<a name="JsdocOptions+html"></a>
#### jsdocOptions.html : <code>boolean</code>
## options.html : <code>boolean</code>
Enable experimental parsing of `.html` files.
**Kind**: instance property of <code>[JsdocOptions](#module_jsdoc-to-markdown..JsdocOptions)</code>
**Kind**: instance property of <code>[JsdocOptions](#JsdocOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions"></a>
### jsdoc2md~DmdOptions
dmd options
**Kind**: inner class of <code>[jsdoc-to-markdown](#module_jsdoc-to-markdown)</code>
<a name="DmdOptions"></a>
* [~DmdOptions](#module_jsdoc-to-markdown..DmdOptions)
* [.template](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+template) : <code>string</code>
* [.heading-depth](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+heading-depth) : <code>number</code>
* [.example-lang](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+example-lang) : <code>string</code>
* [.plugin](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+plugin) : <code>array</code>
* [.helper](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+helper) : <code>array</code>
* [.partial](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+partial) : <code>array</code>
* [.name-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+name-format) : <code>string</code>
* [.no-gfm](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+no-gfm) : <code>boolean</code>
* [.separators](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+separators) : <code>boolean</code>
* [.module-index-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+module-index-format) : <code>string</code>
* [.global-index-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+global-index-format) : <code>string</code>
* [.param-list-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+param-list-format) : <code>string</code>
* [.property-list-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+property-list-format) : <code>string</code>
* [.member-index-format](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+member-index-format) : <code>string</code>
* [.private](#module_jsdoc-to-markdown..DmdOptions.DmdOptions+private) : <code>boolean</code>
# DmdOptions
**Kind**: global class
* [DmdOptions](#DmdOptions)
* [.template](#DmdOptions+template) : <code>string</code>
* [.heading-depth](#DmdOptions+heading-depth) : <code>number</code>
* [.example-lang](#DmdOptions+example-lang) : <code>string</code>
* [.plugin](#DmdOptions+plugin) : <code>array</code>
* [.helper](#DmdOptions+helper) : <code>array</code>
* [.partial](#DmdOptions+partial) : <code>array</code>
* [.name-format](#DmdOptions+name-format) : <code>string</code>
* [.no-gfm](#DmdOptions+no-gfm) : <code>boolean</code>
* [.separators](#DmdOptions+separators) : <code>boolean</code>
* [.module-index-format](#DmdOptions+module-index-format) : <code>string</code>
* [.global-index-format](#DmdOptions+global-index-format) : <code>string</code>
* [.param-list-format](#DmdOptions+param-list-format) : <code>string</code>
* [.property-list-format](#DmdOptions+property-list-format) : <code>string</code>
* [.member-index-format](#DmdOptions+member-index-format) : <code>string</code>
* [.private](#DmdOptions+private) : <code>boolean</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+template"></a>
<a name="DmdOptions+template"></a>
#### dmdOptions.template : <code>string</code>
## options.template : <code>string</code>
The template the supplied documentation will be rendered into. Use the default or supply your own template for full control over the output.
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+heading-depth"></a>
<a name="DmdOptions+heading-depth"></a>
#### dmdOptions.heading-depth : <code>number</code>
## options.heading-depth : <code>number</code>
The initial heading depth. For example, with a value of `2` the top-level markdown headings look like `"## The heading"`.
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+example-lang"></a>
<a name="DmdOptions+example-lang"></a>
#### dmdOptions.example-lang : <code>string</code>
## options.example-lang : <code>string</code>
Specifies the default language used in @example blocks (for [syntax-highlighting](https://help.github.com/articles/github-flavored-markdown/#syntax-highlighting) purposes). In gfm mode, each @example is wrapped in a fenced-code block. Example usage: `--example-lang js`. Use the special value `none` for no specific language. While using this option, you can override the supplied language for any @example by specifying the `@lang` subtag, e.g `@example @lang hbs`. Specifying `@example @lang off` will disable code blocks for that example.
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+plugin"></a>
<a name="DmdOptions+plugin"></a>
#### dmdOptions.plugin : <code>array</code>
## options.plugin : <code>array</code>
Use an installed package containing helper and/or partial overrides
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+helper"></a>
<a name="DmdOptions+helper"></a>
#### dmdOptions.helper : <code>array</code>
## options.helper : <code>array</code>
handlebars helper files to override or extend the default set
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+partial"></a>
<a name="DmdOptions+partial"></a>
#### dmdOptions.partial : <code>array</code>
## options.partial : <code>array</code>
handlebars partial files to override or extend the default set
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+name-format"></a>
<a name="DmdOptions+name-format"></a>
#### dmdOptions.name-format : <code>string</code>
## options.name-format : <code>string</code>
Format identifier names in the [code](http://daringfireball.net/projects/markdown/syntax#code) style, (i.e. format using backticks or `<code></code>`)
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+no-gfm"></a>
<a name="DmdOptions+no-gfm"></a>
#### dmdOptions.no-gfm : <code>boolean</code>
## options.no-gfm : <code>boolean</code>
By default, dmd generates github-flavoured markdown. Not all markdown parsers render gfm correctly. If your generated docs look incorrect on sites other than Github (e.g. npmjs.org) try enabling this option to disable Github-specific syntax.
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+separators"></a>
<a name="DmdOptions+separators"></a>
#### dmdOptions.separators : <code>boolean</code>
## options.separators : <code>boolean</code>
Put `<hr>` breaks between identifiers. Improves readability on bulky docs.
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
**Default**: <code>false</code>

@@ -349,53 +335,53 @@

<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+module-index-format"></a>
<a name="DmdOptions+module-index-format"></a>
#### dmdOptions.module-index-format : <code>string</code>
## options.module-index-format : <code>string</code>
none, grouped, table, dl
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+global-index-format"></a>
<a name="DmdOptions+global-index-format"></a>
#### dmdOptions.global-index-format : <code>string</code>
## options.global-index-format : <code>string</code>
none, grouped, table, dl
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+param-list-format"></a>
<a name="DmdOptions+param-list-format"></a>
#### dmdOptions.param-list-format : <code>string</code>
## options.param-list-format : <code>string</code>
Two options to render parameter lists: 'list' or 'table' (default). Table format works well in most cases but switch to list if things begin to look crowded / squashed.
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+property-list-format"></a>
<a name="DmdOptions+property-list-format"></a>
#### dmdOptions.property-list-format : <code>string</code>
## options.property-list-format : <code>string</code>
list, table
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+member-index-format"></a>
<a name="DmdOptions+member-index-format"></a>
#### dmdOptions.member-index-format : <code>string</code>
## options.member-index-format : <code>string</code>
grouped, list
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
-
<a name="module_jsdoc-to-markdown..DmdOptions.DmdOptions+private"></a>
<a name="DmdOptions+private"></a>
#### dmdOptions.private : <code>boolean</code>
## options.private : <code>boolean</code>
Show identifiers marked `@private` in the output.
**Kind**: instance property of <code>[DmdOptions](#module_jsdoc-to-markdown..DmdOptions)</code>
**Kind**: instance property of <code>[DmdOptions](#DmdOptions)</code>
**Default**: <code>false</code>

@@ -402,0 +388,0 @@

@@ -49,5 +49,5 @@ 'use strict';

}).catch(tool.halt);
} else if (options.stats) {
_jsdoc2md.getStats(options.files).then(function (json) {
tool.printOutput(JSON.stringify(json, null, ' '));
} else if (options.namepaths) {
_jsdoc2md.getNamepaths(options).then(function (namepaths) {
tool.printOutput(JSON.stringify(namepaths, null, ' '));
}).catch(tool.halt);

@@ -54,0 +54,0 @@ } else {

@@ -25,2 +25,6 @@ 'use strict';

description: 'Enable experimental parsing of .html files. When specified, any configuration supplied via [bold]{--configure} is ignored.'
}, {
name: 'namepaths',
type: Boolean,
description: 'Print namepaths.'
}];

@@ -152,7 +156,7 @@

}, {
cmmd: '$ jsdoc2md <jsdoc-options> [bold]{--namepaths}'
}, {
cmmd: '$ jsdoc2md [bold]{--help}'
}, {
cmmd: '$ jsdoc2md [bold]{--config}'
}, {
cmmd: '$ jsdoc2md [bold]{--stats}'
}]

@@ -159,0 +163,0 @@ }, {

'use strict';
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -9,199 +17,212 @@

var UsageStats = require('app-usage-stats');
var DmdOptions = require('./dmd-options');
var JsdocOptions = require('./jsdoc-options');
var usage = new UsageStats('UA-70853320-3', {
name: 'jsdoc2md',
version: require('../../package').version,
sendInterval: 1000 * 60 * 60 * 24,
metricMap: {
session: 1,
source: 2,
configure: 3,
html: 4,
template: 5,
'heading-depth': 6,
'example-lang': 7,
plugin: 8,
helper: 9,
partial: 10,
'name-format': 11,
'no-gfm': 12,
separators: 13,
'module-index-format': 14,
'global-index-format': 15,
'param-list-format': 16,
'property-list-format': 17,
'member-index-format': 18,
private: 19,
cache: 20
},
dimensionMap: {
interface: 4
var JsdocToMarkdownCore = function () {
function JsdocToMarkdownCore() {
_classCallCheck(this, JsdocToMarkdownCore);
}
});
usage.loadSync();
exports._interface = 'api';
exports.render = function (options) {
return stats(render, options);
};
_createClass(JsdocToMarkdownCore, [{
key: 'render',
value: function render(options) {
options = options || {};
var dmdOptions = new DmdOptions(options);
return this.getTemplateData(options).then(function (templateData) {
return dmd.async(templateData, dmdOptions);
});
}
}, {
key: 'renderSync',
value: function renderSync(options) {
options = options || {};
var dmdOptions = new DmdOptions(options);
return dmd(this.getTemplateDataSync(options), dmdOptions);
}
}, {
key: 'getTemplateData',
value: function getTemplateData(options) {
options = options || {};
var jsdocParse = require('jsdoc-parse');
return this.getJsdocData(options).then(jsdocParse);
}
}, {
key: 'getTemplateDataSync',
value: function getTemplateDataSync(options) {
options = options || {};
var jsdocParse = require('jsdoc-parse');
var jsdocData = this.getJsdocDataSync(options);
return jsdocParse(jsdocData, options);
}
}, {
key: 'getJsdocData',
value: function getJsdocData(options) {
var jsdocOptions = new JsdocOptions(options);
return jsdocApi.explain(jsdocOptions);
}
}, {
key: 'getJsdocDataSync',
value: function getJsdocDataSync(options) {
var jsdocOptions = new JsdocOptions(options);
return jsdocApi.explainSync(jsdocOptions);
}
}, {
key: 'clear',
value: function clear() {
return jsdocApi.cache.clear().then(function () {
return dmd.cache.clear();
});
}
}, {
key: 'getNamepaths',
value: function getNamepaths(options) {
return this.getTemplateData(options).then(function (data) {
var namepaths = {};
var kinds = ['module', 'class', 'constructor', 'mixin', 'member', 'namespace', 'constant', 'function', 'event', 'typedef', 'external'];
kinds.forEach(function (kind) {
namepaths[kind] = data.filter(function (identifier) {
return identifier.kind === kind;
}).map(function (identifier) {
return identifier.longname;
});
});
return namepaths;
});
}
}]);
exports.renderSync = function (options) {
return statsSync(renderSync, options);
};
return JsdocToMarkdownCore;
}();
exports.getTemplateData = function (options) {
return stats(getTemplateData, options);
};
var JsdocToMarkdown = function (_JsdocToMarkdownCore) {
_inherits(JsdocToMarkdown, _JsdocToMarkdownCore);
exports.getTemplateDataSync = function (options) {
return statsSync(getTemplateDataSync, options);
};
function JsdocToMarkdown() {
_classCallCheck(this, JsdocToMarkdown);
exports.getJsdocData = function (options) {
return stats(getJsdocData, options);
};
var _this = _possibleConstructorReturn(this, (JsdocToMarkdown.__proto__ || Object.getPrototypeOf(JsdocToMarkdown)).call(this));
exports.getJsdocDataSync = function (options) {
return statsSync(getJsdocDataSync, options);
};
_this._usage = new UsageStats('UA-70853320-3', {
name: 'jsdoc2md',
version: require('../../package').version,
sendInterval: 1000 * 60 * 60 * 24,
metricMap: {
session: 1,
source: 2,
configure: 3,
html: 4,
template: 5,
'heading-depth': 6,
'example-lang': 7,
plugin: 8,
helper: 9,
partial: 10,
'name-format': 11,
'no-gfm': 12,
separators: 13,
'module-index-format': 14,
'global-index-format': 15,
'param-list-format': 16,
'property-list-format': 17,
'member-index-format': 18,
private: 19,
cache: 20
},
dimensionMap: {
interface: 4
}
});
_this._usage.loadSync();
_this._interface = 'api';
_this._sendOptions = { timeout: 2000 };
exports.clear = function () {
return stats(clear);
};
process.on('exit', function () {
return _this._usage.saveSync();
});
return _this;
}
exports._usageStats = usage;
_createClass(JsdocToMarkdown, [{
key: '_hit',
value: function _hit(method, options) {
var metrics = Object.assign({ session: 1 }, options);
for (var key in metrics) {
metrics[key] = 1;
}
return this._usage.hit({ name: method.name, interface: this._interface }, metrics, this._sendOptions);
}
}, {
key: '_stats',
value: function _stats(method, options) {
var _this2 = this;
function render(options) {
options = options || {};
var dmdOptions = new DmdOptions(options);
return getTemplateData(options).then(function (templateData) {
return dmd.async(templateData, dmdOptions);
});
}
return Promise.all([this._hit(method, options), method.call(this, options).catch(function (err) {
_this2._usage.exception(err.stack, 1, {
hitParams: new Map([['cd', method.name]])
});
return _this2._usage.send(_this2._sendOptions).then(function () {
throw err;
});
})]).then(function (results) {
return results[1];
});
}
}, {
key: '_statsSync',
value: function _statsSync(method, options) {
this._hit(method, options);
try {
return method.call(this, options);
} catch (err) {
this._usage.exception(err.stack, 1, {
hitParams: new Map([['cd', method.name]])
});
this._usage.send(this._sendOptions).catch(function (err) {});
}
}
}, {
key: 'render',
value: function render(options) {
return this._stats(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'render', this), options);
}
}, {
key: 'renderSync',
value: function renderSync(options) {
return this._statsSync(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'renderSync', this), options);
}
}, {
key: 'getTemplateData',
value: function getTemplateData(options) {
return this._stats(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'getTemplateData', this), options);
}
}, {
key: 'getTemplateDataSync',
value: function getTemplateDataSync(options) {
return this._statsSync(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'getTemplateDataSync', this), options);
}
}, {
key: 'getJsdocData',
value: function getJsdocData(options) {
return this._stats(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'getJsdocData', this), options);
}
}, {
key: 'getJsdocDataSync',
value: function getJsdocDataSync(options) {
return this._statsSync(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'getJsdocDataSync', this), options);
}
}, {
key: 'clear',
value: function clear() {
return this._stats(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'clear', this));
}
}, {
key: 'getNamepaths',
value: function getNamepaths(options) {
return this._stats(_get(JsdocToMarkdown.prototype.__proto__ || Object.getPrototypeOf(JsdocToMarkdown.prototype), 'getNamepaths', this), options);
}
}]);
function renderSync(options) {
options = options || {};
var dmdOptions = new DmdOptions(options);
return dmd(getTemplateDataSync(options), dmdOptions);
}
return JsdocToMarkdown;
}(JsdocToMarkdownCore);
function getTemplateData(options) {
options = options || {};
var jsdocParse = require('jsdoc-parse');
return getJsdocData(options).then(jsdocParse);
}
function getTemplateDataSync(options) {
options = options || {};
var jsdocParse = require('jsdoc-parse');
var jsdocData = getJsdocDataSync(options);
return jsdocParse(jsdocData, options);
}
function getJsdocData(options) {
var jsdocOptions = new JsdocOptions(options);
return jsdocApi.explain(jsdocOptions);
}
function getJsdocDataSync(options) {
var jsdocOptions = new JsdocOptions(options);
return jsdocApi.explainSync(jsdocOptions);
}
function clear() {
return jsdocApi.cache.clear().then(function () {
return dmd.cache.clear();
});
}
var JsdocOptions = function JsdocOptions(options) {
_classCallCheck(this, JsdocOptions);
options = options || {};
this.cache = options.cache === undefined ? true : options.cache;
this.files = options.files;
this.source = options.source;
this.configure = options.configure;
this.html = options.html;
};
var DmdOptions = function DmdOptions(options) {
_classCallCheck(this, DmdOptions);
var arrayify = require('array-back');
this.template = options.template || '{{>main}}';
this['heading-depth'] = options['heading-depth'] || 2;
this['example-lang'] = options['example-lang'] || 'js';
this.plugin = arrayify(options.plugin);
this.helper = arrayify(options.helper);
this.partial = arrayify(options.partial);
this['name-format'] = options['name-format'];
this['no-gfm'] = options['no-gfm'];
this.separators = options.separators;
this['module-index-format'] = options['module-index-format'] || 'dl';
this['global-index-format'] = options['global-index-format'] || 'dl';
this['param-list-format'] = options['param-list-format'] || 'table';
this['property-list-format'] = options['property-list-format'] || 'table';
this['member-index-format'] = options['member-index-format'] || 'grouped';
this.private = options.private;
};
process.on('exit', function () {
usage.saveSync();
});
var sendOptions = sendOptions;
function stats(method, options) {
var metrics = Object.assign({ session: 1 }, options);
for (var key in metrics) {
metrics[key] = 1;
}
return Promise.all([usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions), method(options).catch(function (err) {
usage.exception(err.stack, 1, {
hitParams: new Map([['cd', method.name]])
});
return usage.send(sendOptions).then(function () {
throw err;
});
})]).then(function (results) {
return results[1];
});
}
function statsSync(method, options) {
var metrics = Object.assign({ session: 1 }, options);
for (var key in metrics) {
metrics[key] = 1;
}
usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions);
try {
return method(options);
} catch (err) {
usage.exception(err.stack, 1, {
hitParams: new Map([['cd', method.name]])
});
usage.send(sendOptions).catch(function (err) {});
}
}
module.exports = new JsdocToMarkdown();

@@ -10,5 +10,5 @@ 'use strict';

} catch (err) {}
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4');
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json';
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json';
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4');
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json';
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json';

@@ -15,0 +15,0 @@ var runner = new TestRunner();

@@ -11,5 +11,5 @@ 'use strict';

} catch (err) {}
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4');
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json';
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json';
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4');
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json';
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json';

@@ -16,0 +16,0 @@ var runner = new TestRunner();

{
"name": "jsdoc-to-markdown",
"author": "Lloyd Brookes",
"version": "2.0.0-alpha.16",
"version": "2.0.0-alpha.17",
"description": "jsdoc-annotated source in, markdown API docs out.",

@@ -14,3 +14,3 @@ "repository": "https://github.com/jsdoc2md/jsdoc-to-markdown",

"test": "node test.js",
"docs": "node src/bin/cli.js --separators src/lib/jsdoc-to-markdown.js > docs/API.md; echo ",
"docs": "node src/bin/cli.js --separators src/lib/*.js --heading-depth 1 --template jsdoc2md/API.hbs > docs/API.md; echo ",
"cover": "istanbul cover ./node_modules/.bin/test-runner src/test/*.js && cat coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf coverage; echo",

@@ -17,0 +17,0 @@ "es5": "rm -rf es5 && babel --presets babel-preset-es2015 --no-comments src --out-dir es5"

@@ -67,7 +67,7 @@ 'use strict'

/* jsdoc2md --namepaths */
} else if (options.stats) {
} else if (options.namepaths) {
jsdoc2md
.getStats(options.files)
.then(function (json) {
tool.printOutput(JSON.stringify(json, null, ' '))
.getNamepaths(options)
.then(function (namepaths) {
tool.printOutput(JSON.stringify(namepaths, null, ' '))
})

@@ -74,0 +74,0 @@ .catch(tool.halt)

@@ -30,2 +30,7 @@ 'use strict'

description: 'Enable experimental parsing of .html files. When specified, any configuration supplied via [bold]{--configure} is ignored.'
},
{
name: 'namepaths',
type: Boolean,
description: 'Print namepaths.'
}

@@ -193,2 +198,5 @@ ]

{
cmmd: '$ jsdoc2md <jsdoc-options> [bold]{--namepaths}'
},
{
cmmd: '$ jsdoc2md [bold]{--help}'

@@ -198,5 +206,2 @@ },

cmmd: '$ jsdoc2md [bold]{--config}'
},
{
cmmd: '$ jsdoc2md [bold]{--stats}'
}

@@ -203,0 +208,0 @@ ]

@@ -6,6 +6,7 @@ 'use strict'

const UsageStats = require('app-usage-stats')
const DmdOptions = require('./dmd-options')
const JsdocOptions = require('./jsdoc-options')
/**
* @module jsdoc-to-markdown
* @typicalname jsdoc2md
* @example

@@ -15,360 +16,238 @@ * const jsdoc2md = require('jsdoc-to-markdown')

const usage = new UsageStats('UA-70853320-3', {
name: 'jsdoc2md',
version: require('../../package').version,
sendInterval: 1000 * 60 * 60 * 24, // 24 hours
metricMap: {
session: 1,
source: 2,
configure: 3,
html: 4,
template: 5,
'heading-depth': 6,
'example-lang': 7,
plugin: 8,
helper: 9,
partial: 10,
'name-format': 11,
'no-gfm': 12,
separators: 13,
'module-index-format': 14,
'global-index-format': 15,
'param-list-format': 16,
'property-list-format': 17,
'member-index-format': 18,
private: 19,
cache: 20
},
dimensionMap: {
interface: 4
class JsdocToMarkdownCore {
render (options) {
options = options || {}
const dmdOptions = new DmdOptions(options)
return this.getTemplateData(options)
.then(templateData => dmd.async(templateData, dmdOptions))
}
})
usage.loadSync()
exports._interface = 'api'
exports.render = function (options) {
return stats(render, options)
}
renderSync (options) {
options = options || {}
const dmdOptions = new DmdOptions(options)
return dmd(this.getTemplateDataSync(options), dmdOptions)
}
exports.renderSync = function (options) {
return statsSync(renderSync, options)
}
getTemplateData (options) {
options = options || {}
const jsdocParse = require('jsdoc-parse')
return this.getJsdocData(options)
.then(jsdocParse)
}
exports.getTemplateData = function (options) {
return stats(getTemplateData, options)
}
getTemplateDataSync (options) {
options = options || {}
const jsdocParse = require('jsdoc-parse')
const jsdocData = this.getJsdocDataSync(options)
return jsdocParse(jsdocData, options)
}
exports.getTemplateDataSync = function (options) {
return statsSync(getTemplateDataSync, options)
}
getJsdocData (options) {
const jsdocOptions = new JsdocOptions(options)
return jsdocApi.explain(jsdocOptions)
}
exports.getJsdocData = function (options) {
return stats(getJsdocData, options)
}
getJsdocDataSync (options) {
const jsdocOptions = new JsdocOptions(options)
return jsdocApi.explainSync(jsdocOptions)
}
exports.getJsdocDataSync = function (options) {
return statsSync(getJsdocDataSync, options)
}
clear () {
return jsdocApi.cache.clear().then(() => dmd.cache.clear())
}
exports.clear = function () {
return stats(clear)
}
getNamepaths (options) {
return this.getTemplateData(options)
.then(data => {
const namepaths = {}
const kinds = [
'module', 'class', 'constructor', 'mixin', 'member',
'namespace', 'constant', 'function', 'event', 'typedef', 'external'
]
kinds.forEach(kind => {
namepaths[kind] = data
.filter(identifier => {
return identifier.kind === kind
})
.map(identifier => identifier.longname)
})
return namepaths
})
}
/* exposed so the test suite can disable it */
exports._usageStats = usage
/**
* Returns markdown documentation from jsdoc-annoted source code.
*
* @param [options] {module:jsdoc-to-markdown~JsdocOptions | module:jsdoc-to-markdown~DmdOptions} - the options
* @return {Promise}
* @fulfil {string} - the rendered docs
* @category async
* @static
* @example
* Pass in filepaths (`**` glob matching supported) of javascript source files:
* ```js
* > jsdoc2md.render('lib/*.js').then(console.log)
* ```
*/
function render (options) {
options = options || {}
const dmdOptions = new DmdOptions(options)
return getTemplateData(options)
.then(templateData => dmd.async(templateData, dmdOptions))
}
/**
* Returns markdown documentation from jsdoc-annoted source code.
*
* @param [options] {module:jsdoc-to-markdown~JsdocOptions | module:jsdoc-to-markdown~DmdOptions} - the options
* @return {string}
* @engine nodejs >= 0.12
* @category sync
* @static
* @example
* const docs = jsdoc2md.renderSync('lib/*.js')
*/
function renderSync (options) {
options = options || {}
const dmdOptions = new DmdOptions(options)
return dmd(getTemplateDataSync(options), dmdOptions)
}
* @alias module:jsdoc-to-markdown
* @extends JsdocToMarkdownCore
* @typicalname jsdoc2md
*/
class JsdocToMarkdown extends JsdocToMarkdownCore {
constructor () {
super()
this._usage = new UsageStats('UA-70853320-3', {
name: 'jsdoc2md',
version: require('../../package').version,
sendInterval: 1000 * 60 * 60 * 24, // 24 hours
metricMap: {
session: 1,
source: 2,
configure: 3,
html: 4,
template: 5,
'heading-depth': 6,
'example-lang': 7,
plugin: 8,
helper: 9,
partial: 10,
'name-format': 11,
'no-gfm': 12,
separators: 13,
'module-index-format': 14,
'global-index-format': 15,
'param-list-format': 16,
'property-list-format': 17,
'member-index-format': 18,
private: 19,
cache: 20
},
dimensionMap: {
interface: 4
}
})
this._usage.loadSync()
this._interface = 'api'
this._sendOptions = { timeout: 2000 }
/**
* Returns template data (jsdoc-parse output).
*
* @param [options] {module:jsdoc-to-markdown~JsdocOptions} - the options
* @return {Promise}
* @fulfil {object[]} - the json data
* @category async
* @static
*/
function getTemplateData (options) {
options = options || {}
const jsdocParse = require('jsdoc-parse')
return getJsdocData(options)
.then(jsdocParse)
}
process.on('exit', () => this._usage.saveSync())
}
/**
* Returns template data (jsdoc-parse output).
*
* @param [options] {module:jsdoc-to-markdown~JsdocOptions} - the options
* @return {object[]}
* @category sync
* @static
*/
function getTemplateDataSync (options) {
options = options || {}
const jsdocParse = require('jsdoc-parse')
const jsdocData = getJsdocDataSync(options)
return jsdocParse(jsdocData, options)
}
_hit (method, options) {
const metrics = Object.assign({ session: 1 }, options)
for (const key in metrics) {
metrics[key] = 1
}
return this._usage.hit({ name: method.name, interface: this._interface }, metrics, this._sendOptions)
}
/**
* Returns raw jsdoc data.
*
* @param [options] {module:jsdoc-to-markdown~JsdocOptions} - the options
* @return {Promise}
* @fulfil {object[]}
* @category async
* @static
*/
function getJsdocData (options) {
const jsdocOptions = new JsdocOptions(options)
return jsdocApi.explain(jsdocOptions)
}
_stats (method, options) {
return Promise.all([
this._hit(method, options),
method.call(this, options)
.catch(err => {
this._usage.exception(err.stack, 1, {
hitParams: new Map([[ 'cd', method.name ]])
})
return this._usage.send(this._sendOptions)
.then(() => { throw err })
})
]).then(results => results[1])
}
/**
* Returns raw jsdoc data.
*
* @param [options] {module:jsdoc-to-markdown~JsdocOptions} - the options
* @return {object[]}
* @category sync
* @static
*/
function getJsdocDataSync (options) {
const jsdocOptions = new JsdocOptions(options)
return jsdocApi.explainSync(jsdocOptions)
}
_statsSync (method, options) {
this._hit(method, options)
try {
return method.call(this, options)
} catch (err) {
this._usage.exception(err.stack, 1, {
hitParams: new Map([[ 'cd', method.name ]])
})
this._usage.send(this._sendOptions)
.catch(err => {
// catch warning
})
}
}
/**
* Clear the cache.
* @returns {Promise}
* @static
*/
function clear () {
return jsdocApi.cache.clear().then(() => dmd.cache.clear())
}
/**
* Returns markdown documentation from jsdoc-annoted source code.
*
* @param [options] {JsdocOptions | DmdOptions} - the options
* @return {Promise}
* @fulfil {string} - the rendered docs
* @category async
* @example
* Pass in filepaths (`**` glob matching supported) of javascript source files:
* ```js
* > jsdoc2md.render('lib/*.js').then(console.log)
* ```
*/
render (options) {
return this._stats(super.render, options)
}
/**
* jsdoc options
*/
class JsdocOptions {
constructor (options) {
options = options || {}
/**
* Returns markdown documentation from jsdoc-annoted source code.
*
* @param [options] {JsdocOptions | DmdOptions} - the options
* @return {string}
* @engine nodejs >= 0.12
* @category sync
* @example
* const docs = jsdoc2md.renderSync('lib/*.js')
*/
renderSync (options) {
return this._statsSync(super.renderSync, options)
}
/**
* Set to false to disable memoisation cache. Defaults to true.
*/
this.cache = options.cache === undefined ? true : options.cache
/**
* Returns template data (jsdoc-parse output).
*
* @param [options] {JsdocOptions} - the options
* @return {Promise}
* @fulfil {object[]} - the json data
* @category async
*/
getTemplateData (options) {
return this._stats(super.getTemplateData, options)
}
/**
* One or more filenames to process. Either this or `source` must be supplied.
* @type {string|string[]}
*/
this.files = options.files
/**
* A string containing source code to process. Either this or `source` must be supplied.
* @type {string}
*/
this.source = options.source
/**
* The path to the configuration file. Default: path/to/jsdoc/conf.json.
* @type {string}
*/
this.configure = options.configure
/**
* Enable experimental parsing of `.html` files.
* @type {boolean}
*/
this.html = options.html
/**
* Returns template data (jsdoc-parse output).
*
* @param [options] {JsdocOptions} - the options
* @return {object[]}
* @category sync
*/
getTemplateDataSync (options) {
return this._statsSync(super.getTemplateDataSync, options)
}
}
/**
* dmd options
*/
class DmdOptions {
constructor (options) {
const arrayify = require('array-back')
/**
* The template the supplied documentation will be rendered into. Use the default or supply your own template for full control over the output.
* @type {string}
* @default
*/
this.template = options.template || '{{>main}}'
/**
* The initial heading depth. For example, with a value of `2` the top-level markdown headings look like `"## The heading"`.
* @type number
* @default
*/
this['heading-depth'] = options['heading-depth'] || 2
/**
* Specifies the default language used in @example blocks (for [syntax-highlighting](https://help.github.com/articles/github-flavored-markdown/#syntax-highlighting) purposes). In gfm mode, each @example is wrapped in a fenced-code block. Example usage: `--example-lang js`. Use the special value `none` for no specific language. While using this option, you can override the supplied language for any @example by specifying the `@lang` subtag, e.g `@example @lang hbs`. Specifying `@example @lang off` will disable code blocks for that example.
* @type {string}
* @default
*/
this['example-lang'] = options['example-lang'] || 'js'
/**
* Use an installed package containing helper and/or partial overrides
* @type {array}
*/
this.plugin = arrayify(options.plugin)
/**
* handlebars helper files to override or extend the default set
* @type {array}
*/
this.helper = arrayify(options.helper)
/**
* handlebars partial files to override or extend the default set
* @type {array}
*/
this.partial = arrayify(options.partial)
/**
* Format identifier names in the [code](http://daringfireball.net/projects/markdown/syntax#code) style, (i.e. format using backticks or `<code></code>`)
* @type {string}
*/
this['name-format'] = options['name-format']
/**
* By default, dmd generates github-flavoured markdown. Not all markdown parsers render gfm correctly. If your generated docs look incorrect on sites other than Github (e.g. npmjs.org) try enabling this option to disable Github-specific syntax.
* @type {boolean}
*/
this['no-gfm'] = options['no-gfm']
/**
* Put `<hr>` breaks between identifiers. Improves readability on bulky docs.
* @type {boolean}
* @default false
*/
this.separators = options.separators
/**
* none, grouped, table, dl
* @type {string}
* @default
*/
this['module-index-format'] = options['module-index-format'] || 'dl'
/**
* none, grouped, table, dl
* @type {string}
* @default
*/
this['global-index-format'] = options['global-index-format'] || 'dl'
/**
* Two options to render parameter lists: 'list' or 'table' (default). Table format works well in most cases but switch to list if things begin to look crowded / squashed.
* @type {string}
* @default
*/
this['param-list-format'] = options['param-list-format'] || 'table'
/**
* list, table
* @type {string}
* @default
*/
this['property-list-format'] = options['property-list-format'] || 'table'
/**
* grouped, list
* @type {string}
* @default
*/
this['member-index-format'] = options['member-index-format'] || 'grouped'
/**
* Show identifiers marked `@private` in the output.
* @type {boolean}
* @default false
*/
this.private = options.private
/**
* Returns raw jsdoc data.
*
* @param [options] {JsdocOptions} - the options
* @return {Promise}
* @fulfil {object[]}
* @category async
*/
getJsdocData (options) {
return this._stats(super.getJsdocData, options)
}
}
process.on('exit', function () {
usage.saveSync()
})
var sendOptions = sendOptions
function stats (method, options) {
const metrics = Object.assign({ session: 1 }, options)
for (const key in metrics) {
metrics[key] = 1
/**
* Returns raw jsdoc data.
*
* @param [options] {JsdocOptions} - the options
* @return {object[]}
* @category sync
*/
getJsdocDataSync (options) {
return this._statsSync(super.getJsdocDataSync, options)
}
return Promise.all([
usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions),
method(options)
.catch(err => {
usage.exception(err.stack, 1, {
hitParams: new Map([[ 'cd', method.name ]])
})
return usage.send(sendOptions)
.then(() => { throw err })
})
]).then(results => results[1])
}
function statsSync (method, options) {
const metrics = Object.assign({ session: 1 }, options)
for (const key in metrics) {
metrics[key] = 1
/**
* Clear the cache.
* @returns {Promise}
* @category async
*/
clear () {
return this._stats(super.clear)
}
usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions)
try {
return method(options)
} catch (err) {
usage.exception(err.stack, 1, {
hitParams: new Map([[ 'cd', method.name ]])
})
usage.send(sendOptions)
.catch(err => {
// avoid warning
})
getNamepaths (options) {
return this._stats(super.getNamepaths, options)
}
}
module.exports = new JsdocToMarkdown()

@@ -11,5 +11,5 @@ 'use strict'

}
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4')
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json'
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json'
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4')
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json'
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json'

@@ -16,0 +16,0 @@ const runner = new TestRunner()

@@ -12,5 +12,5 @@ 'use strict'

}
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4')
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json'
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json'
jsdoc2md._usage.defaults.set('tid', 'UA-70853320-4')
jsdoc2md._usage.queuePath = 'tmp-test/unsent.json'
jsdoc2md._usage._lastSentPath = 'tmp-test/lastSent.json'

@@ -17,0 +17,0 @@ const runner = new TestRunner()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc