Skip to content

Commit

Permalink
fix: make html and markdown second option optional (#871)
Browse files Browse the repository at this point in the history
Fixed #869
  • Loading branch information
anthony-redFox authored and tmcw committed Aug 9, 2017
1 parent 23aa981 commit 0324865
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/NODE_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Formats documentation as HTML.
**Parameters**

- `comments` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment/Comment)>** parsed comments
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)
- `config.theme` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Name of a module used for an HTML theme. (optional, default `'default_theme'`)

**Examples**
Expand All @@ -132,7 +132,7 @@ Formats documentation as
**Parameters**

- `comments` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** parsed comments
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)

**Examples**

Expand Down
4 changes: 2 additions & 2 deletions src/output/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ var mergeConfig = require('../merge_config');
* streamArray(output).pipe(vfs.dest('./output-directory'));
* });
*/
function html(comments: Array<Comment>, config: DocumentationConfig) {
return mergeConfig(config).then(config => {
function html(comments: Array<Comment>, config: Object = {}) {
return mergeConfig(config).then((config: DocumentationConfig) => {
var themePath = '../default_theme/';
if (config.theme) {
themePath = path.resolve(process.cwd(), config.theme);
Expand Down
8 changes: 6 additions & 2 deletions src/output/markdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

var remark = require('remark'), markdownAST = require('./markdown_ast');
var remark = require('remark'),
markdownAST = require('./markdown_ast');

/**
* Formats documentation as
Expand All @@ -22,7 +23,10 @@ var remark = require('remark'), markdownAST = require('./markdown_ast');
* fs.writeFileSync('./output.md', output);
* });
*/
function markdown(comments: Array<Comment>, args: Object): Promise<string> {
function markdown(
comments: Array<Comment>,
args: Object = {}
): Promise<string> {
return markdownAST(comments, args).then(ast => remark().stringify(ast));
}

Expand Down

0 comments on commit 0324865

Please sign in to comment.