Skip to content

Commit 2ae5d8f

Browse files
authored
fix(markdown): Start headings in Markdown at h2 (#644)
Fixes #641
1 parent 813dfbb commit 2ae5d8f

File tree

103 files changed

+319
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+319
-314
lines changed

docs/NODE_API.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# build
3+
## build
44

55
Generate JavaScript documentation as a list of parsed JSDoc
66
comments, given a root file as a path.
@@ -54,7 +54,7 @@ documentation.build(['index.js'], {
5454

5555
Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** calls callback
5656

57-
# buildSync
57+
## buildSync
5858

5959
Generate JavaScript documentation given a list of inputs. This internal
6060
method does not support require-following and it returns its results
@@ -100,7 +100,7 @@ var results = documentation.buildSync(['index.js']);
100100

101101
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** list of results
102102

103-
# lint
103+
## lint
104104

105105
Lint files for non-standard or incorrect documentation
106106
information, returning a potentially-empty string
@@ -145,14 +145,14 @@ documentation.lint('file.js', {}, function (err, lintOutput) {
145145

146146
Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** calls callback
147147

148-
# formats
148+
## formats
149149

150150
Documentation's formats are modular methods that take comments
151151
and options as input and call a callback with writable objects,
152152
like stringified JSON, markdown strings, or Vinyl objects for HTML
153153
output.
154154

155-
# formats.html
155+
## formats.html
156156

157157
Formats documentation as HTML.
158158

@@ -179,7 +179,7 @@ documentation.build(['index.js'], {}, function (err, res) {
179179

180180
Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** Calls callback.
181181

182-
# formats.markdown
182+
## formats.markdown
183183

184184
Formats documentation as
185185
[Markdown](http://daringfireball.net/projects/markdown/).
@@ -206,7 +206,7 @@ documentation.build(['index.js'], {}, function (err, res) {
206206

207207
Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** calls callback
208208

209-
# formats.json
209+
## formats.json
210210

211211
Formats documentation as a JSON string.
212212

lib/output/markdown_ast.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function commentsToAST(comments, options, callback) {
204204

205205
return callback(null, rerouteLinks(linkerStack.link,
206206
u('root', generatorComment.concat(comments.reduce(function (memo, comment) {
207-
return memo.concat(generate(1, comment));
207+
return memo.concat(generate(2, comment));
208208
}, [])))));
209209
}
210210

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
},
8686
"scripts": {
8787
"lint": "eslint bin lib index.js test",
88-
"doc": "documentation build index.js -f md --access=public > docs/NODE_API.md",
88+
"doc": "./bin/documentation.js build index.js -f md --access=public > docs/NODE_API.md",
8989
"changelog": "standard-changelog -i CHANGELOG.md -w",
9090
"self-lint": "node ./bin/documentation.js lint",
9191
"test": "npm run lint && npm run self-lint && tap -t 120 --coverage --nyc-arg=--cache test/*.js test/lib test/streams"

test/fixture/auto_lang_hljs/multilanguage.output.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# multilanguage.input
3+
## multilanguage.input
44

55
**Extends Foo, Bar**
66

test/fixture/boolean-literal-type.output.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# f
3+
## f
44

55
**Parameters**
66

test/fixture/boolean-literal-type.output.md.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
77
},
88
{
9-
"depth": 1,
9+
"depth": 2,
1010
"type": "heading",
1111
"children": [
1212
{

test/fixture/class.config.output.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# MyClass
3+
## MyClass
44

55
This is my class, a demo thing.
66

77
**Properties**
88

99
- `howMany` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** how many things it contains
1010

11-
## getFoo
11+
### getFoo
1212

1313
Get the number 42
1414

@@ -18,12 +18,12 @@ Get the number 42
1818

1919
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** forty-two
2020

21-
## getUndefined
21+
### getUndefined
2222

2323
Get undefined
2424

2525
Returns **[undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)** does not return anything.
2626

27-
# Hello
27+
## Hello
2828

2929
World

test/fixture/class.output.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# MyClass
3+
## MyClass
44

55
This is my class, a demo thing.
66

77
**Properties**
88

99
- `howMany` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** how many things it contains
1010

11-
## getFoo
11+
### getFoo
1212

1313
Get the number 42
1414

@@ -18,7 +18,7 @@ Get the number 42
1818

1919
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** forty-two
2020

21-
## getUndefined
21+
### getUndefined
2222

2323
Get undefined
2424

test/fixture/class.output.md.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
77
},
88
{
9-
"depth": 1,
9+
"depth": 2,
1010
"type": "heading",
1111
"children": [
1212
{
@@ -139,7 +139,7 @@
139139
]
140140
},
141141
{
142-
"depth": 2,
142+
"depth": 3,
143143
"type": "heading",
144144
"children": [
145145
{
@@ -336,7 +336,7 @@
336336
]
337337
},
338338
{
339-
"depth": 2,
339+
"depth": 3,
340340
"type": "heading",
341341
"children": [
342342
{
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# document-exported-export-default-object.input
3+
## document-exported-export-default-object.input
44

5-
# x
5+
## x

test/fixture/document-exported-export-default-object.output.md.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
77
},
88
{
9-
"depth": 1,
9+
"depth": 2,
1010
"type": "heading",
1111
"children": [
1212
{
@@ -16,7 +16,7 @@
1616
]
1717
},
1818
{
19-
"depth": 1,
19+
"depth": 2,
2020
"type": "heading",
2121
"children": [
2222
{
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# document-exported-export-default-value.input
3+
## document-exported-export-default-value.input

test/fixture/document-exported-export-default-value.output.md.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
77
},
88
{
9-
"depth": 1,
9+
"depth": 2,
1010
"type": "heading",
1111
"children": [
1212
{
+30-30
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
# z
3+
## z
44

5-
## zMethod
5+
### zMethod
66

7-
# x
7+
## x
88

99
**Parameters**
1010

1111
- `yparam`
1212

13-
# Class
13+
## Class
1414

15-
## classMethod
15+
### classMethod
1616

17-
## classGetter
17+
### classGetter
1818

19-
## classSetter
19+
### classSetter
2020

2121
**Parameters**
2222

2323
- `v`
2424

25-
## staticMethod
25+
### staticMethod
2626

27-
## staticGetter
27+
### staticGetter
2828

29-
## staticSetter
29+
### staticSetter
3030

3131
**Parameters**
3232

3333
- `v`
3434

35-
# T5
35+
## T5
3636

3737
Type: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
3838

39-
# y2Default
39+
## y2Default
4040

41-
# y4
41+
## y4
4242

4343
Description of y3
4444

@@ -48,56 +48,56 @@ Description of y3
4848

4949
Returns **void**
5050

51-
# object
51+
## object
5252

53-
## prop
53+
### prop
5454

55-
## func
55+
### func
5656

57-
# method
57+
## method
5858

59-
# getter
59+
## getter
6060

61-
# setter
61+
## setter
6262

6363
**Parameters**
6464

6565
- `v`
6666

67-
# f1
67+
## f1
6868

69-
# f3
69+
## f3
7070

71-
# T
71+
## T
7272

7373
Type: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)
7474

75-
# T2
75+
## T2
7676

7777
Type: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
7878

79-
# T4
79+
## T4
8080

8181
Type: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
8282

83-
# f4
83+
## f4
8484

8585
**Parameters**
8686

8787
- `x` **X**
8888

89-
# o1
89+
## o1
9090

91-
# om1
91+
## om1
9292

93-
# f5
93+
## f5
9494

9595
f5 comment
9696

9797
**Parameters**
9898

9999
- `y` **Y**
100100

101-
# o2
101+
## o2
102102

103-
# om2
103+
## om2

0 commit comments

Comments
 (0)