diff --git a/__tests__/__snapshots__/bin-readme.js.snap b/__tests__/__snapshots__/bin-readme.js.snap index 535e3a0b5..f82e9545f 100644 --- a/__tests__/__snapshots__/bin-readme.js.snap +++ b/__tests__/__snapshots__/bin-readme.js.snap @@ -10,13 +10,15 @@ exports[`readme autodetection of different filenames updates readme.markdown 1`] ### Table of Contents - [foo](#foo) + - [Parameters](#parameters) - [bar](#bar) + - [Parameters](#parameters-1) ## foo A function with documentation. -**Parameters** +### Parameters - \`a\` {string} blah @@ -26,7 +28,7 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G A second function with docs -**Parameters** +### Parameters - \`b\` @@ -44,13 +46,15 @@ exports[`readme command --readme-file 1`] = ` ### Table of Contents - [foo](#foo) + - [Parameters](#parameters) - [bar](#bar) + - [Parameters](#parameters-1) ## foo A function with documentation. -**Parameters** +### Parameters - \`a\` {string} blah @@ -60,7 +64,7 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G A second function with docs -**Parameters** +### Parameters - \`b\` @@ -78,13 +82,15 @@ exports[`readme command updates README.md 1`] = ` ### Table of Contents - [foo](#foo) + - [Parameters](#parameters) - [bar](#bar) + - [Parameters](#parameters-1) ## foo A function with documentation. -**Parameters** +### Parameters - \`a\` {string} blah @@ -94,7 +100,7 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G A second function with docs -**Parameters** +### Parameters - \`b\` diff --git a/__tests__/__snapshots__/bin.js.snap b/__tests__/__snapshots__/bin.js.snap index a74afa5ba..150d9b203 100644 --- a/__tests__/__snapshots__/bin.js.snap +++ b/__tests__/__snapshots__/bin.js.snap @@ -1772,33 +1772,41 @@ exports[`build --document-exported 1`] = ` - [z][1] - [zMethod][2] - [x][3] -- [Class][4] - - [classMethod][5] - - [classGetter][6] - - [classSetter][7] - - [staticMethod][8] - - [staticGetter][9] - - [staticSetter][10] -- [T5][11] -- [y2Default][12] -- [y4][13] -- [object][14] - - [method][15] - - [getter][16] - - [setter][17] - - [prop][18] - - [func][19] -- [f1][20] -- [f3][21] -- [T][22] -- [T2][23] -- [T4][24] -- [f4][25] -- [o1][26] - - [om1][27] -- [f5][28] -- [o2][29] - - [om2][30] + - [Parameters][4] +- [Class][5] + - [Parameters][6] + - [classMethod][7] + - [classGetter][8] + - [classSetter][9] + - [Parameters][10] + - [staticMethod][11] + - [staticGetter][12] + - [staticSetter][13] + - [Parameters][14] +- [T5][15] +- [y2Default][16] +- [y4][17] + - [Parameters][18] +- [object][19] + - [method][20] + - [getter][21] + - [setter][22] + - [Parameters][23] + - [prop][24] + - [func][25] +- [f1][26] +- [f3][27] +- [T][28] +- [T2][29] +- [T4][30] +- [f4][31] + - [Parameters][32] +- [o1][33] + - [om1][34] +- [f5][35] + - [Parameters][36] +- [o2][37] + - [om2][38] ## z @@ -1806,15 +1814,15 @@ exports[`build --document-exported 1`] = ` ## x -**Parameters** +### Parameters - \`yparam\` ## Class -**Parameters** +### Parameters -- \`a\` **[string][31]** +- \`a\` **[string][39]** ### classMethod @@ -1822,7 +1830,7 @@ exports[`build --document-exported 1`] = ` ### classSetter -**Parameters** +#### Parameters - \`v\` @@ -1832,13 +1840,13 @@ exports[`build --document-exported 1`] = ` ### staticSetter -**Parameters** +#### Parameters - \`v\` ## T5 -Type: [boolean][32] +Type: [boolean][40] ## y2Default @@ -1846,9 +1854,9 @@ Type: [boolean][32] Description of y3 -**Parameters** +### Parameters -- \`p\` **[number][33]** +- \`p\` **[number][41]** Returns **void** @@ -1860,7 +1868,7 @@ Returns **void** ### setter -**Parameters** +#### Parameters - \`v\` @@ -1874,19 +1882,19 @@ Returns **void** ## T -Type: [number][33] +Type: [number][41] ## T2 -Type: [string][31] +Type: [string][39] ## T4 -Type: [string][31] +Type: [string][39] ## f4 -**Parameters** +### Parameters - \`x\` **X** @@ -1898,7 +1906,7 @@ Type: [string][31] f5 comment -**Parameters** +### Parameters - \`y\` **Y** @@ -1912,65 +1920,81 @@ f5 comment [3]: #x -[4]: #class +[4]: #parameters -[5]: #classmethod +[5]: #class -[6]: #classgetter +[6]: #parameters-1 -[7]: #classsetter +[7]: #classmethod -[8]: #staticmethod +[8]: #classgetter -[9]: #staticgetter +[9]: #classsetter -[10]: #staticsetter +[10]: #parameters-2 -[11]: #t5 +[11]: #staticmethod -[12]: #y2default +[12]: #staticgetter -[13]: #y4 +[13]: #staticsetter -[14]: #object +[14]: #parameters-3 -[15]: #method +[15]: #t5 -[16]: #getter +[16]: #y2default -[17]: #setter +[17]: #y4 -[18]: #prop +[18]: #parameters-4 -[19]: #func +[19]: #object -[20]: #f1 +[20]: #method -[21]: #f3 +[21]: #getter -[22]: #t +[22]: #setter -[23]: #t2 +[23]: #parameters-5 -[24]: #t4 +[24]: #prop -[25]: #f4 +[25]: #func -[26]: #o1 +[26]: #f1 -[27]: #om1 +[27]: #f3 -[28]: #f5 +[28]: #t -[29]: #o2 +[29]: #t2 -[30]: #om2 +[30]: #t4 -[31]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[31]: #f4 -[32]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[32]: #parameters-6 -[33]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +[33]: #o1 + +[34]: #om1 + +[35]: #f5 + +[36]: #parameters-7 + +[37]: #o2 + +[38]: #om2 + +[39]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[40]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean + +[41]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number " `; diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 229ac934d..51fc49107 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -567,7 +567,7 @@ exports[`config 1`] = ` This is my class, a demo thing. -**Properties** +### Properties - \`howMany\` **[number][1]** how many things it contains @@ -575,7 +575,7 @@ This is my class, a demo thing. Get the number 42 -**Parameters** +#### Parameters - \`getIt\` **[boolean][2]** whether to get the number @@ -638,7 +638,7 @@ This class has some members second::foo -**Parameters** +###### Parameters - \`pork\` @@ -646,7 +646,7 @@ second::foo second::bar -**Parameters** +###### Parameters - \`beans\` - \`rice\` @@ -1352,7 +1352,7 @@ exports[`highlightAuto md output 1`] = ` This function returns the number one. -**Examples** +### Examples \`\`\`js var myFoo = new Foo('[data-foo]'); @@ -3347,7 +3347,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -4137,7 +4138,8 @@ Object { "value": "Properties", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -4270,7 +4272,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -6725,7 +6728,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -6772,7 +6776,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -6855,7 +6860,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -6922,7 +6928,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -7044,7 +7051,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -7159,7 +7167,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -7336,7 +7345,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -7447,7 +7457,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -10860,7 +10871,8 @@ have any parameter descriptions.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -11094,7 +11106,8 @@ have any parameter descriptions.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -11219,7 +11232,8 @@ have any parameter descriptions.", "value": "Examples", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "lang": "javascript", @@ -11278,7 +11292,8 @@ have any parameter descriptions.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -11516,7 +11531,8 @@ have any parameter descriptions.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -11677,7 +11693,8 @@ have any parameter descriptions.", "value": "Examples", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "lang": "javascript", @@ -11830,7 +11847,8 @@ class A { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -12324,7 +12342,8 @@ It takes a ", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -12419,7 +12438,8 @@ It takes a ", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -12675,7 +12695,8 @@ It takes a ", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -12909,7 +12930,8 @@ It takes a ", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -13185,7 +13207,8 @@ It takes a ", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -13919,7 +13942,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -14082,7 +14106,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -14864,7 +14889,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -15415,7 +15441,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -16024,7 +16051,8 @@ Object { "value": "Properties", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -16488,7 +16516,8 @@ Object { "value": "Examples", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -17400,7 +17429,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -19524,7 +19554,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -19847,7 +19878,8 @@ and ", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -20235,7 +20267,8 @@ Object { "value": "Properties", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -21479,7 +21512,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -21676,7 +21710,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -22071,7 +22106,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -22175,7 +22211,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -22929,7 +22966,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -23578,7 +23616,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -25143,7 +25182,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -25289,7 +25329,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -26044,7 +26085,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -27379,7 +27421,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -27738,7 +27781,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -27978,7 +28022,8 @@ Object { "value": "Properties", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -28520,7 +28565,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -28806,7 +28852,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -29046,7 +29093,8 @@ Object { "value": "Properties", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -32048,7 +32096,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -32335,7 +32384,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -32534,7 +32584,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -32694,7 +32745,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -32872,7 +32924,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -32989,7 +33042,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -33334,7 +33388,8 @@ Object { "value": "Examples", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "lang": "javascript", @@ -33428,7 +33483,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -33921,7 +33977,8 @@ values specified in code.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -34140,7 +34197,8 @@ or any type information we could infer from annotations.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -34262,7 +34320,8 @@ iterator destructure (RestElement)", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -35831,7 +35890,8 @@ that doesn't crash anything!", "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -35913,7 +35973,8 @@ that doesn't crash anything!", "value": "Parameters", }, ], - "type": "strong", + "depth": 4, + "type": "heading", }, Object { "children": Array [ @@ -36906,7 +36967,8 @@ plus 3.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -37132,7 +37194,8 @@ plus 3.", "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -37994,7 +38057,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -38082,7 +38146,8 @@ Object { "value": "Examples", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "lang": "javascript", @@ -39965,7 +40030,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -40057,7 +40123,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -40403,7 +40470,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ @@ -40620,7 +40688,8 @@ Object { "value": "Parameters", }, ], - "type": "strong", + "depth": 3, + "type": "heading", }, Object { "children": Array [ diff --git a/docs/NODE_API.md b/docs/NODE_API.md index 275a423fe..a366b2497 100644 --- a/docs/NODE_API.md +++ b/docs/NODE_API.md @@ -3,11 +3,21 @@ ### Table of Contents - [lint][1] -- [build][2] -- [formats][3] -- [formats.html][4] -- [formats.markdown][5] -- [formats.json][6] + - [Parameters][2] + - [Examples][3] +- [build][4] + - [Parameters][5] + - [Examples][6] +- [formats][7] +- [formats.html][8] + - [Parameters][9] + - [Examples][10] +- [formats.markdown][11] + - [Parameters][12] + - [Examples][13] +- [formats.json][14] + - [Parameters][15] + - [Examples][16] ## lint @@ -15,23 +25,23 @@ Lint files for non-standard or incorrect documentation information, returning a potentially-empty string of lint information intended for human-readable output. -**Parameters** +### Parameters -- `indexes` **([Array][7]<[string][8]> | [string][8])** files to process -- `args` **[Object][9]** args - - `args.external` **[Array][7]<[string][8]>** a string regex / glob match pattern +- `indexes` **([Array][17]<[string][18]> | [string][18])** files to process +- `args` **[Object][19]** args + - `args.external` **[Array][17]<[string][18]>** a string regex / glob match pattern that defines what external modules will be whitelisted and included in the generated documentation. - - `args.shallow` **[boolean][10]** whether to avoid dependency parsing + - `args.shallow` **[boolean][20]** whether to avoid dependency parsing even in JavaScript code. (optional, default `false`) - - `args.inferPrivate` **[string][8]?** a valid regular expression string + - `args.inferPrivate` **[string][18]?** a valid regular expression string to infer whether a code element should be private, given its naming structure. For instance, you can specify `inferPrivate: '^_'` to automatically treat methods named like `_myMethod` as private. - - `args.extension` **([string][8] \| [Array][7]<[string][8]>)?** treat additional file extensions + - `args.extension` **([string][18] \| [Array][17]<[string][18]>)?** treat additional file extensions as JavaScript, extending the default set of `js`, `es6`, and `jsx`. -**Examples** +### Examples ```javascript documentation.lint('file.js').then(lintOutput => { @@ -44,37 +54,37 @@ documentation.lint('file.js').then(lintOutput => { }); ``` -Returns **[Promise][11]** promise with lint results +Returns **[Promise][21]** promise with lint results ## build Generate JavaScript documentation as a list of parsed JSDoc comments, given a root file as a path. -**Parameters** +### Parameters -- `indexes` **([Array][7]<[string][8]> | [string][8])** files to process -- `args` **[Object][9]** args - - `args.external` **[Array][7]<[string][8]>** a string regex / glob match pattern +- `indexes` **([Array][17]<[string][18]> | [string][18])** files to process +- `args` **[Object][19]** args + - `args.external` **[Array][17]<[string][18]>** a string regex / glob match pattern that defines what external modules will be whitelisted and included in the generated documentation. - - `args.shallow` **[boolean][10]** whether to avoid dependency parsing + - `args.shallow` **[boolean][20]** whether to avoid dependency parsing even in JavaScript code. (optional, default `false`) - - `args.order` **[Array][7]<([string][8] \| [Object][9])>** optional array that + - `args.order` **[Array][17]<([string][18] \| [Object][19])>** optional array that defines sorting order of documentation (optional, default `[]`) - - `args.access` **[Array][7]<[string][8]>** an array of access levels + - `args.access` **[Array][17]<[string][18]>** an array of access levels to output in documentation (optional, default `[]`) - - `args.hljs` **[Object][9]?** hljs optional args - - `args.hljs.highlightAuto` **[boolean][10]** hljs automatically detect language (optional, default `false`) - - `args.hljs.languages` **[Array][7]?** languages for hljs to choose from - - `args.inferPrivate` **[string][8]?** a valid regular expression string + - `args.hljs` **[Object][19]?** hljs optional args + - `args.hljs.highlightAuto` **[boolean][20]** hljs automatically detect language (optional, default `false`) + - `args.hljs.languages` **[Array][17]?** languages for hljs to choose from + - `args.inferPrivate` **[string][18]?** a valid regular expression string to infer whether a code element should be private, given its naming structure. For instance, you can specify `inferPrivate: '^_'` to automatically treat methods named like `_myMethod` as private. - - `args.extension` **([string][8] \| [Array][7]<[string][8]>)?** treat additional file extensions + - `args.extension` **([string][18] \| [Array][17]<[string][18]>)?** treat additional file extensions as JavaScript, extending the default set of `js`, `es6`, and `jsx`. -**Examples** +### Examples ```javascript var documentation = require('documentation'); @@ -89,7 +99,7 @@ documentation.build(['index.js'], { }); ``` -Returns **[Promise][11]** results +Returns **[Promise][21]** results ## formats @@ -102,13 +112,13 @@ output. Formats documentation as HTML. -**Parameters** +### Parameters -- `comments` **[Array][7]<[Comment][12]>** parsed comments -- `config` **[Object][9]** Options that can customize the output - - `config.theme` **[string][8]** Name of a module used for an HTML theme. (optional, default `'default_theme'`) +- `comments` **[Array][17]<[Comment][22]>** parsed comments +- `config` **[Object][19]** Options that can customize the output + - `config.theme` **[string][18]** Name of a module used for an HTML theme. (optional, default `'default_theme'`) -**Examples** +### Examples ```javascript var documentation = require('documentation'); @@ -122,19 +132,19 @@ documentation.build(['index.js']) }); ``` -Returns **[Promise][11]<[Array][7]<[Object][9]>>** Promise with results +Returns **[Promise][21]<[Array][17]<[Object][19]>>** Promise with results ## formats.markdown Formats documentation as -[Markdown][13]. +[Markdown][23]. -**Parameters** +### Parameters -- `comments` **[Array][7]<[Object][9]>** parsed comments -- `args` **[Object][9]** Options that can customize the output +- `comments` **[Array][17]<[Object][19]>** parsed comments +- `args` **[Object][19]** Options that can customize the output -**Examples** +### Examples ```javascript var documentation = require('documentation'); @@ -148,17 +158,17 @@ documentation.build(['index.js']) }); ``` -Returns **[Promise][11]<[string][8]>** a promise of the eventual value +Returns **[Promise][21]<[string][18]>** a promise of the eventual value ## formats.json Formats documentation as a JSON string. -**Parameters** +### Parameters -- `comments` **[Array][7]<[Comment][12]>** parsed comments +- `comments` **[Array][17]<[Comment][22]>** parsed comments -**Examples** +### Examples ```javascript var documentation = require('documentation'); @@ -172,30 +182,50 @@ documentation.build(['index.js']) }); ``` -Returns **[Promise][11]<[string][8]>** +Returns **[Promise][21]<[string][18]>** [1]: #lint -[2]: #build +[2]: #parameters -[3]: #formats +[3]: #examples -[4]: #formatshtml +[4]: #build -[5]: #formatsmarkdown +[5]: #parameters-1 -[6]: #formatsjson +[6]: #examples-1 -[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array +[7]: #formats -[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[8]: #formatshtml -[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[9]: #parameters-2 -[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[10]: #examples-2 -[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise +[11]: #formatsmarkdown -[12]: https://developer.mozilla.org/docs/Web/API/Comment/Comment +[12]: #parameters-3 -[13]: http://daringfireball.net/projects/markdown/ +[13]: #examples-3 + +[14]: #formatsjson + +[15]: #parameters-4 + +[16]: #examples-4 + +[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array + +[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object + +[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean + +[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise + +[22]: https://developer.mozilla.org/docs/Web/API/Comment/Comment + +[23]: http://daringfireball.net/projects/markdown/ diff --git a/src/output/markdown_ast.js b/src/output/markdown_ast.js index 5efa3f61c..8760a9634 100644 --- a/src/output/markdown_ast.js +++ b/src/output/markdown_ast.js @@ -113,7 +113,7 @@ function buildMarkdownAST( function paramSection(comment: Comment) { return ( comment.params.length > 0 && [ - u('strong', [u('text', 'Parameters')]), + u('heading', { depth: depth + 1 }, [u('text', 'Parameters')]), paramList(comment.params) ] ); @@ -122,7 +122,7 @@ function buildMarkdownAST( function propertySection(comment: Comment) { return ( comment.properties.length > 0 && [ - u('strong', [u('text', 'Properties')]), + u('heading', { depth: depth + 1 }, [u('text', 'Properties')]), propertyList(comment.properties) ] ); @@ -159,7 +159,7 @@ function buildMarkdownAST( function examplesSection(comment: Comment) { return ( comment.examples.length > 0 && - [u('strong', [u('text', 'Examples')])].concat( + [u('heading', { depth: depth + 1 }, [u('text', 'Examples')])].concat( comment.examples.reduce(function(memo, example) { const language = hljsOptions.highlightAuto ? hljs.highlightAuto(example.description).language