Skip to content

Commit 4dab786

Browse files
committed
Use explicit --access=public. Fixes #213
1 parent bb41619 commit 4dab786

File tree

7 files changed

+182
-31
lines changed

7 files changed

+182
-31
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function expandInputs(indexes, options, callback) {
5757
* Generate JavaScript documentation as a list of parsed JSDoc
5858
* comments, given a root file as a path.
5959
*
60-
* @alias documentation
6160
* @param {Array<string>|string} indexes files to process
6261
* @param {Object} options options
6362
* @param {Array<string>} options.external a string regex / glob match pattern
@@ -78,8 +77,9 @@ function expandInputs(indexes, options, callback) {
7877
* @param {Function} callback to be called when the documentation generation
7978
* is complete, with (err, result) argumentsj
8079
* @returns {undefined} calls callback
80+
* @public
8181
*/
82-
module.exports = function (indexes, options, callback) {
82+
module.exports.build = function (indexes, options, callback) {
8383
options = options || {};
8484
options.hljs = options.hljs || {};
8585

@@ -143,6 +143,7 @@ module.exports = function (indexes, options, callback) {
143143
* @param {Function} callback to be called when the documentation generation
144144
* is complete, with (err, result) argumentsj
145145
* @returns {undefined} calls callback
146+
* @public
146147
*/
147148
module.exports.lint = function lint(indexes, options, callback) {
148149
options = options || {};

lib/commands/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function build(documentation, parsedArgs, callback) {
5050
hljs: options.hljs || {}
5151
};
5252

53-
var generator = documentation.bind(null, inputs, options, onDocumented);
53+
var generator = documentation.build.bind(null, inputs, options, onDocumented);
5454

5555
function onDocumented(err, comments) {
5656
if (err) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
},
7878
"scripts": {
7979
"lint": "eslint bin lib index.js test",
80-
"doc": "documentation index.js -f md > docs/NODE_API.md",
80+
"doc": "documentation index.js -f md --access=public > docs/NODE_API.md",
8181
"test": "npm run lint && tap -t 120 --coverage test/*.js test/lib test/streams"
8282
}
8383
}

test/fixture/inline-link.input.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ function addOne(a) {
99

1010
/**
1111
* This function returns the number one. Internally, this uses
12-
* {@link addOne} to do the math.
12+
* {@link addOne} to do the math. This demonstrates
13+
* {@link https://en.wikipedia.org/wiki/Addition Addition}
14+
* and {@link https://en.wikipedia.org/wiki/Addition}
1315
* @param {number} a the input
1416
* @returns {number} numberone
1517
*/

test/fixture/inline-link.output.json

Lines changed: 91 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"column": 1
9595
}
9696
},
97-
"code": "/**\n * Adds one to a number\n * @param {number} a the input\n * @returns {number} the output\n */\nfunction addOne(a) {\n return a + 1;\n}\n\n/**\n * This function returns the number one. Internally, this uses\n * {@link addOne} to do the math.\n * @param {number} a the input\n * @returns {number} numberone\n */\nmodule.exports = function (a) {\n return addOne(a);\n};\n"
97+
"code": "/**\n * Adds one to a number\n * @param {number} a the input\n * @returns {number} the output\n */\nfunction addOne(a) {\n return a + 1;\n}\n\n/**\n * This function returns the number one. Internally, this uses\n * {@link addOne} to do the math. This demonstrates\n * {@link https://en.wikipedia.org/wiki/Addition Addition}\n * and {@link https://en.wikipedia.org/wiki/Addition}\n * @param {number} a the input\n * @returns {number} numberone\n */\nmodule.exports = function (a) {\n return addOne(a);\n};\n"
9898
},
9999
"errors": [],
100100
"params": [
@@ -286,17 +286,88 @@
286286
},
287287
{
288288
"type": "text",
289-
"value": " to do the math.",
289+
"value": " to do the math. This demonstrates\n",
290290
"position": {
291291
"start": {
292292
"line": 2,
293293
"column": 15,
294294
"offset": 74
295295
},
296296
"end": {
297-
"line": 2,
298-
"column": 31,
299-
"offset": 90
297+
"line": 3,
298+
"column": 1,
299+
"offset": 109
300+
},
301+
"indent": [
302+
1
303+
]
304+
}
305+
},
306+
{
307+
"type": "link",
308+
"url": "https://en.wikipedia.org/wiki/Addition",
309+
"title": null,
310+
"jsdoc": true,
311+
"children": [
312+
{
313+
"type": "text",
314+
"value": "Addition"
315+
}
316+
],
317+
"position": {
318+
"start": {
319+
"line": 3,
320+
"column": 1,
321+
"offset": 109
322+
},
323+
"end": {
324+
"line": 3,
325+
"column": 56,
326+
"offset": 164
327+
},
328+
"indent": []
329+
}
330+
},
331+
{
332+
"type": "text",
333+
"value": "\nand ",
334+
"position": {
335+
"start": {
336+
"line": 3,
337+
"column": 56,
338+
"offset": 164
339+
},
340+
"end": {
341+
"line": 4,
342+
"column": 5,
343+
"offset": 169
344+
},
345+
"indent": [
346+
1
347+
]
348+
}
349+
},
350+
{
351+
"type": "link",
352+
"url": "https://en.wikipedia.org/wiki/Addition",
353+
"title": null,
354+
"jsdoc": true,
355+
"children": [
356+
{
357+
"type": "text",
358+
"value": "https://en.wikipedia.org/wiki/Addition"
359+
}
360+
],
361+
"position": {
362+
"start": {
363+
"line": 4,
364+
"column": 5,
365+
"offset": 169
366+
},
367+
"end": {
368+
"line": 4,
369+
"column": 51,
370+
"offset": 215
300371
},
301372
"indent": []
302373
}
@@ -309,11 +380,13 @@
309380
"offset": 0
310381
},
311382
"end": {
312-
"line": 2,
313-
"column": 31,
314-
"offset": 90
383+
"line": 4,
384+
"column": 51,
385+
"offset": 215
315386
},
316387
"indent": [
388+
1,
389+
1,
317390
1
318391
]
319392
}
@@ -326,17 +399,17 @@
326399
"offset": 0
327400
},
328401
"end": {
329-
"line": 2,
330-
"column": 31,
331-
"offset": 90
402+
"line": 4,
403+
"column": 51,
404+
"offset": 215
332405
}
333406
}
334407
},
335408
"tags": [
336409
{
337410
"title": "param",
338411
"description": "the input",
339-
"lineNumber": 3,
412+
"lineNumber": 5,
340413
"type": {
341414
"type": "NameExpression",
342415
"name": "number"
@@ -346,7 +419,7 @@
346419
{
347420
"title": "returns",
348421
"description": "numberone",
349-
"lineNumber": 4,
422+
"lineNumber": 6,
350423
"type": {
351424
"type": "NameExpression",
352425
"name": "number"
@@ -359,28 +432,28 @@
359432
"column": 0
360433
},
361434
"end": {
362-
"line": 15,
435+
"line": 17,
363436
"column": 3
364437
}
365438
},
366439
"context": {
367440
"loc": {
368441
"start": {
369-
"line": 16,
442+
"line": 18,
370443
"column": 0
371444
},
372445
"end": {
373-
"line": 18,
446+
"line": 20,
374447
"column": 2
375448
}
376449
},
377-
"code": "/**\n * Adds one to a number\n * @param {number} a the input\n * @returns {number} the output\n */\nfunction addOne(a) {\n return a + 1;\n}\n\n/**\n * This function returns the number one. Internally, this uses\n * {@link addOne} to do the math.\n * @param {number} a the input\n * @returns {number} numberone\n */\nmodule.exports = function (a) {\n return addOne(a);\n};\n"
450+
"code": "/**\n * Adds one to a number\n * @param {number} a the input\n * @returns {number} the output\n */\nfunction addOne(a) {\n return a + 1;\n}\n\n/**\n * This function returns the number one. Internally, this uses\n * {@link addOne} to do the math. This demonstrates\n * {@link https://en.wikipedia.org/wiki/Addition Addition}\n * and {@link https://en.wikipedia.org/wiki/Addition}\n * @param {number} a the input\n * @returns {number} numberone\n */\nmodule.exports = function (a) {\n return addOne(a);\n};\n"
378451
},
379452
"errors": [],
380453
"params": [
381454
{
382455
"name": "a",
383-
"lineNumber": 3,
456+
"lineNumber": 5,
384457
"description": {
385458
"type": "root",
386459
"children": [

test/fixture/inline-link.output.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer
1111
# inline-link.input
1212

1313
This function returns the number one. Internally, this uses
14-
[addOne](addOne) to do the math.
14+
[addOne](addOne) to do the math. This demonstrates
15+
[Addition](https://en.wikipedia.org/wiki/Addition)
16+
and <https://en.wikipedia.org/wiki/Addition>
1517

1618
**Parameters**
1719

test/fixture/inline-link.output.md.json

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,88 @@
257257
},
258258
{
259259
"type": "text",
260-
"value": " to do the math.",
260+
"value": " to do the math. This demonstrates\n",
261261
"position": {
262262
"start": {
263263
"line": 2,
264264
"column": 15,
265265
"offset": 74
266266
},
267267
"end": {
268-
"line": 2,
269-
"column": 31,
270-
"offset": 90
268+
"line": 3,
269+
"column": 1,
270+
"offset": 109
271+
},
272+
"indent": [
273+
1
274+
]
275+
}
276+
},
277+
{
278+
"type": "link",
279+
"url": "https://en.wikipedia.org/wiki/Addition",
280+
"title": null,
281+
"jsdoc": true,
282+
"children": [
283+
{
284+
"type": "text",
285+
"value": "Addition"
286+
}
287+
],
288+
"position": {
289+
"start": {
290+
"line": 3,
291+
"column": 1,
292+
"offset": 109
293+
},
294+
"end": {
295+
"line": 3,
296+
"column": 56,
297+
"offset": 164
298+
},
299+
"indent": []
300+
}
301+
},
302+
{
303+
"type": "text",
304+
"value": "\nand ",
305+
"position": {
306+
"start": {
307+
"line": 3,
308+
"column": 56,
309+
"offset": 164
310+
},
311+
"end": {
312+
"line": 4,
313+
"column": 5,
314+
"offset": 169
315+
},
316+
"indent": [
317+
1
318+
]
319+
}
320+
},
321+
{
322+
"type": "link",
323+
"url": "https://en.wikipedia.org/wiki/Addition",
324+
"title": null,
325+
"jsdoc": true,
326+
"children": [
327+
{
328+
"type": "text",
329+
"value": "https://en.wikipedia.org/wiki/Addition"
330+
}
331+
],
332+
"position": {
333+
"start": {
334+
"line": 4,
335+
"column": 5,
336+
"offset": 169
337+
},
338+
"end": {
339+
"line": 4,
340+
"column": 51,
341+
"offset": 215
271342
},
272343
"indent": []
273344
}
@@ -280,11 +351,13 @@
280351
"offset": 0
281352
},
282353
"end": {
283-
"line": 2,
284-
"column": 31,
285-
"offset": 90
354+
"line": 4,
355+
"column": 51,
356+
"offset": 215
286357
},
287358
"indent": [
359+
1,
360+
1,
288361
1
289362
]
290363
}

0 commit comments

Comments
 (0)