Skip to content

Commit 0324865

Browse files
anthony-redFoxtmcw
authored andcommitted
fix: make html and markdown second option optional (#871)
Fixed #869
1 parent 23aa981 commit 0324865

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

docs/NODE_API.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Formats documentation as HTML.
105105
**Parameters**
106106

107107
- `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
108-
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output
108+
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)
109109
- `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'`)
110110

111111
**Examples**
@@ -132,7 +132,7 @@ Formats documentation as
132132
**Parameters**
133133

134134
- `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
135-
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output
135+
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)
136136

137137
**Examples**
138138

src/output/html.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ var mergeConfig = require('../merge_config');
2323
* streamArray(output).pipe(vfs.dest('./output-directory'));
2424
* });
2525
*/
26-
function html(comments: Array<Comment>, config: DocumentationConfig) {
27-
return mergeConfig(config).then(config => {
26+
function html(comments: Array<Comment>, config: Object = {}) {
27+
return mergeConfig(config).then((config: DocumentationConfig) => {
2828
var themePath = '../default_theme/';
2929
if (config.theme) {
3030
themePath = path.resolve(process.cwd(), config.theme);

src/output/markdown.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* @flow */
22

3-
var remark = require('remark'), markdownAST = require('./markdown_ast');
3+
var remark = require('remark'),
4+
markdownAST = require('./markdown_ast');
45

56
/**
67
* Formats documentation as
@@ -22,7 +23,10 @@ var remark = require('remark'), markdownAST = require('./markdown_ast');
2223
* fs.writeFileSync('./output.md', output);
2324
* });
2425
*/
25-
function markdown(comments: Array<Comment>, args: Object): Promise<string> {
26+
function markdown(
27+
comments: Array<Comment>,
28+
args: Object = {}
29+
): Promise<string> {
2630
return markdownAST(comments, args).then(ast => remark().stringify(ast));
2731
}
2832

0 commit comments

Comments
 (0)