Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make html and markdown second option is optional #871

Merged
merged 1 commit into from
Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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