Skip to content

Commit

Permalink
Update sidebar structure and add an full working example
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed May 6, 2018
1 parent 90b4882 commit 47b3a8a
Show file tree
Hide file tree
Showing 20 changed files with 8,230 additions and 365 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = {
```
## Example

The `./example` folder includes a full working vuepress example generated from `./src`.
The `./example` folder includes a full working vuepress example.

## ToDo

Expand Down
7 changes: 7 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Example

```bash
npm i
npm run docs
npm run dev
```
30 changes: 30 additions & 0 deletions example/documentation/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// auto generated sidebar
const { sidebarTree } = require('../code/config');

module.exports = {
home: true,
dest: 'documentation',
locales: {
'/': {
title: 'static-site-jsdoc',
description: 'A JSDoc cli to build md files for static site generators'
}
},
themeConfig: {
editLinks: true,
sidebarDepth: 4,
docsDir: 'code',
locales: {
'/': {
nav: [
{
text: 'Home',
link: '/'
}
],
// Add sidebar
sidebar: Object.assign({}, sidebarTree)
}
}
}
};
5 changes: 5 additions & 0 deletions example/documentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
home: true
actionText: JSDoc →
actionLink: /code/
---
1 change: 1 addition & 0 deletions example/documentation/code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Welcome
49 changes: 49 additions & 0 deletions example/documentation/code/class.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: class
---
<a name="Test"></a>

## Test**Kind**: global class

* [Test](#Test)
* [new Test()](#new_Test_new)
* _instance_
* [.name](#Test+name)
* [.name](#Test+name)
* [.generateFullName()](#Test+generateFullName)
* _static_
* [.Test](#Test.Test)
* [new Test([name])](#new_Test.Test_new)

<a name="new_Test_new"></a>

### new Test()This is a test class

<a name="Test+name"></a>

### test.nameSet current name

**Kind**: instance property of [<code>Test</code>](#Test)
<a name="Test+name"></a>

### test.nameGet current name

**Kind**: instance property of [<code>Test</code>](#Test)
<a name="Test+generateFullName"></a>

### test.generateFullName() ⇒Generate a fullname

**Kind**: instance method of [<code>Test</code>](#Test)
**Returns**: an string
<a name="Test.Test"></a>

### Test.Test**Kind**: static class of [<code>Test</code>](#Test)
<a name="new_Test.Test_new"></a>

#### new Test([name])Creates an instance of Test.


| Param | Type | Default |
| --- | --- | --- |
| [name] | <code>string</code> | <code>&quot;&#x27;Peter&#x27;&quot;</code> |

85 changes: 85 additions & 0 deletions example/documentation/code/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
exports.fileTree=[
{
"name": "class",
"path": "/class",
"fullPath": "./documentation/code/class"
},
{
"name": "lib",
"children": [
{
"name": "dmd-options",
"path": "/dmd-options",
"fullPath": "lib/dmd-options"
},
{
"name": "jsdoc-to-markdown",
"path": "/jsdoc-to-markdown",
"fullPath": "lib/jsdoc-to-markdown"
}
]
},
{
"name": "methods",
"path": "/methods",
"fullPath": "./documentation/code/methods"
},
{
"name": "objects",
"path": "/objects",
"fullPath": "./documentation/code/objects"
},
{
"name": "subfolder",
"children": [
{
"name": "subfolder.1",
"children": [
{
"name": "variables",
"path": "/variables",
"fullPath": "subfolder/subfolder.1/variables"
}
]
},
{
"name": "variables",
"path": "/variables",
"fullPath": "subfolder/variables"
}
]
}
];
exports.sidebarTree={
"/code/": [
{
"title": "API",
"collapsable": false,
"children": [
[
"",
"Mainpage"
],
"class",
"methods",
"objects"
]
},
{
"title": "lib",
"collapsable": false,
"children": [
"lib/dmd-options",
"lib/jsdoc-to-markdown"
]
},
{
"title": "subfolder",
"collapsable": false,
"children": [
"subfolder/subfolder.1/variables",
"subfolder/variables"
]
}
]
};
6 changes: 6 additions & 0 deletions example/documentation/code/lib/dmd-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: dmd-options
---
<a name="DmdOptions"></a>

## DmdOptions**Kind**: global class
141 changes: 141 additions & 0 deletions example/documentation/code/lib/jsdoc-to-markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
title: jsdoc-to-markdown
---
<a name="module_jsdoc-to-markdown"></a>

## jsdoc-to-markdown**Example**
```js
const jsdoc2md = require('jsdoc-to-markdown')
```

* [jsdoc-to-markdown](#module_jsdoc-to-markdown)
* [JsdocToMarkdown](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
* _async_
* [.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>
* [.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>
* [.getJsdocDataSync([options])](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocDataSync) ⇒ <code>Array.&lt;object&gt;</code>

<a name="exp_module_jsdoc-to-markdown--JsdocToMarkdown"></a>

### JsdocToMarkdown ⏏**Kind**: Exported class
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+render"></a>

#### jsdoc2md.render([options]) ⇒ <code>Promise</code>Returns markdown documentation from jsdoc-annoted source code.

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

| Param | Type | Description |
| --- | --- | --- |
| [options] | <code>object</code> | Accepts all [getJsdocData](#module_jsdoc-to-markdown--JsdocToMarkdown+getJsdocData) options plus the following: |
| [options.data] | <code>Array.&lt;object&gt;</code> | Raw template data to use. Useful when you already have template data, obtained from `.getTemplateData`. Either `files`, `source` or `data` must be supplied. |
| [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. |
| [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"`. |
| [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. |
| [options.plugin] | <code>string</code> \| <code>Array.&lt;string&gt;</code> | Use an installed package containing helper and/or partial overrides. |
| [options.helper] | <code>string</code> \| <code>Array.&lt;string&gt;</code> | handlebars helper files to override or extend the default set. |
| [options.partial] | <code>string</code> \| <code>Array.&lt;string&gt;</code> | handlebars partial files to override or extend the default set. |
| [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>`). |
| [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. |
| [options.separators] | <code>boolean</code> | Put `<hr>` breaks between identifiers. Improves readability on bulky docs. |
| [options.module-index-format] | <code>string</code> | 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 |

**Example**
Pass in filepaths (`**` glob matching supported) of javascript source files:
```js
> jsdoc2md.render({ files: 'lib/*.js' }).then(console.log)
```
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateData"></a>

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

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

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

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

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

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

| Param | Type | Description |
| --- | --- | --- |
| [options] | <code>object</code> | the options |
| [options.no-cache] | <code>boolean</code> | By default results are cached to speed up repeat invocations. Set to true to disable this. |
| [options.files] | <code>string</code> \| <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 [jsdoc configuration file](http://usejsdoc.org/about-configuring-jsdoc.html). Default: path/to/jsdoc/conf.json. |

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

#### jsdoc2md.clear() ⇒ <code>Promise</code>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 [<code>JsdocToMarkdown</code>](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**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</code>](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**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](#module_jsdoc-to-markdown--JsdocToMarkdown+render).

**Kind**: instance method of [<code>JsdocToMarkdown</code>](#exp_module_jsdoc-to-markdown--JsdocToMarkdown)
**Category**: sync
**Engine**: nodejs >= 0.12

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

**Example**
```js
const docs = jsdoc2md.renderSync({ files: 'lib/*.js' })
```
<a name="module_jsdoc-to-markdown--JsdocToMarkdown+getTemplateDataSync"></a>

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

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

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

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

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

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

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

26 changes: 26 additions & 0 deletions example/documentation/code/methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: methods
---
## Functions

<dl>
<dt><a href="#ES6Method">ES6Method()</a> ⇒</dt>
<dd><p>A normal ES6 Method</p>
</dd>
<dt><a href="#standardMethod">standardMethod()</a> ⇒</dt>
<dd><p>A normal standard Method</p>
</dd>
</dl>

<a name="ES6Method"></a>

## ES6Method() ⇒A normal ES6 Method

**Kind**: global function
**Returns**: a String
<a name="standardMethod"></a>

## standardMethod() ⇒A normal standard Method

**Kind**: global function
**Returns**: a String
Loading

0 comments on commit 47b3a8a

Please sign in to comment.