From 0fb0f5d919865a3ef876c30f748fb0baa802c3e0 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 28 Dec 2016 20:06:27 -0500 Subject: [PATCH] fix(markdown): Start headings in Markdown at h2 Fixes https://github.com/documentationjs/documentation/issues/641 --- docs/NODE_API.md | 14 ++--- lib/output/markdown_ast.js | 2 +- package.json | 2 +- .../auto_lang_hljs/multilanguage.output.md | 2 +- test/fixture/boolean-literal-type.output.md | 2 +- .../boolean-literal-type.output.md.json | 2 +- test/fixture/class.config.output.md | 8 +-- test/fixture/class.output.md | 6 +- test/fixture/class.output.md.json | 6 +- ...t-exported-export-default-object.output.md | 4 +- ...orted-export-default-object.output.md.json | 4 +- ...nt-exported-export-default-value.output.md | 2 +- ...ported-export-default-value.output.md.json | 2 +- test/fixture/document-exported.output.md | 60 +++++++++---------- test/fixture/document-exported.output.md.json | 60 +++++++++---------- test/fixture/es6-class.output.md | 8 +-- test/fixture/es6-class.output.md.json | 8 +-- test/fixture/es6-default2.output.md | 2 +- test/fixture/es6-default2.output.md.json | 2 +- test/fixture/es6-import.output.md | 6 +- test/fixture/es6-import.output.md.json | 6 +- test/fixture/es6.output.md | 40 ++++++------- test/fixture/es6.output.md.json | 40 ++++++------- test/fixture/event.output.md | 2 +- test/fixture/event.output.md.json | 2 +- test/fixture/example-caption.output.md | 2 +- test/fixture/example-caption.output.md.json | 2 +- test/fixture/external.output.md | 2 +- test/fixture/external.output.md.json | 2 +- test/fixture/factory.output.md | 6 +- test/fixture/factory.output.md.json | 6 +- test/fixture/infer-private.output.md | 4 +- test/fixture/infer-private.output.md.json | 4 +- test/fixture/inheritance.output.md | 4 +- test/fixture/inheritance.output.md.json | 4 +- test/fixture/inline-link.output.md | 4 +- test/fixture/inline-link.output.md.json | 4 +- test/fixture/internal.output.md | 2 +- test/fixture/internal.output.md.json | 2 +- test/fixture/literal_types.output.md | 4 +- test/fixture/literal_types.output.md.json | 4 +- test/fixture/memberedclass.output.md | 6 +- test/fixture/memberedclass.output.md.json | 6 +- test/fixture/merge-infered-type.output.md | 2 +- .../fixture/merge-infered-type.output.md.json | 2 +- test/fixture/multisignature.output.md | 4 +- test/fixture/multisignature.output.md.json | 4 +- test/fixture/nearby_params.output.md | 2 +- test/fixture/nearby_params.output.md.json | 2 +- test/fixture/nest_params.output.md | 4 +- test/fixture/nest_params.output.md.json | 4 +- test/fixture/newline-in-description.output.md | 2 +- .../newline-in-description.output.md.json | 2 +- test/fixture/no-name.output.md | 2 +- test/fixture/no-name.output.md.json | 2 +- .../optional-record-field-type.output.md | 2 +- .../optional-record-field-type.output.md.json | 2 +- test/fixture/params.output.md | 18 +++--- test/fixture/params.output.md.json | 18 +++--- test/fixture/react-jsx.output.md | 2 +- test/fixture/react-jsx.output.md.json | 2 +- test/fixture/simple-hashbang.output.md | 2 +- test/fixture/simple-hashbang.output.md.json | 2 +- test/fixture/simple-two.output.md | 2 +- test/fixture/simple-two.output.md.json | 2 +- test/fixture/simple.output.github.md | 2 +- test/fixture/simple.output.md | 2 +- test/fixture/simple.output.md.json | 2 +- test/fixture/sort-order-alpha.output.md | 24 ++++---- test/fixture/sort-order-alpha.output.md.json | 24 ++++---- test/fixture/string-literal-key.output.md | 4 +- .../fixture/string-literal-key.output.md.json | 4 +- test/fixture/sync/alias.output.md | 2 +- test/fixture/sync/alias.output.md.json | 2 +- test/fixture/sync/empty-example.output.md | 2 +- .../fixture/sync/empty-example.output.md.json | 2 +- test/fixture/sync/flow-types.output.md | 20 +++---- test/fixture/sync/flow-types.output.md.json | 20 +++---- test/fixture/sync/lots-of-options.output.md | 2 +- .../sync/lots-of-options.output.md.json | 2 +- test/fixture/sync/meta.output.md | 2 +- test/fixture/sync/meta.output.md.json | 2 +- test/fixture/sync/multiexample.output.md | 2 +- test/fixture/sync/multiexample.output.md.json | 2 +- test/fixture/sync/rename.output.md | 2 +- test/fixture/sync/rename.output.md.json | 2 +- test/fixture/sync/throws.output.md | 2 +- test/fixture/sync/throws.output.md.json | 2 +- test/fixture/sync/trailing-only.output.md | 2 +- .../fixture/sync/trailing-only.output.md.json | 2 +- test/fixture/sync/trailing.output.md | 6 +- test/fixture/sync/trailing.output.md.json | 6 +- test/fixture/sync/typedef.output.md | 2 +- test/fixture/sync/typedef.output.md.json | 2 +- test/fixture/system-import.output.md | 2 +- test/fixture/system-import.output.md.json | 2 +- test/fixture/this-class.output.md | 10 ++-- test/fixture/this-class.output.md.json | 10 ++-- test/fixture/type_application.output.md | 2 +- test/fixture/type_application.output.md.json | 2 +- .../var-function-param-return.output.md | 2 +- .../var-function-param-return.output.md.json | 2 +- test/test.js | 7 ++- 103 files changed, 319 insertions(+), 314 deletions(-) diff --git a/docs/NODE_API.md b/docs/NODE_API.md index 88edce60b..96110e806 100644 --- a/docs/NODE_API.md +++ b/docs/NODE_API.md @@ -1,6 +1,6 @@ -# build +## build Generate JavaScript documentation as a list of parsed JSDoc comments, given a root file as a path. @@ -54,7 +54,7 @@ documentation.build(['index.js'], { Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** calls callback -# buildSync +## buildSync Generate JavaScript documentation given a list of inputs. This internal method does not support require-following and it returns its results @@ -100,7 +100,7 @@ var results = documentation.buildSync(['index.js']); Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** list of results -# lint +## lint Lint files for non-standard or incorrect documentation information, returning a potentially-empty string @@ -145,14 +145,14 @@ documentation.lint('file.js', {}, function (err, lintOutput) { Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** calls callback -# formats +## formats Documentation's formats are modular methods that take comments and options as input and call a callback with writable objects, like stringified JSON, markdown strings, or Vinyl objects for HTML output. -# formats.html +## formats.html Formats documentation as HTML. @@ -179,7 +179,7 @@ documentation.build(['index.js'], {}, function (err, res) { Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** Calls callback. -# formats.markdown +## formats.markdown Formats documentation as [Markdown](http://daringfireball.net/projects/markdown/). @@ -206,7 +206,7 @@ documentation.build(['index.js'], {}, function (err, res) { Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** calls callback -# formats.json +## formats.json Formats documentation as a JSON string. diff --git a/lib/output/markdown_ast.js b/lib/output/markdown_ast.js index 76d0df055..10c202387 100644 --- a/lib/output/markdown_ast.js +++ b/lib/output/markdown_ast.js @@ -204,7 +204,7 @@ function commentsToAST(comments, options, callback) { return callback(null, rerouteLinks(linkerStack.link, u('root', generatorComment.concat(comments.reduce(function (memo, comment) { - return memo.concat(generate(1, comment)); + return memo.concat(generate(2, comment)); }, []))))); } diff --git a/package.json b/package.json index ff4de303f..fe8c2d412 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ }, "scripts": { "lint": "eslint bin lib index.js test", - "doc": "documentation build index.js -f md --access=public > docs/NODE_API.md", + "doc": "./bin/documentation.js build index.js -f md --access=public > docs/NODE_API.md", "changelog": "standard-changelog -i CHANGELOG.md -w", "self-lint": "node ./bin/documentation.js lint", "test": "npm run lint && npm run self-lint && tap -t 120 --coverage --nyc-arg=--cache test/*.js test/lib test/streams" diff --git a/test/fixture/auto_lang_hljs/multilanguage.output.md b/test/fixture/auto_lang_hljs/multilanguage.output.md index 45c2dd157..e648388cc 100644 --- a/test/fixture/auto_lang_hljs/multilanguage.output.md +++ b/test/fixture/auto_lang_hljs/multilanguage.output.md @@ -1,6 +1,6 @@ -# multilanguage.input +## multilanguage.input **Extends Foo, Bar** diff --git a/test/fixture/boolean-literal-type.output.md b/test/fixture/boolean-literal-type.output.md index a3dbe313e..08591845f 100644 --- a/test/fixture/boolean-literal-type.output.md +++ b/test/fixture/boolean-literal-type.output.md @@ -1,6 +1,6 @@ -# f +## f **Parameters** diff --git a/test/fixture/boolean-literal-type.output.md.json b/test/fixture/boolean-literal-type.output.md.json index 81739d92b..c6e85d7d4 100644 --- a/test/fixture/boolean-literal-type.output.md.json +++ b/test/fixture/boolean-literal-type.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/class.config.output.md b/test/fixture/class.config.output.md index 3f23e0ba3..5f0f252c7 100644 --- a/test/fixture/class.config.output.md +++ b/test/fixture/class.config.output.md @@ -1,6 +1,6 @@ -# MyClass +## MyClass This is my class, a demo thing. @@ -8,7 +8,7 @@ This is my class, a demo thing. - `howMany` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** how many things it contains -## getFoo +### getFoo Get the number 42 @@ -18,12 +18,12 @@ Get the number 42 Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** forty-two -## getUndefined +### getUndefined Get undefined Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** does not return anything. -# Hello +## Hello World diff --git a/test/fixture/class.output.md b/test/fixture/class.output.md index 371b57287..df8a9e126 100644 --- a/test/fixture/class.output.md +++ b/test/fixture/class.output.md @@ -1,6 +1,6 @@ -# MyClass +## MyClass This is my class, a demo thing. @@ -8,7 +8,7 @@ This is my class, a demo thing. - `howMany` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** how many things it contains -## getFoo +### getFoo Get the number 42 @@ -18,7 +18,7 @@ Get the number 42 Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** forty-two -## getUndefined +### getUndefined Get undefined diff --git a/test/fixture/class.output.md.json b/test/fixture/class.output.md.json index 1e7d5837a..4292255b6 100644 --- a/test/fixture/class.output.md.json +++ b/test/fixture/class.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -139,7 +139,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -336,7 +336,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { diff --git a/test/fixture/document-exported-export-default-object.output.md b/test/fixture/document-exported-export-default-object.output.md index 4162bb1aa..fa48d7363 100644 --- a/test/fixture/document-exported-export-default-object.output.md +++ b/test/fixture/document-exported-export-default-object.output.md @@ -1,5 +1,5 @@ -# document-exported-export-default-object.input +## document-exported-export-default-object.input -# x +## x diff --git a/test/fixture/document-exported-export-default-object.output.md.json b/test/fixture/document-exported-export-default-object.output.md.json index c1f4ca589..c79cb8e64 100644 --- a/test/fixture/document-exported-export-default-object.output.md.json +++ b/test/fixture/document-exported-export-default-object.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -16,7 +16,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/document-exported-export-default-value.output.md b/test/fixture/document-exported-export-default-value.output.md index bf6fea702..e0d96cfbd 100644 --- a/test/fixture/document-exported-export-default-value.output.md +++ b/test/fixture/document-exported-export-default-value.output.md @@ -1,3 +1,3 @@ -# document-exported-export-default-value.input +## document-exported-export-default-value.input diff --git a/test/fixture/document-exported-export-default-value.output.md.json b/test/fixture/document-exported-export-default-value.output.md.json index 22f2087f3..686f080df 100644 --- a/test/fixture/document-exported-export-default-value.output.md.json +++ b/test/fixture/document-exported-export-default-value.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/document-exported.output.md b/test/fixture/document-exported.output.md index e6743fe0c..5c032f9d1 100644 --- a/test/fixture/document-exported.output.md +++ b/test/fixture/document-exported.output.md @@ -1,44 +1,44 @@ -# z +## z -## zMethod +### zMethod -# x +## x **Parameters** - `yparam` -# Class +## Class -## classMethod +### classMethod -## classGetter +### classGetter -## classSetter +### classSetter **Parameters** - `v` -## staticMethod +### staticMethod -## staticGetter +### staticGetter -## staticSetter +### staticSetter **Parameters** - `v` -# T5 +## T5 Type: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) -# y2Default +## y2Default -# y4 +## y4 Description of y3 @@ -48,49 +48,49 @@ Description of y3 Returns **void** -# object +## object -## prop +### prop -## func +### func -# method +## method -# getter +## getter -# setter +## setter **Parameters** - `v` -# f1 +## f1 -# f3 +## f3 -# T +## T Type: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) -# T2 +## T2 Type: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) -# T4 +## T4 Type: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) -# f4 +## f4 **Parameters** - `x` **X** -# o1 +## o1 -# om1 +## om1 -# f5 +## f5 f5 comment @@ -98,6 +98,6 @@ f5 comment - `y` **Y** -# o2 +## o2 -# om2 +## om2 diff --git a/test/fixture/document-exported.output.md.json b/test/fixture/document-exported.output.md.json index 4ccd7a6af..ad889a0a2 100644 --- a/test/fixture/document-exported.output.md.json +++ b/test/fixture/document-exported.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -16,7 +16,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -26,7 +26,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -73,7 +73,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -83,7 +83,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -93,7 +93,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -103,7 +103,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -150,7 +150,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -160,7 +160,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -170,7 +170,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -217,7 +217,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -247,7 +247,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -257,7 +257,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -377,7 +377,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -387,7 +387,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -397,7 +397,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -407,7 +407,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -417,7 +417,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -427,7 +427,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -474,7 +474,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -484,7 +484,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -494,7 +494,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -524,7 +524,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -554,7 +554,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -584,7 +584,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -640,7 +640,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -650,7 +650,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -660,7 +660,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -751,7 +751,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -761,7 +761,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/es6-class.output.md b/test/fixture/es6-class.output.md index 43266e7ba..720845afc 100644 --- a/test/fixture/es6-class.output.md +++ b/test/fixture/es6-class.output.md @@ -1,16 +1,16 @@ -# Foo +## Foo **Extends React.Component** This is my component. This is from issue #458 -# Bar +## Bar Does nothing. This is from issue #556 -## constructor +### constructor Creates a new instance @@ -18,6 +18,6 @@ Creates a new instance - `str` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** -## bar +### bar A useless property diff --git a/test/fixture/es6-class.output.md.json b/test/fixture/es6-class.output.md.json index b05fc7990..be9e2c03f 100644 --- a/test/fixture/es6-class.output.md.json +++ b/test/fixture/es6-class.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -69,7 +69,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -114,7 +114,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -212,7 +212,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { diff --git a/test/fixture/es6-default2.output.md b/test/fixture/es6-default2.output.md index 946f20dba..45a08c991 100644 --- a/test/fixture/es6-default2.output.md +++ b/test/fixture/es6-default2.output.md @@ -1,6 +1,6 @@ -# es6-default2.input +## es6-default2.input **Parameters** diff --git a/test/fixture/es6-default2.output.md.json b/test/fixture/es6-default2.output.md.json index 764e3731a..3e6561ebd 100644 --- a/test/fixture/es6-default2.output.md.json +++ b/test/fixture/es6-default2.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/es6-import.output.md b/test/fixture/es6-import.output.md index bea585d89..1fd7d3985 100644 --- a/test/fixture/es6-import.output.md +++ b/test/fixture/es6-import.output.md @@ -1,6 +1,6 @@ -# multiplyTwice +## multiplyTwice This function returns the number one. @@ -10,11 +10,11 @@ This function returns the number one. Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone -# es6-ext +## es6-ext This is the default export frogs! -# simple.input +## simple.input This function returns the number one. diff --git a/test/fixture/es6-import.output.md.json b/test/fixture/es6-import.output.md.json index eded2cef2..a07e50523 100644 --- a/test/fixture/es6-import.output.md.json +++ b/test/fixture/es6-import.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -152,7 +152,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -197,7 +197,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/es6.output.md b/test/fixture/es6.output.md index 815570663..6a3d7ffa7 100644 --- a/test/fixture/es6.output.md +++ b/test/fixture/es6.output.md @@ -1,6 +1,6 @@ -# destructure +## destructure This function destructures with defaults. It should not have any parameter descriptions. @@ -12,7 +12,7 @@ have any parameter descriptions. - `$0.emailAddresses` (optional, default `[]`) - `$0.params` **...any** -# destructure +## destructure Similar, but with an array @@ -29,7 +29,7 @@ Similar, but with an array destructure([1, 2, 3]) ``` -# multiply +## multiply This function returns the number one. @@ -40,48 +40,48 @@ This function returns the number one. Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone -# Sink +## Sink This is a sink -## staticProp +### staticProp This is a property of the sink. -## empty +### empty Is it empty -## aGetter +### aGetter This is a getter method: it should be documented as a property. -## constructor +### constructor **Parameters** - `height` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the height of the thing - `width` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the width of the thing -## hello +### hello This method says hello -# makeABasket +## makeABasket This method returns a basket. The type should not be linked. Returns **Basket** a basket -# makeASink +## makeASink This method returns a [sink](#sink). The type should be linked. It takes a [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) which should also be linked. Returns **[Sink](#sink)** a sink -# functionWithRest +## functionWithRest This function takes rest params @@ -89,7 +89,7 @@ This function takes rest params - `someParams` **...any** -# functionWithRestAndType +## functionWithRestAndType So does this one, with types @@ -97,17 +97,17 @@ So does this one, with types - `someParams` **...[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** -# foo +## foo This is an async method -# es6.input +## es6.input This function returns the number one. Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone -# veryImportantTransform +## veryImportantTransform This tests our support of optional parameters in ES6 @@ -115,19 +115,19 @@ This tests our support of optional parameters in ES6 - `foo` (optional, default `'bar'`) -# iAmProtected +## iAmProtected A protected function -# iAmPublic +## iAmPublic A public function -# execute +## execute This is re-exported -# isArrayEqualWith +## isArrayEqualWith Regression check for #498 diff --git a/test/fixture/es6.output.md.json b/test/fixture/es6.output.md.json index 512fd2610..0d8b336a2 100644 --- a/test/fixture/es6.output.md.json +++ b/test/fixture/es6.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -244,7 +244,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -428,7 +428,7 @@ "value": "destructure([1, 2, 3])" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -666,7 +666,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -711,7 +711,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -756,7 +756,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -801,7 +801,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -850,7 +850,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -1021,7 +1021,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -1066,7 +1066,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1168,7 +1168,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1365,7 +1365,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1460,7 +1460,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1562,7 +1562,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1607,7 +1607,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1716,7 +1716,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1815,7 +1815,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1860,7 +1860,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1905,7 +1905,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1950,7 +1950,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/event.output.md b/test/fixture/event.output.md index 7ef8b9ff9..60a2dcf3f 100644 --- a/test/fixture/event.output.md +++ b/test/fixture/event.output.md @@ -1,6 +1,6 @@ -# Map#mousemove +## Map#mousemove Mouse event diff --git a/test/fixture/event.output.md.json b/test/fixture/event.output.md.json index f4902ed49..4d7dc7416 100644 --- a/test/fixture/event.output.md.json +++ b/test/fixture/event.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/example-caption.output.md b/test/fixture/example-caption.output.md index ca436eccd..0bf5853b2 100644 --- a/test/fixture/example-caption.output.md +++ b/test/fixture/example-caption.output.md @@ -1,6 +1,6 @@ -# foo +## foo This function returns the number one. diff --git a/test/fixture/example-caption.output.md.json b/test/fixture/example-caption.output.md.json index 454136a7e..fa77489fc 100644 --- a/test/fixture/example-caption.output.md.json +++ b/test/fixture/example-caption.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/external.output.md b/test/fixture/external.output.md index 44bc64403..c0b4a06ef 100644 --- a/test/fixture/external.output.md +++ b/test/fixture/external.output.md @@ -1,5 +1,5 @@ -# foo +## foo I am in `external.input.js`. diff --git a/test/fixture/external.output.md.json b/test/fixture/external.output.md.json index f7b9d2962..fcd4812e8 100644 --- a/test/fixture/external.output.md.json +++ b/test/fixture/external.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/factory.output.md b/test/fixture/factory.output.md index 8447aea0e..5986399ca 100644 --- a/test/fixture/factory.output.md +++ b/test/fixture/factory.output.md @@ -1,18 +1,18 @@ -# area +## area an area chart generator Returns **[area](#area)** chart -# area +## area **Parameters** - `selection` -# data +## data Sets the chart data. diff --git a/test/fixture/factory.output.md.json b/test/fixture/factory.output.md.json index f0927c235..a4ac3c232 100644 --- a/test/fixture/factory.output.md.json +++ b/test/fixture/factory.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -115,7 +115,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -162,7 +162,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/infer-private.output.md b/test/fixture/infer-private.output.md index 7437d067b..463f6165f 100644 --- a/test/fixture/infer-private.output.md +++ b/test/fixture/infer-private.output.md @@ -1,9 +1,9 @@ -# C +## C C description -## m +### m m description diff --git a/test/fixture/infer-private.output.md.json b/test/fixture/infer-private.output.md.json index 61222fd70..38cfecf2a 100644 --- a/test/fixture/infer-private.output.md.json +++ b/test/fixture/infer-private.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -51,7 +51,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { diff --git a/test/fixture/inheritance.output.md b/test/fixture/inheritance.output.md index ced286130..80af4fa7e 100644 --- a/test/fixture/inheritance.output.md +++ b/test/fixture/inheritance.output.md @@ -1,11 +1,11 @@ -# SpecialArray +## SpecialArray **Extends Array** With ES6, built-in types are extensible! -# Foo +## Foo **Extends Bar** diff --git a/test/fixture/inheritance.output.md.json b/test/fixture/inheritance.output.md.json index 14563e2e8..944577a5f 100644 --- a/test/fixture/inheritance.output.md.json +++ b/test/fixture/inheritance.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -69,7 +69,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/inline-link.output.md b/test/fixture/inline-link.output.md index 0e6f105f1..ca214404b 100644 --- a/test/fixture/inline-link.output.md +++ b/test/fixture/inline-link.output.md @@ -1,6 +1,6 @@ -# addOne +## addOne Adds one to a number @@ -10,7 +10,7 @@ Adds one to a number Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the output -# inline-link.input +## inline-link.input This function returns the number one. Internally, this uses [addOne](#addone) to do the math. This demonstrates diff --git a/test/fixture/inline-link.output.md.json b/test/fixture/inline-link.output.md.json index 22cf26b50..4d2f11ca5 100644 --- a/test/fixture/inline-link.output.md.json +++ b/test/fixture/inline-link.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -203,7 +203,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/internal.output.md b/test/fixture/internal.output.md index 44bc64403..c0b4a06ef 100644 --- a/test/fixture/internal.output.md +++ b/test/fixture/internal.output.md @@ -1,5 +1,5 @@ -# foo +## foo I am in `external.input.js`. diff --git a/test/fixture/internal.output.md.json b/test/fixture/internal.output.md.json index f7b9d2962..fcd4812e8 100644 --- a/test/fixture/internal.output.md.json +++ b/test/fixture/internal.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/literal_types.output.md b/test/fixture/literal_types.output.md index 74753d495..335decc09 100644 --- a/test/fixture/literal_types.output.md +++ b/test/fixture/literal_types.output.md @@ -1,12 +1,12 @@ -# f +## f **Parameters** - `x` **(`"a"` \| `"b"` \| `""` \| `0` \| `-42` \| `3.14`)** -# g +## g **Parameters** diff --git a/test/fixture/literal_types.output.md.json b/test/fixture/literal_types.output.md.json index 73c1d7f7d..623c139b3 100644 --- a/test/fixture/literal_types.output.md.json +++ b/test/fixture/literal_types.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -110,7 +110,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/memberedclass.output.md b/test/fixture/memberedclass.output.md index 9eb73392d..b52e48e44 100644 --- a/test/fixture/memberedclass.output.md +++ b/test/fixture/memberedclass.output.md @@ -1,10 +1,10 @@ -# MyClass +## MyClass This is my class, a demo thing. -## getFoo +### getFoo Get the number 42 @@ -14,7 +14,7 @@ Get the number 42 Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** forty-two -## getUndefined +### getUndefined Get undefined diff --git a/test/fixture/memberedclass.output.md.json b/test/fixture/memberedclass.output.md.json index 418fc5ab1..6f4748b88 100644 --- a/test/fixture/memberedclass.output.md.json +++ b/test/fixture/memberedclass.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -51,7 +51,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -248,7 +248,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { diff --git a/test/fixture/merge-infered-type.output.md b/test/fixture/merge-infered-type.output.md index c64aef0e9..15973c29c 100644 --- a/test/fixture/merge-infered-type.output.md +++ b/test/fixture/merge-infered-type.output.md @@ -1,6 +1,6 @@ -# addFive +## addFive Add five to `x`. diff --git a/test/fixture/merge-infered-type.output.md.json b/test/fixture/merge-infered-type.output.md.json index 45d45042d..ae3c81fa8 100644 --- a/test/fixture/merge-infered-type.output.md.json +++ b/test/fixture/merge-infered-type.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/multisignature.output.md b/test/fixture/multisignature.output.md index 35fdd1d86..d476577a1 100644 --- a/test/fixture/multisignature.output.md +++ b/test/fixture/multisignature.output.md @@ -1,6 +1,6 @@ -# getTheTime +## getTheTime Get the time @@ -10,7 +10,7 @@ Get the time Returns **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** the current date -# getTheTime +## getTheTime Set the time diff --git a/test/fixture/multisignature.output.md.json b/test/fixture/multisignature.output.md.json index d3b1f7b4d..a6c7ccbc2 100644 --- a/test/fixture/multisignature.output.md.json +++ b/test/fixture/multisignature.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -152,7 +152,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/nearby_params.output.md b/test/fixture/nearby_params.output.md index 46a8965a8..ef7144c86 100644 --- a/test/fixture/nearby_params.output.md +++ b/test/fixture/nearby_params.output.md @@ -1,6 +1,6 @@ -# sessions.create +## sessions.create Attempt to establish a cookie-based session in exchange for credentials. diff --git a/test/fixture/nearby_params.output.md.json b/test/fixture/nearby_params.output.md.json index 42df8b139..72fa32537 100644 --- a/test/fixture/nearby_params.output.md.json +++ b/test/fixture/nearby_params.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/nest_params.output.md b/test/fixture/nest_params.output.md index e0e27edc6..b282e6f7a 100644 --- a/test/fixture/nest_params.output.md +++ b/test/fixture/nest_params.output.md @@ -1,6 +1,6 @@ -# foo +## foo **Parameters** @@ -9,7 +9,7 @@ - `employees[].department` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The employee's department. - `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The employee's type. (optional, default `minion`) -# foo +## foo **Parameters** diff --git a/test/fixture/nest_params.output.md.json b/test/fixture/nest_params.output.md.json index 43901c6ce..56ea626be 100644 --- a/test/fixture/nest_params.output.md.json +++ b/test/fixture/nest_params.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -369,7 +369,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/newline-in-description.output.md b/test/fixture/newline-in-description.output.md index 21fab0d89..ca0ae75f9 100644 --- a/test/fixture/newline-in-description.output.md +++ b/test/fixture/newline-in-description.output.md @@ -1,6 +1,6 @@ -# +## A function. diff --git a/test/fixture/newline-in-description.output.md.json b/test/fixture/newline-in-description.output.md.json index 4489a6504..8d79efda6 100644 --- a/test/fixture/newline-in-description.output.md.json +++ b/test/fixture/newline-in-description.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/no-name.output.md b/test/fixture/no-name.output.md index b210b1461..e6cda5c60 100644 --- a/test/fixture/no-name.output.md +++ b/test/fixture/no-name.output.md @@ -1,6 +1,6 @@ -# +## Set the time diff --git a/test/fixture/no-name.output.md.json b/test/fixture/no-name.output.md.json index 7bd427cde..fb1772a02 100644 --- a/test/fixture/no-name.output.md.json +++ b/test/fixture/no-name.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/optional-record-field-type.output.md b/test/fixture/optional-record-field-type.output.md index 706f9df9c..295779b18 100644 --- a/test/fixture/optional-record-field-type.output.md +++ b/test/fixture/optional-record-field-type.output.md @@ -1,6 +1,6 @@ -# Record +## Record Type: {opt: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?, req: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)} diff --git a/test/fixture/optional-record-field-type.output.md.json b/test/fixture/optional-record-field-type.output.md.json index c224bf65d..bb20925b8 100644 --- a/test/fixture/optional-record-field-type.output.md.json +++ b/test/fixture/optional-record-field-type.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/params.output.md b/test/fixture/params.output.md index 384ca453c..b3e8c8e95 100644 --- a/test/fixture/params.output.md +++ b/test/fixture/params.output.md @@ -1,6 +1,6 @@ -# addThem +## addThem This function returns the number one. @@ -14,7 +14,7 @@ This function returns the number one. - `$3.e` - `$3.f` -# fishesAndFoxes +## fishesAndFoxes This method has partially inferred params @@ -24,7 +24,7 @@ This method has partially inferred params - `$0.fishes` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** number of kinds of fish - `$0.foxes` -# withDefault +## withDefault This method has a type in the description and a default in the code @@ -32,11 +32,11 @@ This method has a type in the description and a default in the code - `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?= 2** -# Foo +## Foo This is foo's documentation -## method +### method The method @@ -44,7 +44,7 @@ The method - `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Param to method -# Address6 +## Address6 Represents an IPv6 address @@ -63,7 +63,7 @@ This tests our support of optional parameters var address = new Address6('2001::/32'); ``` -# GeoJSONSource +## GeoJSONSource Create a GeoJSON data source instance given an options object @@ -78,7 +78,7 @@ This tests our support of nested parameters - `options.buffer` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Tile buffer on each side. - `options.tolerance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Simplification tolerance (higher means simpler). -# myfunc +## myfunc This tests our support for parameters with explicit types but with default values specified in code. @@ -89,7 +89,7 @@ values specified in code. Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** some -# foo +## foo This tests our support of JSDoc param tags without type information, or any type information we could infer from annotations. diff --git a/test/fixture/params.output.md.json b/test/fixture/params.output.md.json index be4bc42a4..1e135e54a 100644 --- a/test/fixture/params.output.md.json +++ b/test/fixture/params.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -293,7 +293,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -492,7 +492,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -598,7 +598,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -643,7 +643,7 @@ } }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -776,7 +776,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1223,7 +1223,7 @@ "value": "var address = new Address6('2001::/32');" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1749,7 +1749,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1958,7 +1958,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/react-jsx.output.md b/test/fixture/react-jsx.output.md index f93d2550d..4f10678a2 100644 --- a/test/fixture/react-jsx.output.md +++ b/test/fixture/react-jsx.output.md @@ -1,5 +1,5 @@ -# apples +## apples apples diff --git a/test/fixture/react-jsx.output.md.json b/test/fixture/react-jsx.output.md.json index 826fc6201..7ebe87a39 100644 --- a/test/fixture/react-jsx.output.md.json +++ b/test/fixture/react-jsx.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/simple-hashbang.output.md b/test/fixture/simple-hashbang.output.md index a13e7f4a3..d4aab1e9e 100644 --- a/test/fixture/simple-hashbang.output.md +++ b/test/fixture/simple-hashbang.output.md @@ -1,6 +1,6 @@ -# simple-hashbang.input +## simple-hashbang.input This function returns the number one. diff --git a/test/fixture/simple-hashbang.output.md.json b/test/fixture/simple-hashbang.output.md.json index ff6b6f17f..eea85db79 100644 --- a/test/fixture/simple-hashbang.output.md.json +++ b/test/fixture/simple-hashbang.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/simple-two.output.md b/test/fixture/simple-two.output.md index c19dd2ab7..c37103e4b 100644 --- a/test/fixture/simple-two.output.md +++ b/test/fixture/simple-two.output.md @@ -1,6 +1,6 @@ -# returnTwo +## returnTwo This function returns the number plus two. diff --git a/test/fixture/simple-two.output.md.json b/test/fixture/simple-two.output.md.json index 63e64f430..87999cf26 100644 --- a/test/fixture/simple-two.output.md.json +++ b/test/fixture/simple-two.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/simple.output.github.md b/test/fixture/simple.output.github.md index 69a6336a1..43aadcbc9 100644 --- a/test/fixture/simple.output.github.md +++ b/test/fixture/simple.output.github.md @@ -1,6 +1,6 @@ -# simple.input +## simple.input [test/fixture/simple.input.js:5-8]([github] "Source code on GitHub") diff --git a/test/fixture/simple.output.md b/test/fixture/simple.output.md index 55ce13e20..f428519d0 100644 --- a/test/fixture/simple.output.md +++ b/test/fixture/simple.output.md @@ -1,6 +1,6 @@ -# simple.input +## simple.input This function returns the number one. diff --git a/test/fixture/simple.output.md.json b/test/fixture/simple.output.md.json index 6f30c7d2d..6ef343f9a 100644 --- a/test/fixture/simple.output.md.json +++ b/test/fixture/simple.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sort-order-alpha.output.md b/test/fixture/sort-order-alpha.output.md index 52350ab59..79a56a960 100644 --- a/test/fixture/sort-order-alpha.output.md +++ b/test/fixture/sort-order-alpha.output.md @@ -1,25 +1,25 @@ -# a +## a -# b +## b -# C +## C -## A +### A -## a +### a -## B +### B -## b +### b -# D +## D -## A +### A -## a +### a -## B +### B -## b +### b diff --git a/test/fixture/sort-order-alpha.output.md.json b/test/fixture/sort-order-alpha.output.md.json index fe0781da4..68823dd25 100644 --- a/test/fixture/sort-order-alpha.output.md.json +++ b/test/fixture/sort-order-alpha.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -16,7 +16,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -26,7 +26,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -36,7 +36,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -46,7 +46,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -56,7 +56,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -66,7 +66,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -76,7 +76,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -86,7 +86,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -96,7 +96,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -106,7 +106,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -116,7 +116,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { diff --git a/test/fixture/string-literal-key.output.md b/test/fixture/string-literal-key.output.md index cbd81f9fb..ca0924384 100644 --- a/test/fixture/string-literal-key.output.md +++ b/test/fixture/string-literal-key.output.md @@ -1,7 +1,7 @@ -# MyContainerObject +## MyContainerObject -# foo +## foo The foo property diff --git a/test/fixture/string-literal-key.output.md.json b/test/fixture/string-literal-key.output.md.json index 17d559b4b..c0bd30afe 100644 --- a/test/fixture/string-literal-key.output.md.json +++ b/test/fixture/string-literal-key.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -16,7 +16,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/alias.output.md b/test/fixture/sync/alias.output.md index 1aabd86f5..e4be23d9b 100644 --- a/test/fixture/sync/alias.output.md +++ b/test/fixture/sync/alias.output.md @@ -1,6 +1,6 @@ -# nixon +## nixon This is a method that has an alias tag: so it should be referred to as nixon, but should still have inference. diff --git a/test/fixture/sync/alias.output.md.json b/test/fixture/sync/alias.output.md.json index 1e92a953d..e66cb90d7 100644 --- a/test/fixture/sync/alias.output.md.json +++ b/test/fixture/sync/alias.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/empty-example.output.md b/test/fixture/sync/empty-example.output.md index de994437e..59418f38f 100644 --- a/test/fixture/sync/empty-example.output.md +++ b/test/fixture/sync/empty-example.output.md @@ -1,5 +1,5 @@ -# returnTwo +## returnTwo This function returns the number plus two. diff --git a/test/fixture/sync/empty-example.output.md.json b/test/fixture/sync/empty-example.output.md.json index 6cb4a8eb6..f83249dbf 100644 --- a/test/fixture/sync/empty-example.output.md.json +++ b/test/fixture/sync/empty-example.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/flow-types.output.md b/test/fixture/sync/flow-types.output.md index 14d68bd2b..470e0e501 100644 --- a/test/fixture/sync/flow-types.output.md +++ b/test/fixture/sync/flow-types.output.md @@ -1,6 +1,6 @@ -# addThem +## addThem This function returns the number one. @@ -15,7 +15,7 @@ This function returns the number one. Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** -# Point +## Point A 2D point. @@ -31,7 +31,7 @@ Type: {x: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer - `props.radius` **{x: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)}** - `props.radius.x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** -# Two +## Two A type with entirely derived properties @@ -43,19 +43,19 @@ Type: {x: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer - `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** - `z` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** -# T +## T Just an alias for an array of strings Type: [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)> -# T +## T My type Type: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) -# veryImportantTransform +## veryImportantTransform Very Important Transform @@ -66,7 +66,7 @@ Very Important Transform Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** -# optionalFunc +## optionalFunc Function with optional parameter. @@ -74,7 +74,7 @@ Function with optional parameter. - `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** (optional, default `42`) -# objectParamFn +## objectParamFn Function with object parameter. @@ -82,7 +82,7 @@ Function with object parameter. - `x` **{a: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)}** -# objectParamFn +## objectParamFn hi @@ -90,7 +90,7 @@ hi - `x` **function (y: Foo): Bar** -# SomeObjectAPI +## SomeObjectAPI Define my object API diff --git a/test/fixture/sync/flow-types.output.md.json b/test/fixture/sync/flow-types.output.md.json index 283ad8ae5..ab82f46ce 100644 --- a/test/fixture/sync/flow-types.output.md.json +++ b/test/fixture/sync/flow-types.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -339,7 +339,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -891,7 +891,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1143,7 +1143,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1227,7 +1227,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1292,7 +1292,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1497,7 +1497,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1616,7 +1616,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1726,7 +1726,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -1837,7 +1837,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/lots-of-options.output.md b/test/fixture/sync/lots-of-options.output.md index 55321bdcb..014f72bda 100644 --- a/test/fixture/sync/lots-of-options.output.md +++ b/test/fixture/sync/lots-of-options.output.md @@ -1,6 +1,6 @@ -# gsd +## gsd Global spectra deconvolution diff --git a/test/fixture/sync/lots-of-options.output.md.json b/test/fixture/sync/lots-of-options.output.md.json index 0be407f12..3548d2ca9 100644 --- a/test/fixture/sync/lots-of-options.output.md.json +++ b/test/fixture/sync/lots-of-options.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/meta.output.md b/test/fixture/sync/meta.output.md index 97c676fbf..1845faf0f 100644 --- a/test/fixture/sync/meta.output.md +++ b/test/fixture/sync/meta.output.md @@ -1,6 +1,6 @@ -# dewey +## dewey This function has a lot of metadata diff --git a/test/fixture/sync/meta.output.md.json b/test/fixture/sync/meta.output.md.json index d2fb3424a..c7ce42220 100644 --- a/test/fixture/sync/meta.output.md.json +++ b/test/fixture/sync/meta.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/multiexample.output.md b/test/fixture/sync/multiexample.output.md index 9090b94d4..caff6189a 100644 --- a/test/fixture/sync/multiexample.output.md +++ b/test/fixture/sync/multiexample.output.md @@ -1,6 +1,6 @@ -# multiexample.input +## multiexample.input **Extends Foo, Bar** diff --git a/test/fixture/sync/multiexample.output.md.json b/test/fixture/sync/multiexample.output.md.json index b08c2dc91..eed8b0606 100644 --- a/test/fixture/sync/multiexample.output.md.json +++ b/test/fixture/sync/multiexample.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/rename.output.md b/test/fixture/sync/rename.output.md index 87c9ed441..2da5756bf 100644 --- a/test/fixture/sync/rename.output.md +++ b/test/fixture/sync/rename.output.md @@ -1,5 +1,5 @@ -# cheese +## cheese Cheesoid! diff --git a/test/fixture/sync/rename.output.md.json b/test/fixture/sync/rename.output.md.json index bec4f3a8d..b43c1b194 100644 --- a/test/fixture/sync/rename.output.md.json +++ b/test/fixture/sync/rename.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/throws.output.md b/test/fixture/sync/throws.output.md index fda184f61..18a960f06 100644 --- a/test/fixture/sync/throws.output.md +++ b/test/fixture/sync/throws.output.md @@ -1,6 +1,6 @@ -# returnTwo +## returnTwo This function returns the number plus two. diff --git a/test/fixture/sync/throws.output.md.json b/test/fixture/sync/throws.output.md.json index a89bee28b..bd52a315a 100644 --- a/test/fixture/sync/throws.output.md.json +++ b/test/fixture/sync/throws.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/trailing-only.output.md b/test/fixture/sync/trailing-only.output.md index 1997477f4..a464834b2 100644 --- a/test/fixture/sync/trailing-only.output.md +++ b/test/fixture/sync/trailing-only.output.md @@ -1,6 +1,6 @@ -# +## this is a type diff --git a/test/fixture/sync/trailing-only.output.md.json b/test/fixture/sync/trailing-only.output.md.json index ba50618be..7dc0f561f 100644 --- a/test/fixture/sync/trailing-only.output.md.json +++ b/test/fixture/sync/trailing-only.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/trailing.output.md b/test/fixture/sync/trailing.output.md index fbd87c100..33d39203b 100644 --- a/test/fixture/sync/trailing.output.md +++ b/test/fixture/sync/trailing.output.md @@ -1,17 +1,17 @@ -# fooBar +## fooBar ONE Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** something -# fooBaz +## fooBaz TWO Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** something -# Something +## Something this is a type diff --git a/test/fixture/sync/trailing.output.md.json b/test/fixture/sync/trailing.output.md.json index 4858cb671..655ed545a 100644 --- a/test/fixture/sync/trailing.output.md.json +++ b/test/fixture/sync/trailing.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -115,7 +115,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -224,7 +224,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/sync/typedef.output.md b/test/fixture/sync/typedef.output.md index 35d1486f9..90a5d5c5d 100644 --- a/test/fixture/sync/typedef.output.md +++ b/test/fixture/sync/typedef.output.md @@ -1,6 +1,6 @@ -# MyType +## MyType A type definition. diff --git a/test/fixture/sync/typedef.output.md.json b/test/fixture/sync/typedef.output.md.json index 46571272d..8fc8da623 100644 --- a/test/fixture/sync/typedef.output.md.json +++ b/test/fixture/sync/typedef.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/system-import.output.md b/test/fixture/system-import.output.md index 55ce13e20..f428519d0 100644 --- a/test/fixture/system-import.output.md +++ b/test/fixture/system-import.output.md @@ -1,6 +1,6 @@ -# simple.input +## simple.input This function returns the number one. diff --git a/test/fixture/system-import.output.md.json b/test/fixture/system-import.output.md.json index 6f30c7d2d..6ef343f9a 100644 --- a/test/fixture/system-import.output.md.json +++ b/test/fixture/system-import.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/this-class.output.md b/test/fixture/this-class.output.md index 58972fd9b..68e637245 100644 --- a/test/fixture/this-class.output.md +++ b/test/fixture/this-class.output.md @@ -1,27 +1,27 @@ -# bookshelf +## bookshelf **Parameters** - `title` -# Book +## Book **Parameters** - `title` -## title +### title The title of the book. -# BookShelf +## BookShelf **Parameters** - `title` -## title +### title The title of the bookshelf. diff --git a/test/fixture/this-class.output.md.json b/test/fixture/this-class.output.md.json index 0af859a69..e7b15ff40 100644 --- a/test/fixture/this-class.output.md.json +++ b/test/fixture/this-class.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -53,7 +53,7 @@ ] }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -100,7 +100,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { @@ -145,7 +145,7 @@ } }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { @@ -192,7 +192,7 @@ ] }, { - "depth": 2, + "depth": 3, "type": "heading", "children": [ { diff --git a/test/fixture/type_application.output.md b/test/fixture/type_application.output.md index d0a37c275..b2568c017 100644 --- a/test/fixture/type_application.output.md +++ b/test/fixture/type_application.output.md @@ -1,6 +1,6 @@ -# Address6 +## Address6 Represents an IPv6 address diff --git a/test/fixture/type_application.output.md.json b/test/fixture/type_application.output.md.json index 278ea5479..a77cd28e9 100644 --- a/test/fixture/type_application.output.md.json +++ b/test/fixture/type_application.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/fixture/var-function-param-return.output.md b/test/fixture/var-function-param-return.output.md index dc2fd69e0..bfbf02a26 100644 --- a/test/fixture/var-function-param-return.output.md +++ b/test/fixture/var-function-param-return.output.md @@ -1,6 +1,6 @@ -# f +## f **Parameters** diff --git a/test/fixture/var-function-param-return.output.md.json b/test/fixture/var-function-param-return.output.md.json index ac9fb9874..cc30bcd50 100644 --- a/test/fixture/var-function-param-return.output.md.json +++ b/test/fixture/var-function-param-return.output.md.json @@ -6,7 +6,7 @@ "value": "" }, { - "depth": 1, + "depth": 2, "type": "heading", "children": [ { diff --git a/test/test.js b/test/test.js index 74412f9bb..a31667f81 100644 --- a/test/test.js +++ b/test/test.js @@ -252,7 +252,7 @@ test('highlightAuto md output', function (t) { test('config', function (t) { var file = path.join(__dirname, 'fixture', 'class.input.js'); - var result = fs.readFileSync(path.join(__dirname, 'fixture', 'class.config.output.md')).toString(); + var outputfile = path.join(__dirname, 'fixture', 'class.config.output.md'); documentation.build([file], { config: path.join(__dirname, 'fixture', 'simple.config.yml') }, function (err, out) { @@ -260,6 +260,11 @@ test('config', function (t) { outputMarkdown(out, {}, function (err, md) { t.ifError(err); + if (UPDATE) { + fs.writeFileSync(outputfile, md); + } + var result = fs.readFileSync(outputfile, 'utf8'); + t.equal(md, result, 'rendered markdown is equal'); t.end(); });