# jsdoc-to-markdown
**Example**
```js
import jsdoc2md from 'jsdoc-to-markdown'
```
* [jsdoc-to-markdown](#module_jsdoc-to-markdown)
* [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown) ⏏
* [.render([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+render) ⇒ Promise.<string>
* [.getTemplateData([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateData) ⇒ Promise.<Array.<object>>
* [.getJsdocData([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocData) ⇒ Promise.<Array.<object>>
* [.clear()](#module_jsdoc-to-markdown--JsdocToMarkdown+clear) ⇒ Promise
* [.getNamepaths(options)](#module_jsdoc-to-markdown--JsdocToMarkdown+getNamepaths) ⇒ object
## JsdocToMarkdown ⏏
**Kind**: Exported class
### jsdoc2md.render([options]) ⇒ Promise.<string>
Returns markdown documentation from jsdoc-annoted source code.
**Kind**: instance method of [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**Category**: async
**Fulfil**: string - the rendered docs
| Param | Type | Description |
| --- | --- | --- |
| [options] | object | Accepts all [getJsdocData](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocData) options plus the following: |
| [options.data] | Array.<object> | Raw template data to use. Useful when you already have template data, obtained from `.getTemplateData()`. In the options, one of `files`, `source`, , `configure` or `data` must be supplied. |
| [options.template] | string | The handlebars template the supplied documentation will be rendered into. Enables full control over the output. |
| [options.heading-depth] | number | The initial heading depth. For example, with a value of `2` the top-level markdown headings look like `"## The heading"`. |
| [options.example-lang] | string | 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. |
| [options.plugin] | string \| Array.<string> | Use an installed package containing helper and/or partial overrides. |
| [options.helper] | string \| Array.<string> | handlebars helper files to override or extend the default set. |
| [options.partial] | string \| Array.<string> | handlebars partial files to override or extend the default set. |
| [options.name-format] | string | Format identifier names as code (i.e. wrap function/property/class etc names in backticks). |
| [options.no-gfm] | boolean | 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. |
| [options.separators] | boolean | Put `
` breaks between identifiers. Improves readability on bulky docs. |
| [options.module-index-format] | string | none, grouped, table, dl. |
| [options.global-index-format] | | none, grouped, table, dl. |
| [options.param-list-format] | | 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. |
| [options.property-list-format] | | list, table. |
| [options.member-index-format] | | grouped, list |
| [options.clever-links] | boolean | By default, all {@link} tags are rendered in plain text. If `--clever-links` is set, URL {@link} tags are rendered in plain text, otherwise monospace. |
| [options.monospace-links] | boolean | By default, all {@link} tags are rendered in plain text. If `--monospace-links` is set, all links are rendered in monospace format. This setting is ignored if `--clever-links` is set. |
| [options.EOL] | string | Specify ether `posix` or `win32`. Forces all line endings in the dmd output to use the specified EOL character - can help to avoid scenarios where files contain mixed line-endings. |
**Example**
Pass in filepaths (`**` glob matching supported) of javascript source files:
```js
> const apiDocs = await jsdoc2md.render({ files: 'lib/*.js' })
```
### jsdoc2md.getTemplateData([options]) ⇒ Promise.<Array.<object>>
Returns the template data (jsdoc-parse output) which is fed into the output template (dmd).
**Kind**: instance method of [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**Category**: async
**Fulfil**: object[] - the json data
| Param | Type | Description |
| --- | --- | --- |
| [options] | object | Identical options to [getJsdocData](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocData). |
### jsdoc2md.getJsdocData([options]) ⇒ Promise.<Array.<object>>
Returns raw data direct from the underlying [jsdoc3](https://github.com/jsdoc3/jsdoc).
**Kind**: instance method of [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**Category**: async
**Fulfil**: object[]
| Param | Type | Description |
| --- | --- | --- |
| [options] | object | the options |
| [options.no-cache] | boolean | By default results are cached to speed up repeat invocations with the same input. Set to true to disable this. |
| [options.files] | string \| Array.<string> | One or more filenames to process. Accepts globs (e.g. `*.js`). Either `files`, `source` or `configure` must be supplied. |
| [options.source] | string | A string containing source code to process. One of `files`, `source` or `configure` must be supplied. |
| [options.configure] | string | The path to the [jsdoc configuration file](https://jsdoc.app/about-configuring-jsdoc.html). Default: path/to/jsdoc/conf.json. One of `files`, `source` or `configure` must be supplied. |
### jsdoc2md.clear() ⇒ Promise
By default, the output of each invocation of the main generation methods (`render`, `getTemplateData` etc) is stored in the cache (your system's [temporary directory](https://nodejs.org/dist/latest-v6.x/docs/api/os.html#os_os_tmpdir)). Future jsdoc2md invocations with the same input options and source code will return the output immediately from cache, making the tool much faster/cheaper. If the input options or source code changes, fresh output will be generated. This method clears the cache, which you should never need to do unless the cache is failing for some reason. On Mac OSX, the system tmpdir clears itself every few days meaning your jsdoc2md cache will also be routinely cleared.
**Kind**: instance method of [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**Category**: async
### jsdoc2md.getNamepaths(options) ⇒ object
Returns all [jsdoc namepaths](https://jsdoc.app/about-namepaths.html) found in the supplied source code.
**Kind**: instance method of [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**Category**: async
| Param | Type | Description |
| --- | --- | --- |
| options | object | options to pass to [getTemplateData](#module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateData) |