Skip to content

Commit 1570955

Browse files
committed
Improve internal documentation
1 parent 661f5ce commit 1570955

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/documentationjs/documentation?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
66
[![David](https://david-dm.org/documentationjs/documentation.svg)](https://david-dm.org/documentationjs/documentation)
77
[![codecov.io](https://codecov.io/github/documentationjs/documentation/coverage.svg?branch=master)](https://codecov.io/github/documentationjs/documentation?branch=master)
8+
[![Inline docs](http://inch-ci.org/github/documentationjs/documentation.svg?branch=master&style=flat-square)](http://inch-ci.org/github/documentationjs/documentation)
89

910
A **documentation generation system** that's
1011
_beautiful_ by default, _flexible_ across formats and styles, and

lib/commands/readme.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ module.exports.parseArgs = function (yargs) {
3636
.example('documentation readme index.js -s "API Docs" --github');
3737
};
3838

39+
/**
40+
* Insert API documentation into a Markdown readme
41+
* @private
42+
* @param {Object} documentation the module instance
43+
* @param {Object} parsedArgs args from the CLI option parser
44+
* @return {undefined} has the side-effect of writing a file or printing to stdout
45+
*/
3946
function readme(documentation, parsedArgs) {
4047
var readmeOptions = parsedArgs.commandOptions;
4148
readmeOptions.format = 'remark';

lib/lint.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ function lintComments(comment) {
5555
return comment;
5656
}
5757

58+
/**
59+
* @private
60+
* Extract lint instructions from comments and generate user-readable output.
61+
* @param {Array<Object>} comments a list of comments
62+
* @return {string} user-readable output
63+
*/
5864
function formatLint(comments) {
5965
var vFiles = {};
6066
walk(comments, function (comment) {

lib/nest.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
'use strict';
22

3+
/**
4+
* Nest nestable tags, like param and property, into nested
5+
* arrays that are suitable for output.
6+
*
7+
* @private
8+
* @param {Object} comment a comment with tags
9+
* @param {string} tagName the tag to nest
10+
* @param {string} target the tag to nest into
11+
* @returns {Object} nested comment
12+
*/
313
function nestTag(comment, tagName, target) {
414
if (!comment[target]) {
515
return comment;

lib/parse.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,24 +256,63 @@ var flatteners = {
256256

257257
function todo() {}
258258

259+
/**
260+
* Generate a function that curries a destination key for a flattener
261+
* @private
262+
* @param {string} key the eventual destination key
263+
* @returns {Function} a flattener that remembers that key
264+
*/
259265
function synonym(key) {
260266
return function (result, tag) {
261267
return flatteners[key](result, tag, key);
262268
};
263269
}
264270

271+
/**
272+
* Treat the existence of a tag as a sign to mark `key` as true in the result
273+
* @private
274+
* @param {Object} result the documentation object
275+
* @param {Object} tag the tag object, with a name property
276+
* @param {string} key destination on the result
277+
* @returns {undefined} operates with side-effects
278+
*/
265279
function flattenBoolean(result, tag, key) {
266280
result[key] = true;
267281
}
268282

283+
/**
284+
* Flatten a usable-once name tag into a key
285+
* @private
286+
* @param {Object} result the documentation object
287+
* @param {Object} tag the tag object, with a name property
288+
* @param {string} key destination on the result
289+
* @returns {undefined} operates with side-effects
290+
*/
269291
function flattenName(result, tag, key) {
270292
result[key] = tag.name;
271293
}
272294

295+
296+
/**
297+
* Flatten a usable-once description tag into a key
298+
* @private
299+
* @param {Object} result the documentation object
300+
* @param {Object} tag the tag object, with a description property
301+
* @param {string} key destination on the result
302+
* @returns {undefined} operates with side-effects
303+
*/
273304
function flattenDescription(result, tag, key) {
274305
result[key] = tag.description;
275306
}
276307

308+
/**
309+
* Flatten a usable-once description tag into a key and parse it as Markdown
310+
* @private
311+
* @param {Object} result the documentation object
312+
* @param {Object} tag the tag object, with a description property
313+
* @param {string} key destination on the result
314+
* @returns {undefined} operates with side-effects
315+
*/
277316
function flattenMarkdownDescription(result, tag, key) {
278317
result[key] = parseMarkdown(tag.description);
279318
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy