diff --git a/index.js b/index.js index 2042c7c..1771bd0 100644 --- a/index.js +++ b/index.js @@ -118,7 +118,7 @@ module.exports = function (indexes, options, callback) { options.github && github )) .filter(Boolean) - .sort(sort.bind(undefined, options.order))))); + .sort(sort)))); } catch (e) { callback(e); } diff --git a/lib/hierarchy.js b/lib/hierarchy.js index ea5948e..3772395 100644 --- a/lib/hierarchy.js +++ b/lib/hierarchy.js @@ -2,6 +2,17 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; +function pick(n) { + var item = { + name: n.name, + kind: n.kind + }; + if (n.scope) { + item.scope = n.scope; + } + return item; +} + /** * @param {Array} comments an array of parsed comments * @returns {Array} nested comments, with only root comments @@ -101,9 +112,30 @@ module.exports = function (comments) { comment.members[scope] = node.members[scope]; } - comment.path = path.map(function (n) { - return n.name; - }).concat(comment.name); + if (comment.members.instance.length) { + comment.members.events = comment.members.instance.filter(function (member) { + return member.kind === 'event'; + }); + + comment.members.instance = comment.members.instance.filter(function (member) { + return member.kind !== 'event'; + }); + } + + + comment.path = path.map(pick).concat(pick(comment)); + + var scopeChars = { + instance: '#', + static: '.' + }; + + comment.namespace = comment.path.reduce(function (memo, part) { + if (part.kind === 'event') { + return memo + '.event:' + part.name; + } + return memo + (scopeChars[part.scope] || '') + part.name; + }, ''); if (hasUndefinedParent) { var memberOfTag = comment.tags.filter(function (tag) { @@ -121,6 +153,7 @@ module.exports = function (comments) { result.push(comment); } } + } return result; diff --git a/lib/infer/kind.js b/lib/infer/kind.js index 813625a..4f7fb6d 100644 --- a/lib/infer/kind.js +++ b/lib/infer/kind.js @@ -48,6 +48,9 @@ module.exports = function () { } else if (t.isExpressionStatement(path)) { // module.exports = function() {} findKind(path.node.expression.right); + } else if (t.isProperty(path)) { + // { foo: function() {} } + findKind(path.node.value); } } diff --git a/lib/inline_tokenizer.js b/lib/inline_tokenizer.js index b5702bc..c85ec2a 100644 --- a/lib/inline_tokenizer.js +++ b/lib/inline_tokenizer.js @@ -13,12 +13,13 @@ function makeTokenizer(type, regex) { } return eat(match[0])({ - 'type': type, - 'url': match[1], - 'title': null, - 'children': [{ - 'type': 'text', - 'value': match[2] || match[1] + type: type, + url: match[1], + title: null, + jsdoc: true, + children: [{ + type: 'text', + value: match[2] || match[1] }] }); }; diff --git a/lib/input/dependency.js b/lib/input/dependency.js index 9f38299..054e59a 100644 --- a/lib/input/dependency.js +++ b/lib/input/dependency.js @@ -1,6 +1,6 @@ 'use strict'; -var mdeps = require('module-deps'), +var mdeps = require('module-deps-sortable'), fs = require('fs'), path = require('path'), babelify = require('babelify'), diff --git a/lib/output/json.js b/lib/output/json.js index 7608930..0f6ee1a 100644 --- a/lib/output/json.js +++ b/lib/output/json.js @@ -15,6 +15,7 @@ module.exports = function (comments, opts, callback) { walk(comments, function (comment) { delete comment.errors; + delete comment.context.sortKey; }); return callback(null, JSON.stringify(comments, null, 2)); diff --git a/lib/parsers/javascript.js b/lib/parsers/javascript.js index 161212d..ba06103 100644 --- a/lib/parsers/javascript.js +++ b/lib/parsers/javascript.js @@ -6,6 +6,14 @@ var babylon = require('babylon'), isJSDocComment = require('../../lib/is_jsdoc_comment'), parse = require('../../lib/parse'); +function leftPad(str, width) { + str = str.toString(); + while (str.length < width) { + str = '0' + str; + } + return str; +} + /** * Receives a module-dep item, * reads the file, parses the JavaScript, and parses the JSDoc. @@ -50,7 +58,8 @@ function parseJavaScript(data) { function parseComment(comment) { var context = { loc: extend({}, JSON.parse(JSON.stringify(path.node.loc))), - file: data.file + file: data.file, + sortKey: data.sortKey + ' ' + leftPad(path.node.loc.start.line, 8) }; // Avoid visiting the same comment twice as a leading // and trailing node diff --git a/lib/parsers/polyglot.js b/lib/parsers/polyglot.js index 7674d57..3cfee50 100644 --- a/lib/parsers/polyglot.js +++ b/lib/parsers/polyglot.js @@ -18,7 +18,8 @@ function parsePolyglot(data) { .map(function (comment) { var context = { loc: extend({}, comment.loc), - file: data.file + file: data.file, + sortKey: data.file + ' ' + comment.loc.start.line }; return parse(comment.value, comment.loc, context); }); diff --git a/lib/sort.js b/lib/sort.js index 03b6197..607f221 100644 --- a/lib/sort.js +++ b/lib/sort.js @@ -1,49 +1,14 @@ 'use strict'; -/** - * Given a comment, get its sorting key: this is either the comment's - * name tag, or a hardcoded sorting index given by a user-provided - * `order` array. - * - * @param {Object} comment parsed documentation object - * @param {Array} [order=[]] an optional list of namepaths - * @returns {string} sortable key - * @private - */ -function getSortKey(comment, order) { - var key = comment.context.file + ':' + comment.context.loc.start.line || comment.name; - - if (order && order.indexOf(key) !== -1) { - return order.indexOf(key); - } - - return key; -} - /** * Sort two documentation objects, given an optional order object. Returns * a numeric sorting value that is compatible with stream-sort. * - * @param {Array} order an array of namepaths that will be sorted - * in the order given. * @param {Object} a documentation object * @param {Object} b documentation object * @return {number} sorting value * @private */ -module.exports = function sortDocs(order, a, b) { - a = getSortKey(a, order); - b = getSortKey(b, order); - - if (typeof a === 'number' && typeof b === 'number') { - return a - b; - } - if (typeof a === 'number') { - return -1; - } - if (typeof b === 'number') { - return 1; - } - - return a.toLowerCase().localeCompare(b.toLowerCase()); +module.exports = function sortDocs(a, b) { + return a.context.sortKey.localeCompare(b.context.sortKey); }; diff --git a/package.json b/package.json index e96105f..0686d84 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "debounce": "^1.0.0", "disparity": "^2.0.0", "doctrine": "^1.1.0", - "documentation-theme-default": "3.0.0-beta1", - "documentation-theme-utils": "^2.0.2", + "documentation-theme-default": "3.0.0", + "documentation-theme-utils": "^3.0.0", "events": "^1.1.0", "extend": "^3.0.0", "get-comments": "^1.0.1", @@ -33,7 +33,7 @@ "mdast-util-inject": "^1.1.0", "micromatch": "^2.1.6", "mime": "^1.3.4", - "module-deps": "^4.0.2", + "module-deps-sortable": "4.0.6", "parse-filepath": "^0.6.3", "remark": "^4.1.2", "remark-toc": "^3.0.0", diff --git a/test/bin-readme.js b/test/bin-readme.js index 94c33a5..d2ca6ed 100644 --- a/test/bin-readme.js +++ b/test/bin-readme.js @@ -22,6 +22,8 @@ function documentation(args, options, callback, parseJSON) { exec(args.join(' '), options, callback); } +var UPDATE = !!process.env.UPDATE; + test('readme command', function (group) { var fixtures = path.join(__dirname, 'fixture/readme'); var sourceFile = path.join(fixtures, 'index.js'); @@ -46,12 +48,19 @@ test('readme command', function (group) { }); var expectedFile = path.join(fixtures, 'README.output.md'); + var expectedPath = path.join(fixtures, 'README.output.md'); var expected = fs.readFileSync(expectedFile, 'utf-8'); group.test('updates README.md', function (t) { documentation(['readme index.js -s API'], {cwd: d}, function (err, stdout) { + var outputPath = path.join(d, 'README.md'); t.error(err); - var actual = fs.readFileSync(path.join(d, 'README.md'), 'utf-8'); + + if (UPDATE) { + fs.writeFileSync(expectedPath, fs.readFileSync(outputPath, 'utf-8')); + } + + var actual = fs.readFileSync(outputPath, 'utf-8'); t.same(actual, expected, 'generated readme output'); t.end(); }); diff --git a/test/bin.js b/test/bin.js index 5c5b96e..82bb1b3 100644 --- a/test/bin.js +++ b/test/bin.js @@ -278,6 +278,7 @@ test('write to html, highlightAuto', function (t) { documentation(['build --shallow ' + fixture + ' -c ' + config + ' -f html -o ' + dstDir], {}, function (err) { + t.ifErr(err); var result = fs.readFileSync(path.join(dstDir, 'index.html'), 'utf8'); t.ok(result.indexOf('42') > 0, 'javascript is recognized by highlightjs'); diff --git a/test/fixture/_external-deps-included.json b/test/fixture/_external-deps-included.json index 24ec0f3..a4458ae 100644 --- a/test/fixture/_external-deps-included.json +++ b/test/fixture/_external-deps-included.json @@ -118,8 +118,12 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" }, { "description": { @@ -276,8 +280,12 @@ "static": [] }, "path": [ - "main" - ] + { + "name": "main", + "kind": "function" + } + ], + "namespace": "main" }, { "description": { @@ -434,7 +442,11 @@ "static": [] }, "path": [ - "index" - ] + { + "name": "index", + "kind": "function" + } + ], + "namespace": "index" } ] \ No newline at end of file diff --git a/test/fixture/_multi-file-input.json b/test/fixture/_multi-file-input.json index 3577c01..198ebb9 100644 --- a/test/fixture/_multi-file-input.json +++ b/test/fixture/_multi-file-input.json @@ -236,8 +236,12 @@ "static": [] }, "path": [ - "returnTwo" - ] + { + "name": "returnTwo", + "kind": "function" + } + ], + "namespace": "returnTwo" }, { "description": { @@ -394,7 +398,11 @@ "static": [] }, "path": [ - "simple.input" - ] + { + "name": "simple.input", + "kind": "function" + } + ], + "namespace": "simple.input" } ] \ No newline at end of file diff --git a/test/fixture/alias.output.json b/test/fixture/alias.output.json index e1aed3b..dd67d94 100644 --- a/test/fixture/alias.output.json +++ b/test/fixture/alias.output.json @@ -115,7 +115,11 @@ "static": [] }, "path": [ - "nixon" - ] + { + "name": "nixon", + "kind": "function" + } + ], + "namespace": "nixon" } ] \ No newline at end of file diff --git a/test/fixture/class.output.json b/test/fixture/class.output.json index 7a91da6..58c88cd 100644 --- a/test/fixture/class.output.json +++ b/test/fixture/class.output.json @@ -390,9 +390,17 @@ "static": [] }, "path": [ - "MyClass", - "getFoo" - ] + { + "name": "MyClass", + "kind": "class" + }, + { + "name": "getFoo", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "MyClass#getFoo" }, { "description": { @@ -549,15 +557,28 @@ "static": [] }, "path": [ - "MyClass", - "getUndefined" - ] + { + "name": "MyClass", + "kind": "class" + }, + { + "name": "getUndefined", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "MyClass#getUndefined" } ], - "static": [] + "static": [], + "events": [] }, "path": [ - "MyClass" - ] + { + "name": "MyClass", + "kind": "class" + } + ], + "namespace": "MyClass" } ] \ No newline at end of file diff --git a/test/fixture/empty-example.output.json b/test/fixture/empty-example.output.json index 5d31198..4869756 100644 --- a/test/fixture/empty-example.output.json +++ b/test/fixture/empty-example.output.json @@ -95,7 +95,11 @@ "static": [] }, "path": [ - "returnTwo" - ] + { + "name": "returnTwo", + "kind": "function" + } + ], + "namespace": "returnTwo" } ] \ No newline at end of file diff --git a/test/fixture/es6-import.output.json b/test/fixture/es6-import.output.json index b03888e..0c92f09 100644 --- a/test/fixture/es6-import.output.json +++ b/test/fixture/es6-import.output.json @@ -161,123 +161,12 @@ "static": [] }, "path": [ - "multiplyTwice" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Similar, but with an array", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - } - } - }, - "tags": [], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, - "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" - }, - "errors": [], - "name": "destructure", - "kind": "function", - "params": [ { - "title": "param", - "name": "$0", - "type": { - "type": "NameExpression", - "name": "Array" - }, - "properties": [ - { - "title": "param", - "name": "$0.a", - "lineNumber": 10 - }, - { - "title": "param", - "name": "$0.b", - "lineNumber": 10 - }, - { - "title": "param", - "name": "$0.c", - "lineNumber": 10 - } - ] + "name": "multiplyTwice", + "kind": "function" } ], - "members": { - "instance": [], - "static": [] - }, - "path": [ - "destructure" - ] + "namespace": "multiplyTwice" }, { "description": { @@ -395,103 +284,12 @@ "static": [] }, "path": [ - "destructure" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A protected function", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - } - } - }, - "tags": [ { - "title": "protected", - "description": null, - "lineNumber": 2 + "name": "destructure", + "kind": "function" } ], - "loc": { - "start": { - "line": 103, - "column": 0 - }, - "end": { - "line": 106, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 107, - "column": 0 - }, - "end": { - "line": 107, - "column": 27 - } - }, - "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" - }, - "errors": [], - "access": "protected", - "name": "iAmProtected", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "iAmProtected" - ] + "namespace": "destructure" }, { "description": { @@ -502,7 +300,7 @@ "children": [ { "type": "text", - "value": "A public function", + "value": "Similar, but with an array", "position": { "start": { "line": 1, @@ -511,8 +309,8 @@ }, "end": { "line": 1, - "column": 18, - "offset": 17 + "column": 27, + "offset": 26 }, "indent": [] } @@ -526,8 +324,8 @@ }, "end": { "line": 1, - "column": 18, - "offset": 17 + "column": 27, + "offset": 26 }, "indent": [] } @@ -541,139 +339,76 @@ }, "end": { "line": 1, - "column": 18, - "offset": 17 - } - } - }, - "tags": [ - { - "title": "public", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 109, - "column": 0 - }, - "end": { - "line": 112, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 113, - "column": 0 - }, - "end": { - "line": 113, - "column": 24 - } - }, - "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" - }, - "errors": [], - "access": "public", - "name": "iAmPublic", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "iAmPublic" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This is re-exported", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 + "column": 27, + "offset": 26 } } }, "tags": [], "loc": { "start": { - "line": 121, + "line": 7, "column": 0 }, "end": { - "line": 123, + "line": 9, "column": 3 } }, "context": { "loc": { "start": { - "line": 124, + "line": 10, "column": 0 }, "end": { - "line": 124, - "column": 42 + "line": 11, + "column": 1 } }, "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" }, "errors": [], - "name": "execute", + "name": "destructure", + "kind": "function", + "params": [ + { + "title": "param", + "name": "$0", + "type": { + "type": "NameExpression", + "name": "Array" + }, + "properties": [ + { + "title": "param", + "name": "$0.a", + "lineNumber": 10 + }, + { + "title": "param", + "name": "$0.b", + "lineNumber": 10 + }, + { + "title": "param", + "name": "$0.c", + "lineNumber": 10 + } + ] + } + ], "members": { "instance": [], "static": [] }, "path": [ - "execute" - ] + { + "name": "destructure", + "kind": "function" + } + ], + "namespace": "destructure" }, { "description": { @@ -925,8 +660,12 @@ "static": [] }, "path": [ - "multiply" - ] + { + "name": "multiply", + "kind": "function" + } + ], + "namespace": "multiply" }, { "description": { @@ -1097,9 +836,17 @@ "static": [] }, "path": [ - "Sink", - "empty" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "empty", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "Sink#empty" }, { "description": { @@ -1192,9 +939,17 @@ "static": [] }, "path": [ - "Sink", - "aGetter" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "aGetter", + "kind": "member", + "scope": "instance" + } + ], + "namespace": "Sink#aGetter" }, { "description": "", @@ -1375,9 +1130,17 @@ "static": [] }, "path": [ - "Sink", - "constructor" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "constructor", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "Sink#constructor" } ], "static": [ @@ -1468,15 +1231,28 @@ "static": [] }, "path": [ - "Sink", - "hello" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "hello", + "kind": "function", + "scope": "static" + } + ], + "namespace": "Sink.hello" } - ] + ], + "events": [] }, "path": [ - "Sink" - ] + { + "name": "Sink", + "kind": "class" + } + ], + "namespace": "Sink" }, { "description": { @@ -1562,8 +1338,11 @@ "static": [] }, "path": [ - "staticProp" - ] + { + "name": "staticProp" + } + ], + "namespace": "staticProp" }, { "description": { @@ -1660,8 +1439,12 @@ "static": [] }, "path": [ - "functionWithRest" - ] + { + "name": "functionWithRest", + "kind": "function" + } + ], + "namespace": "functionWithRest" }, { "description": { @@ -1762,8 +1545,12 @@ "static": [] }, "path": [ - "functionWithRestAndType" - ] + { + "name": "functionWithRestAndType", + "kind": "function" + } + ], + "namespace": "functionWithRestAndType" }, { "description": { @@ -1850,8 +1637,12 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" }, { "description": { @@ -2008,8 +1799,12 @@ "static": [] }, "path": [ - "es6.input" - ] + { + "name": "es6.input", + "kind": "function" + } + ], + "namespace": "es6.input" }, { "description": { @@ -2103,7 +1898,299 @@ "static": [] }, "path": [ - "veryImportantTransform" - ] + { + "name": "veryImportantTransform", + "kind": "function" + } + ], + "namespace": "veryImportantTransform" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A protected function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + } + } + }, + "tags": [ + { + "title": "protected", + "description": null, + "lineNumber": 2 + } + ], + "loc": { + "start": { + "line": 103, + "column": 0 + }, + "end": { + "line": 106, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 107, + "column": 0 + }, + "end": { + "line": 107, + "column": 27 + } + }, + "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" + }, + "errors": [], + "access": "protected", + "name": "iAmProtected", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "iAmProtected", + "kind": "function" + } + ], + "namespace": "iAmProtected" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A public function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + } + } + }, + "tags": [ + { + "title": "public", + "description": null, + "lineNumber": 2 + } + ], + "loc": { + "start": { + "line": 109, + "column": 0 + }, + "end": { + "line": 112, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 113, + "column": 0 + }, + "end": { + "line": 113, + "column": 24 + } + }, + "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" + }, + "errors": [], + "access": "public", + "name": "iAmPublic", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "iAmPublic", + "kind": "function" + } + ], + "namespace": "iAmPublic" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This is re-exported", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + } + } + }, + "tags": [], + "loc": { + "start": { + "line": 121, + "column": 0 + }, + "end": { + "line": 123, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 124, + "column": 0 + }, + "end": { + "line": 124, + "column": 42 + } + }, + "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" + }, + "errors": [], + "name": "execute", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "execute" + } + ], + "namespace": "execute" } ] \ No newline at end of file diff --git a/test/fixture/es6-import.output.md b/test/fixture/es6-import.output.md index dea6918..37d9139 100644 --- a/test/fixture/es6-import.output.md +++ b/test/fixture/es6-import.output.md @@ -10,17 +10,6 @@ Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer # destructure -Similar, but with an array - -**Parameters** - -- `$0` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** - - `$0.a` - - `$0.b` - - `$0.c` - -# destructure - This function destructures with defaults. **Parameters** @@ -30,17 +19,16 @@ This function destructures with defaults. - `$0.emailAddresses` (optional, default `[]`) - `$0.params` **...** -# iAmProtected +# destructure -A protected function +Similar, but with an array -# iAmPublic +**Parameters** -A public function - -# execute - -This is re-exported +- `$0` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** + - `$0.a` + - `$0.b` + - `$0.c` # multiply @@ -48,7 +36,7 @@ This function returns the number one. **Parameters** -- `a` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** an array of numbers +- `a` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** an array of numbers - `b` Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone @@ -114,3 +102,15 @@ This tests our support of optional parameters in ES6 **Parameters** - `foo` (optional, default `'bar'`) + +# iAmProtected + +A protected function + +# iAmPublic + +A public function + +# execute + +This is re-exported diff --git a/test/fixture/es6-import.output.md.json b/test/fixture/es6-import.output.md.json index d228278..17b0c40 100644 --- a/test/fixture/es6-import.output.md.json +++ b/test/fixture/es6-import.output.md.json @@ -157,176 +157,6 @@ } ] }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Similar, but with an array", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Parameters" - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", - "type": "link", - "children": [ - { - "type": "text", - "value": "Array" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0.a" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0.b" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0.c" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - } - ] - } - ] - } - ] - }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "destructure" - } - ] - }, { "type": "paragraph", "children": [ @@ -553,7 +383,7 @@ "children": [ { "type": "text", - "value": "iAmProtected" + "value": "destructure" } ] }, @@ -562,7 +392,7 @@ "children": [ { "type": "text", - "value": "A protected function", + "value": "Similar, but with an array", "position": { "start": { "line": 1, @@ -571,8 +401,8 @@ }, "end": { "line": 1, - "column": 21, - "offset": 20 + "column": 27, + "offset": 26 }, "indent": [] } @@ -586,102 +416,137 @@ }, "end": { "line": 1, - "column": 21, - "offset": 20 + "column": 27, + "offset": 26 }, "indent": [] } }, { - "depth": 1, - "type": "heading", + "type": "strong", "children": [ { "type": "text", - "value": "iAmPublic" + "value": "Parameters" } ] }, { - "type": "paragraph", + "ordered": false, + "type": "list", "children": [ { - "type": "text", - "value": "A public function", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "type": "link", + "children": [ + { + "type": "text", + "value": "Array" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + } + ] }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - }, - "indent": [] - } - }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "execute" + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0.a" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0.b" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0.c" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + } + ] } ] }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This is re-exported", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - }, { "depth": 1, "type": "heading", @@ -770,7 +635,7 @@ }, { "type": "text", - "value": ".<" + "value": "<" }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", @@ -1765,6 +1630,141 @@ ] } ] + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "iAmProtected" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A protected function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "iAmPublic" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A public function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "execute" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This is re-exported", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } } ] } \ No newline at end of file diff --git a/test/fixture/es6.output.json b/test/fixture/es6.output.json index 2375c4b..2fc6ef2 100644 --- a/test/fixture/es6.output.json +++ b/test/fixture/es6.output.json @@ -1,119 +1,4 @@ [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Similar, but with an array", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - } - } - }, - "tags": [], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 11, - "column": 1 - } - }, - "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" - }, - "errors": [], - "name": "destructure", - "kind": "function", - "params": [ - { - "title": "param", - "name": "$0", - "type": { - "type": "NameExpression", - "name": "Array" - }, - "properties": [ - { - "title": "param", - "name": "$0.a", - "lineNumber": 10 - }, - { - "title": "param", - "name": "$0.b", - "lineNumber": 10 - }, - { - "title": "param", - "name": "$0.c", - "lineNumber": 10 - } - ] - } - ], - "members": { - "instance": [], - "static": [] - }, - "path": [ - "destructure" - ] - }, { "description": { "type": "root", @@ -230,103 +115,12 @@ "static": [] }, "path": [ - "destructure" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A protected function", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - } - } - }, - "tags": [ { - "title": "protected", - "description": null, - "lineNumber": 2 + "name": "destructure", + "kind": "function" } ], - "loc": { - "start": { - "line": 103, - "column": 0 - }, - "end": { - "line": 106, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 107, - "column": 0 - }, - "end": { - "line": 107, - "column": 27 - } - }, - "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" - }, - "errors": [], - "access": "protected", - "name": "iAmProtected", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "iAmProtected" - ] + "namespace": "destructure" }, { "description": { @@ -337,7 +131,7 @@ "children": [ { "type": "text", - "value": "A public function", + "value": "Similar, but with an array", "position": { "start": { "line": 1, @@ -346,8 +140,8 @@ }, "end": { "line": 1, - "column": 18, - "offset": 17 + "column": 27, + "offset": 26 }, "indent": [] } @@ -361,8 +155,8 @@ }, "end": { "line": 1, - "column": 18, - "offset": 17 + "column": 27, + "offset": 26 }, "indent": [] } @@ -376,139 +170,76 @@ }, "end": { "line": 1, - "column": 18, - "offset": 17 - } - } - }, - "tags": [ - { - "title": "public", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 109, - "column": 0 - }, - "end": { - "line": 112, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 113, - "column": 0 - }, - "end": { - "line": 113, - "column": 24 - } - }, - "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" - }, - "errors": [], - "access": "public", - "name": "iAmPublic", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "iAmPublic" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This is re-exported", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 + "column": 27, + "offset": 26 } } }, "tags": [], "loc": { "start": { - "line": 121, + "line": 7, "column": 0 }, "end": { - "line": 123, + "line": 9, "column": 3 } }, "context": { "loc": { "start": { - "line": 124, + "line": 10, "column": 0 }, "end": { - "line": 124, - "column": 42 + "line": 11, + "column": 1 } }, "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" }, "errors": [], - "name": "execute", + "name": "destructure", + "kind": "function", + "params": [ + { + "title": "param", + "name": "$0", + "type": { + "type": "NameExpression", + "name": "Array" + }, + "properties": [ + { + "title": "param", + "name": "$0.a", + "lineNumber": 10 + }, + { + "title": "param", + "name": "$0.b", + "lineNumber": 10 + }, + { + "title": "param", + "name": "$0.c", + "lineNumber": 10 + } + ] + } + ], "members": { "instance": [], "static": [] }, "path": [ - "execute" - ] + { + "name": "destructure", + "kind": "function" + } + ], + "namespace": "destructure" }, { "description": { @@ -760,8 +491,12 @@ "static": [] }, "path": [ - "multiply" - ] + { + "name": "multiply", + "kind": "function" + } + ], + "namespace": "multiply" }, { "description": { @@ -932,9 +667,17 @@ "static": [] }, "path": [ - "Sink", - "empty" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "empty", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "Sink#empty" }, { "description": { @@ -1027,9 +770,17 @@ "static": [] }, "path": [ - "Sink", - "aGetter" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "aGetter", + "kind": "member", + "scope": "instance" + } + ], + "namespace": "Sink#aGetter" }, { "description": "", @@ -1210,9 +961,17 @@ "static": [] }, "path": [ - "Sink", - "constructor" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "constructor", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "Sink#constructor" } ], "static": [ @@ -1303,15 +1062,28 @@ "static": [] }, "path": [ - "Sink", - "hello" - ] + { + "name": "Sink", + "kind": "class" + }, + { + "name": "hello", + "kind": "function", + "scope": "static" + } + ], + "namespace": "Sink.hello" } - ] + ], + "events": [] }, "path": [ - "Sink" - ] + { + "name": "Sink", + "kind": "class" + } + ], + "namespace": "Sink" }, { "description": { @@ -1397,8 +1169,11 @@ "static": [] }, "path": [ - "staticProp" - ] + { + "name": "staticProp" + } + ], + "namespace": "staticProp" }, { "description": { @@ -1495,8 +1270,12 @@ "static": [] }, "path": [ - "functionWithRest" - ] + { + "name": "functionWithRest", + "kind": "function" + } + ], + "namespace": "functionWithRest" }, { "description": { @@ -1597,8 +1376,12 @@ "static": [] }, "path": [ - "functionWithRestAndType" - ] + { + "name": "functionWithRestAndType", + "kind": "function" + } + ], + "namespace": "functionWithRestAndType" }, { "description": { @@ -1685,8 +1468,12 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" }, { "description": { @@ -1843,8 +1630,12 @@ "static": [] }, "path": [ - "es6.input" - ] + { + "name": "es6.input", + "kind": "function" + } + ], + "namespace": "es6.input" }, { "description": { @@ -1938,7 +1729,299 @@ "static": [] }, "path": [ - "veryImportantTransform" - ] + { + "name": "veryImportantTransform", + "kind": "function" + } + ], + "namespace": "veryImportantTransform" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A protected function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + } + } + }, + "tags": [ + { + "title": "protected", + "description": null, + "lineNumber": 2 + } + ], + "loc": { + "start": { + "line": 103, + "column": 0 + }, + "end": { + "line": 106, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 107, + "column": 0 + }, + "end": { + "line": 107, + "column": 27 + } + }, + "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" + }, + "errors": [], + "access": "protected", + "name": "iAmProtected", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "iAmProtected", + "kind": "function" + } + ], + "namespace": "iAmProtected" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A public function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + } + } + }, + "tags": [ + { + "title": "public", + "description": null, + "lineNumber": 2 + } + ], + "loc": { + "start": { + "line": 109, + "column": 0 + }, + "end": { + "line": 112, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 113, + "column": 0 + }, + "end": { + "line": 113, + "column": 24 + } + }, + "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" + }, + "errors": [], + "access": "public", + "name": "iAmPublic", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "iAmPublic", + "kind": "function" + } + ], + "namespace": "iAmPublic" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This is re-exported", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + } + } + }, + "tags": [], + "loc": { + "start": { + "line": 121, + "column": 0 + }, + "end": { + "line": 123, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 124, + "column": 0 + }, + "end": { + "line": 124, + "column": 42 + } + }, + "code": "/**\n * This function destructures with defaults.\n */\nfunction destructure({phoneNumbers = [], emailAddresses = [], ...params} = {}) {\n}\n\n/**\n * Similar, but with an array\n */\nfunction destructure([a, b, c]) {\n}\n\n/**\n * This function returns the number one.\n * @param {Array} a an array of numbers\n * @returns {Number} numberone\n */\nvar multiply = (a, b) => a * b;\n\n/**\n * This is a sink\n */\nclass Sink {\n /**\n * This is a property of the sink.\n */\n staticProp = 42;\n\n /**\n * Is it empty\n */\n empty() {\n return 1;\n }\n\n /**\n * This method says hello\n */\n static hello() {\n return 'hello';\n }\n\n /**\n * This is a getter method: it should be documented\n * as a property.\n */\n get aGetter() {\n return 42;\n }\n\n /**\n * @param {number} height the height of the thing\n * @param {number} width the width of the thing\n */\n constructor(height, width) {\n this.height = height;\n this.width = width;\n }\n}\n\n/**\n * This function takes rest params\n */\nfunction functionWithRest(...someParams) {\n}\n\n/**\n * So does this one, with types\n */\nfunction functionWithRestAndType(...someParams: number) {\n}\n\n// FUNCTION TYPES\n\n/**\n * This is an async method\n */\nasync function foo() { }\n\nexport default multiply;\n\n/**\n * This function returns the number one.\n * @returns {Number} numberone\n */\nmodule.exports = () => (

hello

);\n\n/**\n * This tests our support of optional parameters in ES6\n */\nfunction veryImportantTransform(foo = 'bar') {\n return \"42\";\n}\n\n// ACCESS LEVELS\n\n/**\n * A private function\n * @private\n */\nfunction iAmPrivate() { }\n\n/**\n * A protected function\n * @protected\n */\nfunction iAmProtected() { }\n\n/**\n * A public function\n * @public\n */\nfunction iAmPublic() { }\n\n/**\n * A private function using the access tag\n * @access private\n */\nfunction iAmAccessPrivate() { }\n\n/**\n * This is re-exported\n */\nexport { execute } from 'external-module';\n" + }, + "errors": [], + "name": "execute", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "execute" + } + ], + "namespace": "execute" } ] \ No newline at end of file diff --git a/test/fixture/es6.output.md b/test/fixture/es6.output.md index 53765ca..85dfb2f 100644 --- a/test/fixture/es6.output.md +++ b/test/fixture/es6.output.md @@ -1,16 +1,5 @@ # destructure -Similar, but with an array - -**Parameters** - -- `$0` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** - - `$0.a` - - `$0.b` - - `$0.c` - -# destructure - This function destructures with defaults. **Parameters** @@ -20,17 +9,16 @@ This function destructures with defaults. - `$0.emailAddresses` (optional, default `[]`) - `$0.params` **...** -# iAmProtected +# destructure -A protected function +Similar, but with an array -# iAmPublic +**Parameters** -A public function - -# execute - -This is re-exported +- `$0` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** + - `$0.a` + - `$0.b` + - `$0.c` # multiply @@ -38,7 +26,7 @@ This function returns the number one. **Parameters** -- `a` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** an array of numbers +- `a` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** an array of numbers - `b` Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone @@ -104,3 +92,15 @@ This tests our support of optional parameters in ES6 **Parameters** - `foo` (optional, default `'bar'`) + +# iAmProtected + +A protected function + +# iAmPublic + +A public function + +# execute + +This is re-exported diff --git a/test/fixture/es6.output.md.json b/test/fixture/es6.output.md.json index 1204f8d..20a913b 100644 --- a/test/fixture/es6.output.md.json +++ b/test/fixture/es6.output.md.json @@ -1,176 +1,6 @@ { "type": "root", "children": [ - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "destructure" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Similar, but with an array", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 27, - "offset": 26 - }, - "indent": [] - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Parameters" - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", - "type": "link", - "children": [ - { - "type": "text", - "value": "Array" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0.a" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0.b" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$0.c" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - } - ] - } - ] - } - ] - }, { "depth": 1, "type": "heading", @@ -407,7 +237,7 @@ "children": [ { "type": "text", - "value": "iAmProtected" + "value": "destructure" } ] }, @@ -416,7 +246,7 @@ "children": [ { "type": "text", - "value": "A protected function", + "value": "Similar, but with an array", "position": { "start": { "line": 1, @@ -425,8 +255,8 @@ }, "end": { "line": 1, - "column": 21, - "offset": 20 + "column": 27, + "offset": 26 }, "indent": [] } @@ -440,102 +270,137 @@ }, "end": { "line": 1, - "column": 21, - "offset": 20 + "column": 27, + "offset": 26 }, "indent": [] } }, { - "depth": 1, - "type": "heading", + "type": "strong", "children": [ { "type": "text", - "value": "iAmPublic" + "value": "Parameters" } ] }, { - "type": "paragraph", + "ordered": false, + "type": "list", "children": [ { - "type": "text", - "value": "A public function", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "type": "link", + "children": [ + { + "type": "text", + "value": "Array" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + } + ] }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - }, - "indent": [] - } - }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "execute" + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0.a" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0.b" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$0.c" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + } + ] } ] }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This is re-exported", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 20, - "offset": 19 - }, - "indent": [] - } - }, { "depth": 1, "type": "heading", @@ -624,7 +489,7 @@ }, { "type": "text", - "value": ".<" + "value": "<" }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", @@ -1619,6 +1484,141 @@ ] } ] + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "iAmProtected" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A protected function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "iAmPublic" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "A public function", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 18, + "offset": 17 + }, + "indent": [] + } + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "execute" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This is re-exported", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 20, + "offset": 19 + }, + "indent": [] + } } ] } \ No newline at end of file diff --git a/test/fixture/event.output.json b/test/fixture/event.output.json index 9520301..934cbf2 100644 --- a/test/fixture/event.output.json +++ b/test/fixture/event.output.json @@ -240,7 +240,11 @@ "static": [] }, "path": [ - "Map#mousemove" - ] + { + "name": "Map#mousemove", + "kind": "event" + } + ], + "namespace": ".event:Map#mousemove" } ] \ No newline at end of file diff --git a/test/fixture/example-caption.output.json b/test/fixture/example-caption.output.json index 0096e41..326ecf0 100644 --- a/test/fixture/example-caption.output.json +++ b/test/fixture/example-caption.output.json @@ -217,7 +217,11 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" } ] \ No newline at end of file diff --git a/test/fixture/external.output.json b/test/fixture/external.output.json index 6e6006e..daaf855 100644 --- a/test/fixture/external.output.json +++ b/test/fixture/external.output.json @@ -118,7 +118,11 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" } ] \ No newline at end of file diff --git a/test/fixture/factory.output.json b/test/fixture/factory.output.json index 46f2df1..ed60eb7 100644 --- a/test/fixture/factory.output.json +++ b/test/fixture/factory.output.json @@ -1,56 +1,4 @@ [ - { - "description": "", - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 1, - "type": null, - "name": "area" - } - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 9, - "column": 5 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 11, - "column": 4 - } - }, - "code": "/**\n * an area chart generator\n * @returns {area} chart\n */\nvar area = function() {\n\n /**\n * @class area\n */\n var chart = function(selection) {\n };\n\n /**\n * Sets the chart data.\n * @function\n */\n chart.data = function(_) {\n };\n\n return chart;\n};\n" - }, - "errors": [], - "kind": "class", - "name": "area", - "params": [ - { - "title": "param", - "name": "selection", - "lineNumber": 10 - } - ], - "members": { - "instance": [], - "static": [] - }, - "path": [ - "area" - ] - }, { "description": { "type": "root", @@ -206,8 +154,68 @@ "static": [] }, "path": [ - "area" - ] + { + "name": "area", + "kind": "function" + } + ], + "namespace": "area" + }, + { + "description": "", + "tags": [ + { + "title": "class", + "description": null, + "lineNumber": 1, + "type": null, + "name": "area" + } + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 9, + "column": 5 + } + }, + "context": { + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 11, + "column": 4 + } + }, + "code": "/**\n * an area chart generator\n * @returns {area} chart\n */\nvar area = function() {\n\n /**\n * @class area\n */\n var chart = function(selection) {\n };\n\n /**\n * Sets the chart data.\n * @function\n */\n chart.data = function(_) {\n };\n\n return chart;\n};\n" + }, + "errors": [], + "kind": "class", + "name": "area", + "params": [ + { + "title": "param", + "name": "selection", + "lineNumber": 10 + } + ], + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "area", + "kind": "class" + } + ], + "namespace": "area" }, { "description": { @@ -315,7 +323,12 @@ "static": [] }, "path": [ - "data" - ] + { + "name": "data", + "kind": "function", + "scope": "static" + } + ], + "namespace": ".data" } ] \ No newline at end of file diff --git a/test/fixture/factory.output.md b/test/fixture/factory.output.md index 59a4aa9..8992a84 100644 --- a/test/fixture/factory.output.md +++ b/test/fixture/factory.output.md @@ -1,15 +1,15 @@ # area -**Parameters** - -- `selection` - -# area - an area chart generator Returns **area** chart +# area + +**Parameters** + +- `selection` + # data Sets the chart data. diff --git a/test/fixture/factory.output.md.json b/test/fixture/factory.output.md.json index 8629116..bcd9b6a 100644 --- a/test/fixture/factory.output.md.json +++ b/test/fixture/factory.output.md.json @@ -1,53 +1,6 @@ { "type": "root", "children": [ - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "area" - } - ] - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Parameters" - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "selection" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - } - ] - }, { "depth": 1, "type": "heading", @@ -150,6 +103,53 @@ } ] }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "area" + } + ] + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "selection" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + }, { "depth": 1, "type": "heading", diff --git a/test/fixture/flow-types.output.json b/test/fixture/flow-types.output.json index ca2e444..540a003 100644 --- a/test/fixture/flow-types.output.json +++ b/test/fixture/flow-types.output.json @@ -1,4 +1,172 @@ [ + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function returns the number one.", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + } + } + }, + "tags": [], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "code": "/**\n * This function returns the number one.\n */\nfunction addThem(a: Point, b: string, c: ?boolean, d: Array, e: Object, f: Named): number {\n return a + b + c + d + e;\n}\n\n/**\n * A 2D point.\n *\n * @property {number} x this is a prop\n */\ntype Point = {\n x: number,\n y: number,\n rgb: {\n hex: string\n },\n props: {\n radius: {\n x: number\n }\n }\n};\n\n/**\n * A type with entirely derived properties\n */\ntype Two = {\n x: number,\n y: number\n};\n\n/**\n * Just an alias for an array of strings\n */\ntype T = Array;\n\n/**\n * Very Important Transform\n */\nfunction veryImportantTransform(\n input: Array,\n options: Object = {}\n): string {\n return \"42\";\n}\n" + }, + "errors": [], + "name": "addThem", + "kind": "function", + "params": [ + { + "title": "param", + "name": "a", + "lineNumber": 4, + "type": { + "type": "NameExpression", + "name": "Point" + } + }, + { + "title": "param", + "name": "b", + "lineNumber": 4, + "type": { + "type": "NameExpression", + "name": "string" + } + }, + { + "title": "param", + "name": "c", + "lineNumber": 4, + "type": { + "type": "OptionalType", + "expression": { + "type": "NameExpression", + "name": "boolean" + } + } + }, + { + "title": "param", + "name": "d", + "lineNumber": 4, + "type": { + "type": "TypeApplication", + "expression": { + "type": "NameExpression", + "name": "Array" + }, + "applications": [ + { + "type": "NameExpression", + "name": "number" + } + ] + } + }, + { + "title": "param", + "name": "e", + "lineNumber": 4, + "type": { + "type": "NameExpression", + "name": "Object" + } + }, + { + "title": "param", + "name": "f", + "lineNumber": 4, + "type": { + "type": "NameExpression", + "name": "Named" + } + } + ], + "returns": [ + { + "type": { + "type": "NameExpression", + "name": "number" + } + } + ], + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "addThem", + "kind": "function" + } + ], + "namespace": "addThem" + }, { "description": { "type": "root", @@ -217,8 +385,12 @@ "static": [] }, "path": [ - "Point" - ] + { + "name": "Point", + "kind": "typedef" + } + ], + "namespace": "Point" }, { "description": { @@ -325,8 +497,12 @@ "static": [] }, "path": [ - "Two" - ] + { + "name": "Two", + "kind": "typedef" + } + ], + "namespace": "Two" }, { "description": { @@ -413,172 +589,12 @@ "static": [] }, "path": [ - "T" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function returns the number one.", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - } - } - }, - "tags": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "code": "/**\n * This function returns the number one.\n */\nfunction addThem(a: Point, b: string, c: ?boolean, d: Array, e: Object, f: Named): number {\n return a + b + c + d + e;\n}\n\n/**\n * A 2D point.\n *\n * @property {number} x this is a prop\n */\ntype Point = {\n x: number,\n y: number,\n rgb: {\n hex: string\n },\n props: {\n radius: {\n x: number\n }\n }\n};\n\n/**\n * A type with entirely derived properties\n */\ntype Two = {\n x: number,\n y: number\n};\n\n/**\n * Just an alias for an array of strings\n */\ntype T = Array;\n\n/**\n * Very Important Transform\n */\nfunction veryImportantTransform(\n input: Array,\n options: Object = {}\n): string {\n return \"42\";\n}\n" - }, - "errors": [], - "name": "addThem", - "kind": "function", - "params": [ { - "title": "param", - "name": "a", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Point" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "string" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "number" - } - ] - } - }, - { - "title": "param", - "name": "e", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "param", - "name": "f", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Named" - } + "name": "T", + "kind": "typedef" } ], - "returns": [ - { - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "members": { - "instance": [], - "static": [] - }, - "path": [ - "addThem" - ] + "namespace": "T" }, { "description": { @@ -705,7 +721,11 @@ "static": [] }, "path": [ - "veryImportantTransform" - ] + { + "name": "veryImportantTransform", + "kind": "function" + } + ], + "namespace": "veryImportantTransform" } ] \ No newline at end of file diff --git a/test/fixture/flow-types.output.md b/test/fixture/flow-types.output.md index eca4a98..f98e4cc 100644 --- a/test/fixture/flow-types.output.md +++ b/test/fixture/flow-types.output.md @@ -1,3 +1,18 @@ +# addThem + +This function returns the number one. + +**Parameters** + +- `a` **Point** +- `b` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** +- `c` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** +- `d` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** +- `e` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** +- `f` **Named** + +Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** + # Point A 2D point. @@ -25,28 +40,13 @@ A type with entirely derived properties Just an alias for an array of strings -# addThem - -This function returns the number one. - -**Parameters** - -- `a` **Point** -- `b` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** -- `c` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)=** -- `d` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** -- `e` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** -- `f` **Named** - -Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** - # veryImportantTransform Very Important Transform **Parameters** -- `input` **[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)>** -- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)=** (optional, default `{}`) +- `input` **[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)>** +- `options` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** (optional, default `{}`) Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** diff --git a/test/fixture/flow-types.output.md.json b/test/fixture/flow-types.output.md.json index c02496a..033dac9 100644 --- a/test/fixture/flow-types.output.md.json +++ b/test/fixture/flow-types.output.md.json @@ -1,6 +1,336 @@ { "type": "root", "children": [ + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "addThem" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function returns the number one.", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "a" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Point" + } + ] + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "b" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", + "type": "link", + "children": [ + { + "type": "text", + "value": "string" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "c" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "[" + }, + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", + "type": "link", + "children": [ + { + "type": "text", + "value": "boolean" + } + ] + }, + { + "type": "text", + "value": "]" + } + ] + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "d" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "type": "link", + "children": [ + { + "type": "text", + "value": "Array" + } + ] + }, + { + "type": "text", + "value": "<" + }, + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "type": "link", + "children": [ + { + "type": "text", + "value": "number" + } + ] + }, + { + "type": "text", + "value": ">" + } + ] + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "e" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "type": "link", + "children": [ + { + "type": "text", + "value": "Object" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "f" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Named" + } + ] + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "type": "link", + "children": [ + { + "type": "text", + "value": "number" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + } + ] + }, { "depth": 1, "type": "heading", @@ -561,332 +891,6 @@ "indent": [] } }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "addThem" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function returns the number one.", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Parameters" - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "a" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Point" - } - ] - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "b" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", - "type": "link", - "children": [ - { - "type": "text", - "value": "string" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "c" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", - "type": "link", - "children": [ - { - "type": "text", - "value": "boolean" - } - ] - }, - { - "type": "text", - "value": "=" - } - ] - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "d" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", - "type": "link", - "children": [ - { - "type": "text", - "value": "Array" - } - ] - }, - { - "type": "text", - "value": ".<" - }, - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "type": "link", - "children": [ - { - "type": "text", - "value": "number" - } - ] - }, - { - "type": "text", - "value": ">" - } - ] - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "e" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", - "type": "link", - "children": [ - { - "type": "text", - "value": "Object" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "f" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Named" - } - ] - }, - { - "type": "text", - "value": " " - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "type": "link", - "children": [ - { - "type": "text", - "value": "number" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - } - ] - }, { "depth": 1, "type": "heading", @@ -975,7 +979,7 @@ }, { "type": "text", - "value": ".<" + "value": "<" }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", @@ -1019,6 +1023,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", @@ -1032,7 +1040,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, diff --git a/test/fixture/html/nested.output.files b/test/fixture/html/nested.output.files index bd9e67a..16bf134 100644 --- a/test/fixture/html/nested.output.files +++ b/test/fixture/html/nested.output.files @@ -1,1602 +1,3 @@ -Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. - -This Font Software is licensed under the SIL Open Font License, Version 1.1. - -This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. - - -# Source Sans Pro - -Source Sans Pro is a set of OpenType fonts that have been designed to work well -in user interface (UI) environments. In addition to a functional OpenType font, this open -source project provides all of the source files that were used to build this OpenType font -by using the AFDKO makeotf tool. - -## Font installation instructions - -* [Mac OS X](http://support.apple.com/kb/HT2509) -* [Windows](http://windows.microsoft.com/en-us/windows-vista/install-or-uninstall-fonts) -* [Linux/Unix-based systems](https://github.com/adobe-fonts/source-code-pro/issues/17#issuecomment-8967116) - -## Getting Involved - -Send suggestions for changes to the Source Sans OpenType font project maintainer, [Paul D. Hunt](mailto:opensourcefonts@adobe.com?subject=[GitHub] Source Sans Pro), for consideration. - -## Further information - -For information about the design and background of Source Sans, please refer to the [official font readme file](http://www.adobe.com/products/type/font-information/source-sans-pro-readme.html). - -/* - - Basscss v7.0.3 - Low-level CSS toolkit - http://basscss.com - - 14.88 kB - 3.38 kB Gzipped - 286 Rules - 328 Selectors - 441 Declarations - 95 Properties - -*/ - - - -body { margin: 0 } -img { max-width: 100% } -svg { max-height: 100% } - -input, -select, -textarea, -fieldset { - font-family: inherit; - font-size: 1rem; - box-sizing: border-box; - margin-top: 0; - margin-bottom: 0; -} - -label { - vertical-align: middle; -} - -input[type=text], -input[type=date], -input[type=datetime], -input[type=datetime-local], -input[type=email], -input[type=month], -input[type=number], -input[type=password], -input[type=search], -input[type=tel], -input[type=time], -input[type=url], -input[type=week] { - height: 2.25rem; - padding: .5rem .5rem; - vertical-align: middle; - -webkit-appearance: none; -} - -select { - line-height: 1.75; - padding: .5rem .5rem; -} - -select:not([multiple]) { - height: 2.25rem; - vertical-align: middle; -} - -textarea { - line-height: 1.75; - padding: .5rem .5rem; -} - -table { - border-collapse: separate; - border-spacing: 0; - max-width: 100%; - width: 100%; -} - -th { - text-align: left; - font-weight: bold; -} - -th, -td { - padding: .25rem 1rem; - line-height: inherit; -} - -th { vertical-align: bottom } -td { vertical-align: top } - -body { - font-family: 'Helvetica Neue', Helvetica, sans-serif; - line-height: 1.5; - font-size: 100%; -} - -h1, h2, h3, h4, h5, h6 { - font-family: 'Helvetica Neue', Helvetica, sans-serif; - font-weight: bold; - line-height: 1.25; - margin-top: 1em; - margin-bottom: .5em; -} - -p { - margin-top: 0; - margin-bottom: 1rem; -} - -dl, ol, ul { - margin-top: 0; - margin-bottom: 1rem; -} - -pre, code, samp { - font-family: 'Source Code Pro', Consolas, monospace; - font-size: inherit; -} - -pre { - margin-top: 0; - margin-bottom: 1rem; - overflow-x: scroll; -} - -h1 { font-size: 2rem } -h2 { font-size: 1.5rem } -h3 { font-size: 1.25rem } -h4 { font-size: 1rem } -h5 { font-size: .875rem } -h6 { font-size: .75rem } - -body { - color: #111; - background-color: #fff; -} - -a { - color: #0074d9; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -pre, code { - background-color: transparent; - border-radius: 3px; -} - -hr { - border: 0; - border-bottom-style: solid; - border-bottom-width: 1px; - border-bottom-color: rgba(0,0,0,.125); -} - -.field { - border-style: solid; - border-width: 1px; - border-color: rgba(0,0,0,.125); - border-radius: 3px; -} - -.field:focus, -.field.is-focused { - outline: none; - border-color: #0074d9; - box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.5); -} - -.field:disabled, -.field.is-disabled { - background-color: rgba(0,0,0,.125); - opacity: .5; -} - -.field:read-only:not(select), -.field.is-read-only { - background-color: rgba(0,0,0,.125); -} - - -.field.is-success { - border-color: #2ecc40; -} - -.field.is-success:focus, -.field.is-success.is-focused { - box-shadow: 0 0 0 2px rgba(46, 204, 64, 0.5); -} - -.field.is-warning { - border-color: #ffdc00; -} - -.field.is-warning:focus, -.field.is-warning.is-focused { - box-shadow: 0 0 0 2px rgba(255, 220, 0, 0.5); -} - -.field:invalid, -.field.is-error { - border-color: #ff4136; -} - -.field:invalid:focus, -.field:invalid.is-focused, -.field.is-error:focus, -.field.is-error.is-focused { - box-shadow: 0 0 0 2px rgba(255, 65, 54, 0.5); -} - -.table-light th, -.table-light td { - border-bottom-width: 1px; - border-bottom-style: solid; - border-bottom-color: rgba(0,0,0,.125); -} - -.table-light tr:last-child td { - border-bottom: 0; -} - -.btn { - font-family: inherit; - font-size: inherit; - font-weight: bold; - text-decoration: none; - cursor: pointer; - display: inline-block; - line-height: 1.125rem; - padding: .5rem 1rem; - margin: 0; - height: auto; - border: 1px solid transparent; - vertical-align: middle; - -webkit-appearance: none; - color: inherit; - background-color: transparent; -} - -.btn:hover { - text-decoration: none; -} - -.btn:focus { - outline: none; - border-color: rgba(0,0,0,.125); - box-shadow: 0 0 0 3px rgba(0,0,0,.25); -} - -::-moz-focus-inner { - border: 0; - padding: 0; -} - -.btn-primary { - color: #fff; - background-color: #0074d9; - border-radius: 3px; -} - -.btn-primary:hover { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.0625); -} - -.btn-primary:active { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.125), - inset 0 3px 4px 0 rgba(0,0,0,.25), - 0 0 1px rgba(0,0,0,.125); -} - -.btn-primary:disabled, -.btn-primary.is-disabled { - opacity: .5; -} - -.btn-outline, -.btn-outline:hover { - border-color: currentcolor; -} - -.btn-outline { - border-radius: 3px; -} - -.btn-outline:hover { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.0625); -} - -.btn-outline:active { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.125), - inset 0 3px 4px 0 rgba(0,0,0,.25), - 0 0 1px rgba(0,0,0,.125); -} - -.btn-outline:disabled, -.btn-outline.is-disabled { - opacity: .5; -} - -.h1 { font-size: 2rem } -.h2 { font-size: 1.5rem } -.h3 { font-size: 1.25rem } -.h4 { font-size: 1rem } -.h5 { font-size: .875rem } -.h6 { font-size: .75rem } - -.bold { font-weight: bold } -.regular { font-weight: normal } -.italic { font-style: italic } -.caps { text-transform: uppercase; letter-spacing: .2em; } - -.left-align { text-align: left } -.center { text-align: center } -.right-align { text-align: right } -.justify { text-align: justify } - -.nowrap { white-space: nowrap } -.break-word { word-wrap: break-word } - -.truncate { - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.list-reset { - list-style: none; - padding-left: 0; -} - -.inline { display: inline } -.block { display: block } -.inline-block { display: inline-block } -.table { display: table } -.table-cell { display: table-cell } - -.overflow-hidden { overflow: hidden } -.overflow-scroll { overflow: scroll } -.overflow-auto { overflow: auto } - -.clearfix:before, -.clearfix:after { - content: " "; - display: table -} -.clearfix:after { clear: both } - -.left { float: left } -.right { float: right } - -.fit { max-width: 100% } - -.border-box { box-sizing: border-box } - -.align-baseline { vertical-align: baseline } -.align-top { vertical-align: top } -.align-middle { vertical-align: middle } -.align-bottom { vertical-align: bottom } - -.m0 { margin: 0 } -.mt0 { margin-top: 0 } -.mr0 { margin-right: 0 } -.mb0 { margin-bottom: 0 } -.ml0 { margin-left: 0 } - -.m1 { margin: .5rem } -.mt1 { margin-top: .5rem } -.mr1 { margin-right: .5rem } -.mb1 { margin-bottom: .5rem } -.ml1 { margin-left: .5rem } - -.m2 { margin: 1rem } -.mt2 { margin-top: 1rem } -.mr2 { margin-right: 1rem } -.mb2 { margin-bottom: 1rem } -.ml2 { margin-left: 1rem } - -.m3 { margin: 2rem } -.mt3 { margin-top: 2rem } -.mr3 { margin-right: 2rem } -.mb3 { margin-bottom: 2rem } -.ml3 { margin-left: 2rem } - -.m4 { margin: 4rem } -.mt4 { margin-top: 4rem } -.mr4 { margin-right: 4rem } -.mb4 { margin-bottom: 4rem } -.ml4 { margin-left: 4rem } - -.mxn1 { margin-left: -.5rem; margin-right: -.5rem; } -.mxn2 { margin-left: -1rem; margin-right: -1rem; } -.mxn3 { margin-left: -2rem; margin-right: -2rem; } -.mxn4 { margin-left: -4rem; margin-right: -4rem; } - -.mx-auto { margin-left: auto; margin-right: auto; } -.p0 { padding: 0 } - -.p1 { padding: .5rem } -.py1 { padding-top: .5rem; padding-bottom: .5rem } -.px1 { padding-left: .5rem; padding-right: .5rem } - -.p2 { padding: 1rem } -.py2 { padding-top: 1rem; padding-bottom: 1rem } -.px2 { padding-left: 1rem; padding-right: 1rem } - -.p3 { padding: 2rem } -.py3 { padding-top: 2rem; padding-bottom: 2rem } -.px3 { padding-left: 2rem; padding-right: 2rem } - -.p4 { padding: 4rem } -.py4 { padding-top: 4rem; padding-bottom: 4rem } -.px4 { padding-left: 4rem; padding-right: 4rem } - -.relative { position: relative } -.absolute { position: absolute } -.fixed { position: fixed } - -.top-0 { top: 0 } -.right-0 { right: 0 } -.bottom-0 { bottom: 0 } -.left-0 { left: 0 } - -.z1 { z-index: 1 } -.z2 { z-index: 2 } -.z3 { z-index: 3 } -.z4 { z-index: 4 } - -.sm-show, .md-show, .lg-show { - display: none !important -} - -@media (min-width: 40em) { - .sm-show { display: block !important } -} - -@media (min-width: 52em) { - .md-show { display: block !important } -} - -@media (min-width: 64em) { - .lg-show { display: block !important } -} - - -@media (min-width: 40em) { - .sm-hide { display: none !important } -} - -@media (min-width: 52em) { - .md-hide { display: none !important } -} - -@media (min-width: 64em) { - .lg-hide { display: none !important } -} - -.display-none { display: none !important } - -.hide { - position: absolute !important; - height: 1px; - width: 1px; - overflow: hidden; - clip: rect(1px, 1px, 1px, 1px); -} - -.container { - max-width: 64em; - margin-left: auto; - margin-right: auto; -} -.col { - float: left; - box-sizing: border-box; -} - -.col-right { - float: right; - box-sizing: border-box; -} - -.col-1 { - width: 8.33333%; -} - -.col-2 { - width: 16.66667%; -} - -.col-3 { - width: 25%; -} - -.col-4 { - width: 33.33333%; -} - -.col-5 { - width: 41.66667%; -} - -.col-6 { - width: 50%; -} - -.col-7 { - width: 58.33333%; -} - -.col-8 { - width: 66.66667%; -} - -.col-9 { - width: 75%; -} - -.col-10 { - width: 83.33333%; -} - -.col-11 { - width: 91.66667%; -} - -.col-12 { - width: 100%; -} -@media (min-width: 40em) { - - .sm-col { - float: left; - box-sizing: border-box; - } - - .sm-col-right { - float: right; - box-sizing: border-box; - } - - .sm-col-1 { - width: 8.33333%; - } - - .sm-col-2 { - width: 16.66667%; - } - - .sm-col-3 { - width: 25%; - } - - .sm-col-4 { - width: 33.33333%; - } - - .sm-col-5 { - width: 41.66667%; - } - - .sm-col-6 { - width: 50%; - } - - .sm-col-7 { - width: 58.33333%; - } - - .sm-col-8 { - width: 66.66667%; - } - - .sm-col-9 { - width: 75%; - } - - .sm-col-10 { - width: 83.33333%; - } - - .sm-col-11 { - width: 91.66667%; - } - - .sm-col-12 { - width: 100%; - } - -} -@media (min-width: 52em) { - - .md-col { - float: left; - box-sizing: border-box; - } - - .md-col-right { - float: right; - box-sizing: border-box; - } - - .md-col-1 { - width: 8.33333%; - } - - .md-col-2 { - width: 16.66667%; - } - - .md-col-3 { - width: 25%; - } - - .md-col-4 { - width: 33.33333%; - } - - .md-col-5 { - width: 41.66667%; - } - - .md-col-6 { - width: 50%; - } - - .md-col-7 { - width: 58.33333%; - } - - .md-col-8 { - width: 66.66667%; - } - - .md-col-9 { - width: 75%; - } - - .md-col-10 { - width: 83.33333%; - } - - .md-col-11 { - width: 91.66667%; - } - - .md-col-12 { - width: 100%; - } - -} -@media (min-width: 64em) { - - .lg-col { - float: left; - box-sizing: border-box; - } - - .lg-col-right { - float: right; - box-sizing: border-box; - } - - .lg-col-1 { - width: 8.33333%; - } - - .lg-col-2 { - width: 16.66667%; - } - - .lg-col-3 { - width: 25%; - } - - .lg-col-4 { - width: 33.33333%; - } - - .lg-col-5 { - width: 41.66667%; - } - - .lg-col-6 { - width: 50%; - } - - .lg-col-7 { - width: 58.33333%; - } - - .lg-col-8 { - width: 66.66667%; - } - - .lg-col-9 { - width: 75%; - } - - .lg-col-10 { - width: 83.33333%; - } - - .lg-col-11 { - width: 91.66667%; - } - - .lg-col-12 { - width: 100%; - } - -} - -.flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } - -.flex-column { -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column } -.flex-wrap { -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap } - -.flex-center { -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center } -.flex-baseline { -webkit-box-align: baseline; -webkit-align-items: baseline; -ms-flex-align: baseline; align-items: baseline } -.flex-stretch { -webkit-box-align: stretch; -webkit-align-items: stretch; -ms-flex-align: stretch; align-items: stretch } -.flex-start { -webkit-box-align: start; -webkit-align-items: flex-start; -ms-flex-align: start; align-items: flex-start } -.flex-end { -webkit-box-align: end; -webkit-align-items: flex-end; -ms-flex-align: end; align-items: flex-end } - -.flex-justify { -webkit-box-pack: justify; -webkit-justify-content: space-between; -ms-flex-pack: justify; justify-content: space-between } - -.flex-auto { - -webkit-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - min-width: 0; - min-height: 0; -} -.flex-grow { -webkit-box-flex: 1; -webkit-flex: 1 0 auto; -ms-flex: 1 0 auto; flex: 1 0 auto } -.flex-none { -webkit-box-flex: 0; -webkit-flex: none; -ms-flex: none; flex: none } - -.flex-first { -webkit-box-ordinal-group: 0; -webkit-order: -1; -ms-flex-order: -1; order: -1 } -.flex-last { -webkit-box-ordinal-group: 100000; -webkit-order: 99999; -ms-flex-order: 99999; order: 99999 } -@media (min-width: 40em) { - .sm-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } -} -@media (min-width: 52em) { - .md-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } -} -@media (min-width: 64em) { - .lg-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } -} - -.border { - border-style: solid; - border-width: 1px; - border-color: rgba(0,0,0,.125); -} - -.border-top { - border-top-style: solid; - border-top-width: 1px; - border-top-color: rgba(0,0,0,.125); -} - -.border-right { - border-right-style: solid; - border-right-width: 1px; - border-right-color: rgba(0,0,0,.125); -} - -.border-bottom { - border-bottom-style: solid; - border-bottom-width: 1px; - border-bottom-color: rgba(0,0,0,.125); -} - -.border-left { - border-left-style: solid; - border-left-width: 1px; - border-left-color: rgba(0,0,0,.125); -} - -.border-none { border: 0 } - -.rounded { border-radius: 3px } -.circle { border-radius: 50% } - -.rounded-top { border-radius: 3px 3px 0 0 } -.rounded-right { border-radius: 0 3px 3px 0 } -.rounded-bottom { border-radius: 0 0 3px 3px } -.rounded-left { border-radius: 3px 0 0 3px } - -.not-rounded { border-radius: 0 } - -.black { color: #111 } -.gray { color: #aaa } -.silver { color: #ddd } -.white { color: #fff } - -.aqua { color: #7fdbff } -.blue { color: #0074d9 } -.navy { color: #001f3f } -.teal { color: #39cccc } -.green { color: #2ecc40 } -.olive { color: #3d9970 } -.lime { color: #01ff70 } - -.yellow { color: #ffdc00 } -.orange { color: #ff851b } -.red { color: #ff4136 } -.fuchsia { color: #f012be } -.purple { color: #b10dc9 } -.maroon { color: #85144b } - -.color-inherit { color: inherit } -.muted { opacity: .5 } - -.bg-black { background-color: #111 } -.bg-gray { background-color: #aaa } -.bg-silver { background-color: #ddd } -.bg-white { background-color: #fff } - -.bg-aqua { background-color: #7fdbff } -.bg-blue { background-color: #0074d9 } -.bg-navy { background-color: #001f3f } -.bg-teal { background-color: #39cccc } -.bg-green { background-color: #2ecc40 } -.bg-olive { background-color: #3d9970 } -.bg-lime { background-color: #01ff70 } - -.bg-yellow { background-color: #ffdc00 } -.bg-orange { background-color: #ff851b } -.bg-red { background-color: #ff4136 } -.bg-fuchsia { background-color: #f012be } -.bg-purple { background-color: #b10dc9 } -.bg-maroon { background-color: #85144b } - -.bg-darken-1 { background-color: rgba(0,0,0,.0625) } -.bg-darken-2 { background-color: rgba(0,0,0,.125) } -.bg-darken-3 { background-color: rgba(0,0,0,.25) } -.bg-darken-4 { background-color: rgba(0,0,0,.5) } - -.bg-lighten-1 { background-color: rgba(255,255,255,.0625) } -.bg-lighten-2 { background-color: rgba(255,255,255,.125) } -.bg-lighten-3 { background-color: rgba(255,255,255,.25) } -.bg-lighten-4 { background-color: rgba(255,255,255,.5) } - - - -/*! - * AnchorJS - v1.2.1 - 2015-07-02 - * https://github.com/bryanbraun/anchorjs - * Copyright (c) 2015 Bryan Braun; Licensed MIT - */ - -function AnchorJS(options) { - 'use strict'; - - this.options = options || {}; - - this._applyRemainingDefaultOptions = function(opts) { - this.options.icon = this.options.hasOwnProperty('icon') ? opts.icon : '\ue9cb'; // Accepts characters (and also URLs?), like '#', '¶', '❡', or '§'. - this.options.visible = this.options.hasOwnProperty('visible') ? opts.visible : 'hover'; // Also accepts 'always' - this.options.placement = this.options.hasOwnProperty('placement') ? opts.placement : 'right'; // Also accepts 'left' - this.options.class = this.options.hasOwnProperty('class') ? opts.class : ''; // Accepts any class name. - }; - - this._applyRemainingDefaultOptions(options); - - this.add = function(selector) { - var elements, - elsWithIds, - idList, - elementID, - i, - roughText, - tidyText, - index, - count, - newTidyText, - readableID, - anchor; - - this._applyRemainingDefaultOptions(this.options); - - // Provide a sensible default selector, if none is given. - if (!selector) { - selector = 'h1, h2, h3, h4, h5, h6'; - } else if (typeof selector !== 'string') { - throw new Error('The selector provided to AnchorJS was invalid.'); - } - - elements = document.querySelectorAll(selector); - if (elements.length === 0) { - return false; - } - - this._addBaselineStyles(); - - // We produce a list of existing IDs so we don't generate a duplicate. - elsWithIds = document.querySelectorAll('[id]'); - idList = [].map.call(elsWithIds, function assign(el) { - return el.id; - }); - - for (i = 0; i < elements.length; i++) { - - if (elements[i].hasAttribute('id')) { - elementID = elements[i].getAttribute('id'); - } else { - roughText = elements[i].textContent; - - // Refine it so it makes a good ID. Strip out non-safe characters, replace - // spaces with hyphens, truncate to 32 characters, and make toLowerCase. - // - // Example string: // '⚡⚡⚡ Unicode icons are cool--but they definitely don't belong in a URL fragment.' - tidyText = roughText.replace(/[^\w\s-]/gi, '') // ' Unicode icons are cool--but they definitely dont belong in a URL fragment' - .replace(/\s+/g, '-') // '-Unicode-icons-are-cool--but-they-definitely-dont-belong-in-a-URL-fragment' - .replace(/-{2,}/g, '-') // '-Unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-URL-fragment' - .substring(0, 64) // '-Unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-URL' - .replace(/^-+|-+$/gm, '') // 'Unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-URL' - .toLowerCase(); // 'unicode-icons-are-cool-but-they-definitely-dont-belong-in-a-url' - - // Compare our generated ID to existing IDs (and increment it if needed) - // before we add it to the page. - newTidyText = tidyText; - count = 0; - do { - if (index !== undefined) { - newTidyText = tidyText + '-' + count; - } - // .indexOf is supported in IE9+. - index = idList.indexOf(newTidyText); - count += 1; - } while (index !== -1); - index = undefined; - idList.push(newTidyText); - - // Assign it to our element. - // Currently the setAttribute element is only supported in IE9 and above. - elements[i].setAttribute('id', newTidyText); - - elementID = newTidyText; - } - - readableID = elementID.replace(/-/g, ' '); - - // The following code builds the following DOM structure in a more effiecient (albeit opaque) way. - // ''; - anchor = document.createElement('a'); - anchor.className = 'anchorjs-link ' + this.options.class; - anchor.href = '#' + elementID; - anchor.setAttribute('aria-label', 'Anchor link for: ' + readableID); - anchor.setAttribute('data-anchorjs-icon', this.options.icon); - - if (this.options.visible === 'always') { - anchor.style.opacity = '1'; - } - - if (this.options.icon === '\ue9cb') { - anchor.style.fontFamily = 'anchorjs-icons'; - anchor.style.fontStyle = 'normal'; - anchor.style.fontVariant = 'normal'; - anchor.style.fontWeight = 'normal'; - anchor.style.lineHeight = 1; - } - - if (this.options.placement === 'left') { - anchor.style.position = 'absolute'; - anchor.style.marginLeft = '-1em'; - anchor.style.paddingRight = '0.5em'; - elements[i].insertBefore(anchor, elements[i].firstChild); - } else { // if the option provided is `right` (or anything else). - anchor.style.paddingLeft = '0.375em'; - elements[i].appendChild(anchor); - } - } - - return this; - }; - - this.remove = function(selector) { - var domAnchor, - elements = document.querySelectorAll(selector); - for (var i = 0; i < elements.length; i++) { - domAnchor = elements[i].querySelector('.anchorjs-link'); - if (domAnchor) { - elements[i].removeChild(domAnchor); - } - } - return this; - }; - - this._addBaselineStyles = function() { - // We don't want to add global baseline styles if they've been added before. - if (document.head.querySelector('style.anchorjs') !== null) { - return; - } - - var style = document.createElement('style'), - linkRule = - ' .anchorjs-link {' + - ' opacity: 0;' + - ' text-decoration: none;' + - ' -webkit-font-smoothing: antialiased;' + - ' -moz-osx-font-smoothing: grayscale;' + - ' }', - hoverRule = - ' *:hover > .anchorjs-link,' + - ' .anchorjs-link:focus {' + - ' opacity: 1;' + - ' }', - anchorjsLinkFontFace = - ' @font-face {' + - ' font-family: "anchorjs-icons";' + - ' font-style: normal;' + - ' font-weight: normal;' + // Icon from icomoon; 10px wide & 10px tall; 2 empty below & 4 above - ' src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype");' + - ' }', - pseudoElContent = - ' [data-anchorjs-icon]::after {' + - ' content: attr(data-anchorjs-icon);' + - ' }', - firstStyleEl; - - style.className = 'anchorjs'; - style.appendChild(document.createTextNode('')); // Necessary for Webkit. - - // We place it in the head with the other style tags, if possible, so as to - // not look out of place. We insert before the others so these styles can be - // overridden if necessary. - firstStyleEl = document.head.querySelector('[rel="stylesheet"], style'); - if (firstStyleEl === undefined) { - document.head.appendChild(style); - } else { - document.head.insertBefore(style, firstStyleEl); - } - - style.sheet.insertRule(linkRule, style.sheet.cssRules.length); - style.sheet.insertRule(hoverRule, style.sheet.cssRules.length); - style.sheet.insertRule(pseudoElContent, style.sheet.cssRules.length); - style.sheet.insertRule(anchorjsLinkFontFace, style.sheet.cssRules.length); - }; -} - -var anchors = new AnchorJS(); - - -/* global anchors */ - -// add anchor links to headers -anchors.options.placement = 'left'; -anchors.add().remove('.no-anchor'); - -// Filter UI -var tocElements = document.getElementById('toc').getElementsByTagName('a'); -document.getElementById('filter-input').addEventListener('keyup', function(e) { - - var i, element; - - // enter key - if (e.keyCode === 13) { - // go to the first displayed item in the toc - for (i = 0; i < tocElements.length; i++) { - element = tocElements[i]; - if (!element.classList.contains('hide')) { - location.replace(element.href); - return e.preventDefault(); - } - } - } - - var match = function() { return true; }, - value = this.value.toLowerCase(); - - if (!value.match(/^\s*$/)) { - match = function(text) { return text.toLowerCase().indexOf(value) !== -1; }; - } - - for (i = 0; i < tocElements.length; i++) { - element = tocElements[i]; - if (match(element.innerHTML)) { - element.classList.remove('hide'); - } else { - element.classList.add('hide'); - } - } -}); - - - -Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. - -This Font Software is licensed under the SIL Open Font License, Version 1.1. - -This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. - -# Source Code Pro - -Source Code Pro is a set of OpenType fonts that have been designed to work well -in user interface (UI) environments. In addition to a functional OpenType font, this open -source project provides all of the source files that were used to build this OpenType font -by using the AFDKO makeotf tool. - -## Font installation instructions - -* [Mac OS X](http://support.apple.com/kb/HT2509) -* [Windows](http://windows.microsoft.com/en-us/windows-vista/install-or-uninstall-fonts) -* [Linux/Unix-based systems](https://github.com/adobe-fonts/source-code-pro/issues/17#issuecomment-8967116) - -## Getting Involved - -Send suggestions for changes to the Source Code OpenType font project maintainer, [Paul D. Hunt](mailto:opensourcefonts@adobe.com?subject=[GitHub] Source Code Pro), for consideration. - -## Further information - -For information about the design and background of Source Code, please refer to the [official font readme file](http://www.adobe.com/products/type/font-information/source-code-pro-readme.html). - - -@font-face{ - font-family: 'Source Code Pro'; - font-weight: 400; - font-style: normal; - font-stretch: normal; - src: url('WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'); -} - -@font-face{ - font-family: 'Source Code Pro'; - font-weight: 500; - font-style: normal; - font-stretch: normal; - src: url('WOFF/OTF/SourceCodePro-Medium.otf.woff') format('woff'); -} - -/* - -github.com style (c) Vasily Polovnyov - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0.5em; - color: #333; - background: #f8f8f8; - -webkit-text-size-adjust: none; -} - -.hljs-comment, -.diff .hljs-header, -.hljs-javadoc { - color: #998; - font-style: italic; -} - -.hljs-keyword, -.css .rule .hljs-keyword, -.hljs-winutils, -.nginx .hljs-title, -.hljs-subst, -.hljs-request, -.hljs-status { - color: #1184CE; -} - -.hljs-number, -.hljs-hexcolor, -.ruby .hljs-constant { - color: #ed225d; -} - -.hljs-string, -.hljs-tag .hljs-value, -.hljs-phpdoc, -.hljs-dartdoc, -.tex .hljs-formula { - color: #ed225d; -} - -.hljs-title, -.hljs-id, -.scss .hljs-preprocessor { - color: #900; - font-weight: bold; -} - -.hljs-list .hljs-keyword, -.hljs-subst { - font-weight: normal; -} - -.hljs-class .hljs-title, -.hljs-type, -.vhdl .hljs-literal, -.tex .hljs-command { - color: #458; - font-weight: bold; -} - -.hljs-tag, -.hljs-tag .hljs-title, -.hljs-rules .hljs-property, -.django .hljs-tag .hljs-keyword { - color: #000080; - font-weight: normal; -} - -.hljs-attribute, -.hljs-variable, -.lisp .hljs-body { - color: #008080; -} - -.hljs-regexp { - color: #009926; -} - -.hljs-symbol, -.ruby .hljs-symbol .hljs-string, -.lisp .hljs-keyword, -.clojure .hljs-keyword, -.scheme .hljs-keyword, -.tex .hljs-special, -.hljs-prompt { - color: #990073; -} - -.hljs-built_in { - color: #0086b3; -} - -.hljs-preprocessor, -.hljs-pragma, -.hljs-pi, -.hljs-doctype, -.hljs-shebang, -.hljs-cdata { - color: #999; - font-weight: bold; -} - -.hljs-deletion { - background: #fdd; -} - -.hljs-addition { - background: #dfd; -} - -.diff .hljs-change { - background: #0086b3; -} - -.hljs-chunk { - color: #aaa; -} - - -@font-face{ - font-family: 'Source Sans Pro'; - font-weight: 300; - font-style: normal; - font-stretch: normal; - src: url('WOFF/OTF/SourceSansPro-Light.otf.woff') format('woff'); -} - -@font-face{ - font-family: 'Source Sans Pro'; - font-weight: 400; - font-style: normal; - font-stretch: normal; - src: url('WOFF/OTF/SourceSansPro-Regular.otf.woff') format('woff'); -} - -@font-face{ - font-family: 'Source Sans Pro'; - font-weight: 600; - font-style: normal; - font-stretch: normal; - src: url('WOFF/OTF/SourceSansPro-Semibold.otf.woff') format('woff'); -} - -@font-face{ - font-family: 'Source Sans Pro'; - font-weight: 700; - font-style: normal; - font-stretch: normal; - src: url('WOFF/OTF/SourceSansPro-Bold.otf.woff') format('woff'); -} - - - -@import url(fonts/source-sans-pro/source-sans-pro.css); -@import url(fonts/source-code-pro/source-code-pro.css); - -.documentation a { - color: #1184CE; -} - -.documentation .suppress-p-margin p { - margin:0; -} - -.force-inline, .force-inline p { - display: inline; - color: #222; -} - -.container-small { - max-width: 58rem; - margin-left: auto; - margin-right: auto; -} - -.max-height-100 { - max-height: 100%; -} - -.fade { - opacity:0.50; -} - -.button-indent { - padding: .25rem 1.5rem; - font-size: 90%; -} - -.section-indent { - border-left: 2px solid #eee; -} - -.bg-cloudy { - background: #fafafa; -} - -.force-inline * { - display:inline; -} - -section:target h3 { - font-weight:700; -} - -.documentation, -.documentation h1, -.documentation h2, -.documentation h3, -.documentation h4, -.documentation h5, -.documentation h6 { - font-family: 'Source Sans Pro', Helvetica, sans-serif; -} - -.documentation pre, -.documentation code, -.documentation samp { - font-family: 'Source Code Pro', monospace; - font-size: 90%; -} - -.documentation td, -.documentation th { - padding: .25rem .25rem; -} - -h1:hover .anchorjs-link, -h2:hover .anchorjs-link, -h3:hover .anchorjs-link, -h4:hover .anchorjs-link { - opacity: 1; -} - -.collapsible .collapser { - display:none; -} - -.collapsible:target .collapser { - display: block; -} - -.fix-3 { - width: 25%; - max-width: 244px; -} - -@media (min-width: 52em) { - .fix-margin-3 { - margin-left: 25%; - } -} - @@ -1608,574 +9,1001 @@ h4:hover .anchorjs-link { -
+
-
+
-
-

- bar -

- - - - - -

Get an instance of Klass. Will make -a klass instance multiword, -like a klass. This needs a number input.

+ +
-

Returns

- undefined - - : -
-

nothing

+

+ Klass +

-
-
-
-

- bar -

- - - - - -

Get an instance of Klass. Will make -a klass instance multiword, -like a klass

- -

Returns

- Klass - - : -
-

that class

- -
-
-
-

- bar(toys) -

- - - - - -

Rest property function

- -

Parameters

-
    -
  • ... -Number - toys - : -
    - undefined -
    -
  • -
-

Returns

- undefined - - : -
-

nothing

- -
-
-
-

- Klass(foo) -

- - - - -

Creates a new Klass

+ +
new Klass(foo: )
+ + + + + + + + + + + +

Parameters

-
    -
  • foo - : -
    - undefined -
    +
      + +
    1. foo (): +
    2. -
-

Static members

-
- - - .event - -
-

Klass event

+ + + -
-
-
-
-

- event -

- - - - -

Klass event

-
-
-
-
- - - .isClass(other, also) - -
-

Decide whether an object is a Klass instance -This is a [klasssic]Klass -This is a [link to something that does not exist]DoesNot

+ -
- -
-
-

- isClass(other, also) -

- - + + +

Static members

+
+
Method
+
Description
+ +
+
+
+ isClass(other: Object, also: Any): boolean +
+
Decide whether an object is a Klass instance +This is a +[klasssic] +Klass + +This is a +[link to something that does not exist] +DoesNot +
+
+ -
- + +
+
+
+ isWeird(other: Weird): boolean +
+
A function that triggers the case where the autolinker doesn't find +the referenced class type +
+
+ -
- + +
+
+
+ isBuffer(buf: (Buffer | string), size: [number]): boolean +
+
This method takes a Buffer object that will be linked to nodejs.org +
+
+ + - + + + + + + + +

Returns

- boolean - - : -
-

whether the other thing is a Klass

+ boolean: + whether the other thing is a Klass -
-
-
-
- + +
+
+
+ isArrayOfBuffers(buffers: Array<Buffer>): number +
+
This method takes an array of buffers and counts them +
+
+ -
- + +
+
+
+ MAGIC_NUMBER +
+
A magic number that identifies this Klass. +
+
+ -
-

Instance members

-
- - - #getFoo - -
-

Get this Klass's foo

-
-
-
-
-

- getFoo -

+
MAGIC_NUMBER
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ event +
+
Klass event +
+
+ +
+ +
+ + + +

Instance members

+
+
Method
+
Description
+ +
+
+
+ getFoo: Number +
+
Get this Klass's foo +
+
+ -
- + +
+
+
+ withOptions(options: Object, otherOptions: ?number) +
+
A function with an options parameter +
+
+ -
-
-
-

- Foo -

+ + + + + + + + + + + + + + + + + + +
+
+ +
+ + + +
+ +
+ +

+ bar +

+ +

Get an instance of Klass. Will make +a klass instance multiword, +like a klass

+ + +
bar: Klass
+ + + + + + + + + + + + +

Returns

+ Klass: + that class + + + + + + + + + + + + + + +
+ +
+ +

+ bar +

+ +

Rest property function

+ + +
bar(toys: ...Number): undefined
+ + + + + + + + + + + + +

Parameters

+
    + +
  1. toys (...Number): + +
  2. + +
+ + + + + + +

Returns

+ undefined: + nothing + + + + + + + + + + + + + + +
+ +
+ +

+ bar +

+ +

Get an instance of Klass. Will make +a klass instance multiword, +like a klass. This needs a number input.

+ + + + + + + + + + + + + + + + + + + + +

Returns

+ undefined: + nothing + + + + + + + + + + + + + + +
+ +
+ +

+ Foo +

+

This is Foo

-

Instance members

-
- - - #bar - -
-

This is bar

-
-
-
-
-

- bar -

+
new Foo
+ + + + + + + + + + + + + + + + + + + +

Instance members

+
+
Method
+
Description
+ +
+
+
+ bar +
+
This is bar +
+
+ -
-
+ +
bar
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + +
+
diff --git a/test/fixture/inheritance.output.json b/test/fixture/inheritance.output.json index c74a58c..9eff593 100644 --- a/test/fixture/inheritance.output.json +++ b/test/fixture/inheritance.output.json @@ -1,62 +1,4 @@ [ - { - "description": "", - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 0, - "type": null, - "name": "Foo" - } - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 17 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 43 - } - }, - "code": "/**\n * With ES6, built-in types are extensible!\n */\nclass SpecialArray extends Array {\n additionalMethod() {\n }\n}\n\n/** @class Foo */\nmodule.exports = class Foo extends Bar { };\n" - }, - "errors": [ - { - "message": "@memberof reference to module not found", - "commentLineNumber": 0 - } - ], - "kind": "class", - "name": "Foo", - "augments": [ - { - "title": "augments", - "name": "Bar" - } - ], - "memberof": "module", - "scope": "static", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "Foo" - ] - }, { "description": { "type": "root", @@ -148,7 +90,74 @@ "static": [] }, "path": [ - "SpecialArray" - ] + { + "name": "SpecialArray", + "kind": "class" + } + ], + "namespace": "SpecialArray" + }, + { + "description": "", + "tags": [ + { + "title": "class", + "description": null, + "lineNumber": 0, + "type": null, + "name": "Foo" + } + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 17 + } + }, + "context": { + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 43 + } + }, + "code": "/**\n * With ES6, built-in types are extensible!\n */\nclass SpecialArray extends Array {\n additionalMethod() {\n }\n}\n\n/** @class Foo */\nmodule.exports = class Foo extends Bar { };\n" + }, + "errors": [ + { + "message": "@memberof reference to module not found", + "commentLineNumber": 0 + } + ], + "kind": "class", + "name": "Foo", + "augments": [ + { + "title": "augments", + "name": "Bar" + } + ], + "memberof": "module", + "scope": "static", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Foo", + "kind": "class", + "scope": "static" + } + ], + "namespace": ".Foo" } ] \ No newline at end of file diff --git a/test/fixture/inheritance.output.md b/test/fixture/inheritance.output.md index 0602d6a..2a3d689 100644 --- a/test/fixture/inheritance.output.md +++ b/test/fixture/inheritance.output.md @@ -1,9 +1,9 @@ -# Foo - -**Extends Bar** - # SpecialArray **Extends Array** With ES6, built-in types are extensible! + +# Foo + +**Extends Bar** diff --git a/test/fixture/inheritance.output.md.json b/test/fixture/inheritance.output.md.json index 6b3b0be..9e350c5 100644 --- a/test/fixture/inheritance.output.md.json +++ b/test/fixture/inheritance.output.md.json @@ -1,34 +1,6 @@ { "type": "root", "children": [ - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "Foo" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Extends " - }, - { - "type": "text", - "value": "Bar" - } - ] - } - ] - }, { "depth": 1, "type": "heading", @@ -91,6 +63,34 @@ }, "indent": [] } + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "Foo" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Extends " + }, + { + "type": "text", + "value": "Bar" + } + ] + } + ] } ] } \ No newline at end of file diff --git a/test/fixture/inline-link.output.json b/test/fixture/inline-link.output.json index ca0c02c..75049cd 100644 --- a/test/fixture/inline-link.output.json +++ b/test/fixture/inline-link.output.json @@ -1,4 +1,238 @@ [ + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Adds one to a number", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + } + } + }, + "tags": [ + { + "title": "param", + "description": "the input", + "lineNumber": 2, + "type": { + "type": "NameExpression", + "name": "number" + }, + "name": "a" + }, + { + "title": "returns", + "description": "the output", + "lineNumber": 3, + "type": { + "type": "NameExpression", + "name": "number" + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + }, + "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" + }, + "errors": [], + "params": [ + { + "name": "a", + "lineNumber": 2, + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "the input", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + } + } + }, + "type": { + "type": "NameExpression", + "name": "number" + } + } + ], + "returns": [ + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "the output", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 11, + "offset": 10 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 11, + "offset": 10 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 11, + "offset": 10 + } + } + }, + "type": { + "type": "NameExpression", + "name": "number" + } + } + ], + "name": "addOne", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "addOne", + "kind": "function" + } + ], + "namespace": "addOne" + }, { "description": { "type": "root", @@ -29,6 +263,7 @@ "type": "link", "url": "addOne", "title": null, + "jsdoc": true, "children": [ { "type": "text", @@ -271,237 +506,11 @@ "static": [] }, "path": [ - "inline-link.input" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds one to a number", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - } - } - }, - "tags": [ { - "title": "param", - "description": "the input", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "a" - }, - { - "title": "returns", - "description": "the output", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "number" - } + "name": "inline-link.input", + "kind": "function" } ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 8, - "column": 1 - } - }, - "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" - }, - "errors": [], - "params": [ - { - "name": "a", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the input", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - } - } - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the output", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 11, - "offset": 10 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 11, - "offset": 10 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 11, - "offset": 10 - } - } - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "name": "addOne", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "addOne" - ] + "namespace": "inline-link.input" } ] \ No newline at end of file diff --git a/test/fixture/inline-link.output.md b/test/fixture/inline-link.output.md index ecb66c0..d051d29 100644 --- a/test/fixture/inline-link.output.md +++ b/test/fixture/inline-link.output.md @@ -1,3 +1,13 @@ +# addOne + +Adds one to a number + +**Parameters** + +- `a` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the input + +Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the output + # inline-link.input This function returns the number one. Internally, this uses @@ -8,13 +18,3 @@ This function returns the number one. Internally, this uses - `a` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the input Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone - -# addOne - -Adds one to a number - -**Parameters** - -- `a` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the input - -Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the output diff --git a/test/fixture/inline-link.output.md.json b/test/fixture/inline-link.output.md.json index 7a0a636..35cd2e9 100644 --- a/test/fixture/inline-link.output.md.json +++ b/test/fixture/inline-link.output.md.json @@ -1,6 +1,203 @@ { "type": "root", "children": [ + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "addOne" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Adds one to a number", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 21, + "offset": 20 + }, + "indent": [] + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "a" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "type": "link", + "children": [ + { + "type": "text", + "value": "number" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "the input", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ] + } + ] + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "type": "link", + "children": [ + { + "type": "text", + "value": "number" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "the output", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 11, + "offset": 10 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 11, + "offset": 10 + }, + "indent": [] + } + } + ] + }, { "depth": 1, "type": "heading", @@ -37,6 +234,7 @@ "type": "link", "url": "addOne", "title": null, + "jsdoc": true, "children": [ { "type": "text", @@ -242,203 +440,6 @@ } } ] - }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "addOne" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds one to a number", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - }, - "indent": [] - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Parameters" - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "a" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "type": "link", - "children": [ - { - "type": "text", - "value": "number" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the input", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "type": "link", - "children": [ - { - "type": "text", - "value": "number" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the output", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 11, - "offset": 10 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 11, - "offset": 10 - }, - "indent": [] - } - } - ] } ] } \ No newline at end of file diff --git a/test/fixture/internal.output.json b/test/fixture/internal.output.json index 6e6006e..daaf855 100644 --- a/test/fixture/internal.output.json +++ b/test/fixture/internal.output.json @@ -118,7 +118,11 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" } ] \ No newline at end of file diff --git a/test/fixture/memberedclass.output.json b/test/fixture/memberedclass.output.json index baee631..722e79d 100644 --- a/test/fixture/memberedclass.output.json +++ b/test/fixture/memberedclass.output.json @@ -329,9 +329,17 @@ "static": [] }, "path": [ - "MyClass", - "getFoo" - ] + { + "name": "MyClass", + "kind": "class" + }, + { + "name": "getFoo", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "MyClass#getFoo" } ], "static": [ @@ -490,14 +498,27 @@ "static": [] }, "path": [ - "MyClass", - "getUndefined" - ] + { + "name": "MyClass", + "kind": "class" + }, + { + "name": "getUndefined", + "kind": "function", + "scope": "static" + } + ], + "namespace": "MyClass.getUndefined" } - ] + ], + "events": [] }, "path": [ - "MyClass" - ] + { + "name": "MyClass", + "kind": "class" + } + ], + "namespace": "MyClass" } ] \ No newline at end of file diff --git a/test/fixture/merge-infered-type.output.json b/test/fixture/merge-infered-type.output.json index d4a1f9d..fec519a 100644 --- a/test/fixture/merge-infered-type.output.json +++ b/test/fixture/merge-infered-type.output.json @@ -257,7 +257,11 @@ "static": [] }, "path": [ - "addFive" - ] + { + "name": "addFive", + "kind": "function" + } + ], + "namespace": "addFive" } ] \ No newline at end of file diff --git a/test/fixture/meta.output.json b/test/fixture/meta.output.json index 8a1f494..2c1adb9 100644 --- a/test/fixture/meta.output.json +++ b/test/fixture/meta.output.json @@ -173,7 +173,11 @@ "static": [] }, "path": [ - "dewey" - ] + { + "name": "dewey", + "kind": "function" + } + ], + "namespace": "dewey" } ] \ No newline at end of file diff --git a/test/fixture/multiexample.output.json b/test/fixture/multiexample.output.json index dd26855..c95c8d4 100644 --- a/test/fixture/multiexample.output.json +++ b/test/fixture/multiexample.output.json @@ -338,7 +338,11 @@ "static": [] }, "path": [ - "multiexample.input" - ] + { + "name": "multiexample.input", + "kind": "function" + } + ], + "namespace": "multiexample.input" } ] \ No newline at end of file diff --git a/test/fixture/multisignature.output.json b/test/fixture/multisignature.output.json index 67b83bb..5798465 100644 --- a/test/fixture/multisignature.output.json +++ b/test/fixture/multisignature.output.json @@ -161,8 +161,12 @@ "static": [] }, "path": [ - "getTheTime" - ] + { + "name": "getTheTime", + "kind": "function" + } + ], + "namespace": "getTheTime" }, { "description": { @@ -389,7 +393,11 @@ "static": [] }, "path": [ - "getTheTime" - ] + { + "name": "getTheTime", + "kind": "function" + } + ], + "namespace": "getTheTime" } ] \ No newline at end of file diff --git a/test/fixture/nearby_params.output.json b/test/fixture/nearby_params.output.json index 32c8b11..9532e99 100644 --- a/test/fixture/nearby_params.output.json +++ b/test/fixture/nearby_params.output.json @@ -506,7 +506,11 @@ "static": [] }, "path": [ - "sessions.create" - ] + { + "name": "sessions.create", + "kind": "function" + } + ], + "namespace": "sessions.create" } ] \ No newline at end of file diff --git a/test/fixture/nearby_params.output.md b/test/fixture/nearby_params.output.md index 353b08b..2dcd82b 100644 --- a/test/fixture/nearby_params.output.md +++ b/test/fixture/nearby_params.output.md @@ -7,6 +7,6 @@ Attempt to establish a cookie-based session in exchange for credentials. - `credentials` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `credentials.name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Login username. Also accepted as `username` or `email`. - `credentials.password` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Login password -- `callback` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)=** Gets passed `(err, { success:Boolean })`. +- `callback` **\[[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Gets passed `(err, { success:Boolean })`. Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise, to be resolved on success or rejected on failure diff --git a/test/fixture/nearby_params.output.md.json b/test/fixture/nearby_params.output.md.json index 85989eb..eb79064 100644 --- a/test/fixture/nearby_params.output.md.json +++ b/test/fixture/nearby_params.output.md.json @@ -334,6 +334,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function", @@ -347,7 +351,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, diff --git a/test/fixture/nest_params.output.json b/test/fixture/nest_params.output.json index 3217eb3..a30beac 100644 --- a/test/fixture/nest_params.output.json +++ b/test/fixture/nest_params.output.json @@ -271,8 +271,12 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" }, { "description": "", @@ -724,7 +728,10 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo" + } + ], + "namespace": "foo" } ] \ No newline at end of file diff --git a/test/fixture/nest_params.output.md b/test/fixture/nest_params.output.md index c096b44..e573e9b 100644 --- a/test/fixture/nest_params.output.md +++ b/test/fixture/nest_params.output.md @@ -2,7 +2,7 @@ **Parameters** -- `employees` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** The employees who are responsible for the project. +- `employees` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** The employees who are responsible for the project. - `employees[].name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of an employee. - `employees[].department` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The employee's department. - `employee` diff --git a/test/fixture/nest_params.output.md.json b/test/fixture/nest_params.output.md.json index 6768318..3b76fb9 100644 --- a/test/fixture/nest_params.output.md.json +++ b/test/fixture/nest_params.output.md.json @@ -54,7 +54,7 @@ }, { "type": "text", - "value": ".<" + "value": "<" }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", diff --git a/test/fixture/newline-in-description.output.json b/test/fixture/newline-in-description.output.json index 5502969..7287208 100644 --- a/test/fixture/newline-in-description.output.json +++ b/test/fixture/newline-in-description.output.json @@ -164,7 +164,8 @@ "static": [] }, "path": [ - null - ] + {} + ], + "namespace": "undefined" } ] \ No newline at end of file diff --git a/test/fixture/no-name.output.json b/test/fixture/no-name.output.json index 3e1e88e..88452f6 100644 --- a/test/fixture/no-name.output.json +++ b/test/fixture/no-name.output.json @@ -106,7 +106,8 @@ "static": [] }, "path": [ - null - ] + {} + ], + "namespace": "undefined" } ] \ No newline at end of file diff --git a/test/fixture/params.output.json b/test/fixture/params.output.json index 35f73ff..a8ff1f7 100644 --- a/test/fixture/params.output.json +++ b/test/fixture/params.output.json @@ -1,4 +1,204 @@ [ + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function returns the number one.", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + } + } + }, + "tags": [ + { + "title": "param", + "description": "the second param", + "lineNumber": 2, + "type": { + "type": "NameExpression", + "name": "number" + }, + "name": "b" + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This method has a type in the description and a default in the code\n * @param {number} x\n */\nfunction withDefault(x = 2) {\n return x;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n\n/**\n * Represents an IPv6 address\n *\n * This tests our support of optional parameters\n * @class Address6\n * @param {string} address - An IPv6 address string\n * @param {number} [groups=8] - How many octets to parse\n * @param {?number} third - A third argument\n * @param {Array} [foo=[1]] to properly be parsed\n * @example\n * var address = new Address6('2001::/32');\n */\nfunction Address6() {}\n\n/**\n * Create a GeoJSON data source instance given an options object\n *\n * This tests our support of nested parameters\n * @class GeoJSONSource\n * @param {Object} [options] optional options\n * @param {Object|string} options.data A GeoJSON data object or URL to it.\n * The latter is preferable in case of large GeoJSON files.\n * @param {number} [options.maxzoom=14] Maximum zoom to preserve detail at.\n * @param {number} [options.buffer] Tile buffer on each side.\n * @param {number} [options.tolerance] Simplification tolerance (higher means simpler).\n */\nfunction GeoJSONSource(options) {\n this.options = options;\n}\n\n/**\n * This tests our support for parameters with explicit types but with default\n * values specified in code.\n *\n * @param {number} x an argument\n *\n * @returns {number} some\n */\nexport const myfunc = (x = 123) => x;\n\n/**\n * This tests our support of JSDoc param tags without type information,\n * or any type information we could infer from annotations.\n *\n * @param address - An IPv6 address string\n */\nfunction foo(address) {\n return address;\n}\n" + }, + "errors": [], + "params": [ + { + "title": "param", + "name": "a", + "lineNumber": 5 + }, + { + "name": "b", + "lineNumber": 2, + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "the second param", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 17, + "offset": 16 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 17, + "offset": 16 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 17, + "offset": 16 + } + } + }, + "type": { + "type": "NameExpression", + "name": "number" + } + }, + { + "title": "param", + "name": "c", + "lineNumber": 5 + }, + { + "title": "param", + "name": "$3", + "type": { + "type": "NameExpression", + "name": "Object" + }, + "properties": [ + { + "title": "param", + "name": "$3.d", + "lineNumber": 5 + }, + { + "title": "param", + "name": "$3.e", + "lineNumber": 5 + }, + { + "title": "param", + "name": "$3.f", + "lineNumber": 5 + } + ] + } + ], + "name": "addThem", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "addThem", + "kind": "function" + } + ], + "namespace": "addThem" + }, { "description": { "type": "root", @@ -172,8 +372,12 @@ "static": [] }, "path": [ - "fishesAndFoxes" - ] + { + "name": "fishesAndFoxes", + "kind": "function" + } + ], + "namespace": "fishesAndFoxes" }, { "description": { @@ -285,8 +489,12 @@ "static": [] }, "path": [ - "withDefault" - ] + { + "name": "withDefault", + "kind": "function" + } + ], + "namespace": "withDefault" }, { "description": { @@ -530,16 +738,29 @@ "static": [] }, "path": [ - "Foo", - "method" - ] + { + "name": "Foo", + "kind": "class" + }, + { + "name": "method", + "kind": "function", + "scope": "instance" + } + ], + "namespace": "Foo#method" } ], - "static": [] + "static": [], + "events": [] }, "path": [ - "Foo" - ] + { + "name": "Foo", + "kind": "class" + } + ], + "namespace": "Foo" }, { "description": { @@ -983,204 +1204,12 @@ "static": [] }, "path": [ - "Address6" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function returns the number one.", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - } - } - }, - "tags": [ { - "title": "param", - "description": "the second param", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "b" + "name": "Address6", + "kind": "class" } ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This method has a type in the description and a default in the code\n * @param {number} x\n */\nfunction withDefault(x = 2) {\n return x;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n\n/**\n * Represents an IPv6 address\n *\n * This tests our support of optional parameters\n * @class Address6\n * @param {string} address - An IPv6 address string\n * @param {number} [groups=8] - How many octets to parse\n * @param {?number} third - A third argument\n * @param {Array} [foo=[1]] to properly be parsed\n * @example\n * var address = new Address6('2001::/32');\n */\nfunction Address6() {}\n\n/**\n * Create a GeoJSON data source instance given an options object\n *\n * This tests our support of nested parameters\n * @class GeoJSONSource\n * @param {Object} [options] optional options\n * @param {Object|string} options.data A GeoJSON data object or URL to it.\n * The latter is preferable in case of large GeoJSON files.\n * @param {number} [options.maxzoom=14] Maximum zoom to preserve detail at.\n * @param {number} [options.buffer] Tile buffer on each side.\n * @param {number} [options.tolerance] Simplification tolerance (higher means simpler).\n */\nfunction GeoJSONSource(options) {\n this.options = options;\n}\n\n/**\n * This tests our support for parameters with explicit types but with default\n * values specified in code.\n *\n * @param {number} x an argument\n *\n * @returns {number} some\n */\nexport const myfunc = (x = 123) => x;\n\n/**\n * This tests our support of JSDoc param tags without type information,\n * or any type information we could infer from annotations.\n *\n * @param address - An IPv6 address string\n */\nfunction foo(address) {\n return address;\n}\n" - }, - "errors": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 5 - }, - { - "name": "b", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the second param", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 17, - "offset": 16 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 17, - "offset": 16 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 17, - "offset": 16 - } - } - }, - "type": { - "type": "NameExpression", - "name": "number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 5 - }, - { - "title": "param", - "name": "$3", - "type": { - "type": "NameExpression", - "name": "Object" - }, - "properties": [ - { - "title": "param", - "name": "$3.d", - "lineNumber": 5 - }, - { - "title": "param", - "name": "$3.e", - "lineNumber": 5 - }, - { - "title": "param", - "name": "$3.f", - "lineNumber": 5 - } - ] - } - ], - "name": "addThem", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "addThem" - ] + "namespace": "Address6" }, { "description": { @@ -1711,8 +1740,12 @@ "static": [] }, "path": [ - "GeoJSONSource" - ] + { + "name": "GeoJSONSource", + "kind": "class" + } + ], + "namespace": "GeoJSONSource" }, { "description": { @@ -1945,8 +1978,12 @@ "static": [] }, "path": [ - "myfunc" - ] + { + "name": "myfunc", + "kind": "constant" + } + ], + "namespace": "myfunc" }, { "description": { @@ -2103,7 +2140,11 @@ "static": [] }, "path": [ - "foo" - ] + { + "name": "foo", + "kind": "function" + } + ], + "namespace": "foo" } ] \ No newline at end of file diff --git a/test/fixture/params.output.md b/test/fixture/params.output.md index 4495913..65c3097 100644 --- a/test/fixture/params.output.md +++ b/test/fixture/params.output.md @@ -1,3 +1,17 @@ +# addThem + +This function returns the number one. + +**Parameters** + +- `a` +- `b` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the second param +- `c` +- `$3` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** + - `$3.d` + - `$3.e` + - `$3.f` + # fishesAndFoxes This method has partially inferred params @@ -14,7 +28,7 @@ This method has a type in the description and a default in the code **Parameters** -- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)=(default 2)** +- `x` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)](default 2)** # Foo @@ -37,9 +51,9 @@ This tests our support of optional parameters **Parameters** - `address` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** An IPv6 address string -- `groups` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)=** How many octets to parse +- `groups` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** How many octets to parse - `third` **?[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** A third argument -- `foo` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)=** to properly be parsed +- `foo` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)]** to properly be parsed **Examples** @@ -47,20 +61,6 @@ This tests our support of optional parameters var address = new Address6('2001::/32'); ``` -# addThem - -This function returns the number one. - -**Parameters** - -- `a` -- `b` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the second param -- `c` -- `$3` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - - `$3.d` - - `$3.e` - - `$3.f` - # GeoJSONSource Create a GeoJSON data source instance given an options object @@ -69,12 +69,12 @@ This tests our support of nested parameters **Parameters** -- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)=** optional options - - `options.data` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\|[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** A GeoJSON data object or URL to it. +- `options` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** optional options + - `options.data` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** A GeoJSON data object or URL to it. The latter is preferable in case of large GeoJSON files. - - `options.maxzoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)=** Maximum zoom to preserve detail at. - - `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). + - `options.maxzoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Maximum zoom to preserve detail at. + - `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 diff --git a/test/fixture/params.output.md.json b/test/fixture/params.output.md.json index fab2c1d..dabe479 100644 --- a/test/fixture/params.output.md.json +++ b/test/fixture/params.output.md.json @@ -1,6 +1,293 @@ { "type": "root", "children": [ + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "addThem" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This function returns the number one.", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 38, + "offset": 37 + }, + "indent": [] + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "a" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "b" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "type": "link", + "children": [ + { + "type": "text", + "value": "number" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "the second param", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 17, + "offset": 16 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 17, + "offset": 16 + }, + "indent": [] + } + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "c" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$3" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "type": "link", + "children": [ + { + "type": "text", + "value": "Object" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$3.d" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$3.e" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + }, + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "$3.f" + }, + { + "type": "text", + "value": " " + }, + { + "type": "text", + "value": " " + } + ] + } + ] + } + ] + } + ] + } + ] + }, { "depth": 1, "type": "heading", @@ -275,6 +562,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", @@ -288,7 +579,7 @@ }, { "type": "text", - "value": "=" + "value": "]" }, { "type": "text", @@ -667,6 +958,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", @@ -680,7 +975,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, @@ -821,6 +1116,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", @@ -834,7 +1133,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, @@ -897,293 +1196,6 @@ "type": "code", "value": "var address = new Address6('2001::/32');" }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "addThem" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function returns the number one.", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 38, - "offset": 37 - }, - "indent": [] - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Parameters" - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "a" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "b" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "type": "link", - "children": [ - { - "type": "text", - "value": "number" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the second param", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 17, - "offset": 16 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 17, - "offset": 16 - }, - "indent": [] - } - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "c" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$3" - }, - { - "type": "text", - "value": " " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", - "type": "link", - "children": [ - { - "type": "text", - "value": "Object" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - } - ] - }, - { - "ordered": false, - "type": "list", - "children": [ - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$3.d" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$3.e" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - }, - { - "type": "listItem", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "$3.f" - }, - { - "type": "text", - "value": " " - }, - { - "type": "text", - "value": " " - } - ] - } - ] - } - ] - } - ] - } - ] - }, { "depth": 1, "type": "heading", @@ -1294,6 +1306,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", @@ -1307,7 +1323,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, @@ -1390,7 +1406,7 @@ }, { "type": "text", - "value": "|" + "value": " | " }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", @@ -1473,6 +1489,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", @@ -1486,7 +1506,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, @@ -1550,6 +1570,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", @@ -1563,7 +1587,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, @@ -1627,6 +1651,10 @@ { "type": "strong", "children": [ + { + "type": "text", + "value": "[" + }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", @@ -1640,7 +1668,7 @@ }, { "type": "text", - "value": "=" + "value": "]" } ] }, diff --git a/test/fixture/polyglot/blend.json b/test/fixture/polyglot/blend.json index a401be3..7f65cbb 100644 --- a/test/fixture/polyglot/blend.json +++ b/test/fixture/polyglot/blend.json @@ -178,7 +178,10 @@ "static": [] }, "path": [ - "hexToUInt32Color" - ] + { + "name": "hexToUInt32Color" + } + ], + "namespace": "hexToUInt32Color" } ] \ No newline at end of file diff --git a/test/fixture/react-jsx.output.json b/test/fixture/react-jsx.output.json index c4bb3f2..6a9163f 100644 --- a/test/fixture/react-jsx.output.json +++ b/test/fixture/react-jsx.output.json @@ -84,7 +84,11 @@ "static": [] }, "path": [ - "apples" - ] + { + "name": "apples", + "kind": "function" + } + ], + "namespace": "apples" } ] \ No newline at end of file diff --git a/test/fixture/readme/README.output.md b/test/fixture/readme/README.output.md index 5c25672..1c50a44 100644 --- a/test/fixture/readme/README.output.md +++ b/test/fixture/readme/README.output.md @@ -2,14 +2,6 @@ # API -## bar - -A second function with docs - -**Parameters** - -- `b` - ## foo A function with documentation. @@ -20,4 +12,12 @@ A function with documentation. Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** answer +## bar + +A second function with docs + +**Parameters** + +- `b` + # Another section diff --git a/test/fixture/rename.output.json b/test/fixture/rename.output.json index ddf1b20..fd06b1b 100644 --- a/test/fixture/rename.output.json +++ b/test/fixture/rename.output.json @@ -90,7 +90,10 @@ "static": [] }, "path": [ - "cheese" - ] + { + "name": "cheese" + } + ], + "namespace": "cheese" } ] \ No newline at end of file diff --git a/test/fixture/simple-hashbang.output.json b/test/fixture/simple-hashbang.output.json index e90e5ff..90c99cd 100644 --- a/test/fixture/simple-hashbang.output.json +++ b/test/fixture/simple-hashbang.output.json @@ -154,7 +154,11 @@ "static": [] }, "path": [ - "simple-hashbang.input" - ] + { + "name": "simple-hashbang.input", + "kind": "function" + } + ], + "namespace": "simple-hashbang.input" } ] \ No newline at end of file diff --git a/test/fixture/simple-two.output.json b/test/fixture/simple-two.output.json index 4fc7d69..5758402 100644 --- a/test/fixture/simple-two.output.json +++ b/test/fixture/simple-two.output.json @@ -236,7 +236,11 @@ "static": [] }, "path": [ - "returnTwo" - ] + { + "name": "returnTwo", + "kind": "function" + } + ], + "namespace": "returnTwo" } ] \ No newline at end of file diff --git a/test/fixture/simple.output.github.json b/test/fixture/simple.output.github.json index eaa2d51..dee915e 100644 --- a/test/fixture/simple.output.github.json +++ b/test/fixture/simple.output.github.json @@ -156,7 +156,11 @@ "static": [] }, "path": [ - "simple.input" - ] + { + "name": "simple.input", + "kind": "function" + } + ], + "namespace": "simple.input" } ] \ No newline at end of file diff --git a/test/fixture/simple.output.json b/test/fixture/simple.output.json index aba9707..d5e6651 100644 --- a/test/fixture/simple.output.json +++ b/test/fixture/simple.output.json @@ -154,7 +154,11 @@ "static": [] }, "path": [ - "simple.input" - ] + { + "name": "simple.input", + "kind": "function" + } + ], + "namespace": "simple.input" } ] \ No newline at end of file diff --git a/test/fixture/sorting/output.json b/test/fixture/sorting/output.json index bd60fcf..21f70ec 100644 --- a/test/fixture/sorting/output.json +++ b/test/fixture/sorting/output.json @@ -1,4 +1,96 @@ [ + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Apples are red", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 15, + "offset": 14 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 15, + "offset": 14 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 15, + "offset": 14 + } + } + }, + "tags": [], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 6, + "column": 2 + } + }, + "file": "[path]", + "code": "/**\n * Apples are red\n */\nvar apples = function() {\n return 'red';\n};\n\n/**\n * Bananas are yellow\n */\nvar bananas = function() {\n return 'yellow';\n};\n\n/**\n * Carrots are awesome\n */\nvar carrots = function() {\n return 'awesome';\n};\n" + }, + "name": "apples", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "apples", + "kind": "function" + } + ], + "namespace": "apples" + }, { "description": { "type": "root", @@ -84,8 +176,12 @@ "static": [] }, "path": [ - "bananas" - ] + { + "name": "bananas", + "kind": "function" + } + ], + "namespace": "bananas" }, { "description": { @@ -172,95 +268,11 @@ "static": [] }, "path": [ - "carrots" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Apples are red", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - } + { + "name": "carrots", + "kind": "function" } - }, - "tags": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, - "file": "[path]", - "code": "/**\n * Apples are red\n */\nvar apples = function() {\n return 'red';\n};\n\n/**\n * Bananas are yellow\n */\nvar bananas = function() {\n return 'yellow';\n};\n\n/**\n * Carrots are awesome\n */\nvar carrots = function() {\n return 'awesome';\n};\n" - }, - "name": "apples", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "apples" - ] + ], + "namespace": "carrots" } ] \ No newline at end of file diff --git a/test/fixture/throws.output.json b/test/fixture/throws.output.json index 1e67480..9e94b33 100644 --- a/test/fixture/throws.output.json +++ b/test/fixture/throws.output.json @@ -305,7 +305,11 @@ "static": [] }, "path": [ - "returnTwo" - ] + { + "name": "returnTwo", + "kind": "function" + } + ], + "namespace": "returnTwo" } ] \ No newline at end of file diff --git a/test/fixture/trailing-only.output.json b/test/fixture/trailing-only.output.json index a94e0a3..eaebb18 100644 --- a/test/fixture/trailing-only.output.json +++ b/test/fixture/trailing-only.output.json @@ -155,7 +155,8 @@ "static": [] }, "path": [ - null - ] + {} + ], + "namespace": "undefined" } ] \ No newline at end of file diff --git a/test/fixture/trailing.output.json b/test/fixture/trailing.output.json index 5432d6b..af2c629 100644 --- a/test/fixture/trailing.output.json +++ b/test/fixture/trailing.output.json @@ -1,257 +1,4 @@ [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TWO", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 4, - "offset": 3 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 4, - "offset": 3 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 4, - "offset": 3 - } - } - }, - "tags": [ - { - "title": "returns", - "description": "something", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 11, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - }, - "code": "/**\n * ONE\n * @returns {number} something\n */\nfunction fooBar() {\n return 1;\n}\n/**\n * TWO\n * @returns {number} something\n */\nfunction fooBaz() {\n return 2;\n}\n/**\n * this is a type\n * @class Something\n */\n" - }, - "errors": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "something", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - } - } - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "name": "fooBaz", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "fooBaz" - ] - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "this is a type", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - } - } - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 2, - "type": null, - "name": "Something" - } - ], - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 18, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "errors": [], - "kind": "class", - "name": "Something", - "members": { - "instance": [], - "static": [] - }, - "path": [ - "Something" - ] - }, { "description": { "type": "root", @@ -407,7 +154,272 @@ "static": [] }, "path": [ - "fooBar" - ] + { + "name": "fooBar", + "kind": "function" + } + ], + "namespace": "fooBar" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "TWO", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 4, + "offset": 3 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 4, + "offset": 3 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 4, + "offset": 3 + } + } + }, + "tags": [ + { + "title": "returns", + "description": "something", + "lineNumber": 2, + "type": { + "type": "NameExpression", + "name": "number" + } + } + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "code": "/**\n * ONE\n * @returns {number} something\n */\nfunction fooBar() {\n return 1;\n}\n/**\n * TWO\n * @returns {number} something\n */\nfunction fooBaz() {\n return 2;\n}\n/**\n * this is a type\n * @class Something\n */\n" + }, + "errors": [], + "returns": [ + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "something", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + } + } + }, + "type": { + "type": "NameExpression", + "name": "number" + } + } + ], + "name": "fooBaz", + "kind": "function", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "fooBaz", + "kind": "function" + } + ], + "namespace": "fooBaz" + }, + { + "description": { + "type": "root", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "this is a type", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 15, + "offset": 14 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 15, + "offset": 14 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 15, + "offset": 14 + } + } + }, + "tags": [ + { + "title": "class", + "description": null, + "lineNumber": 2, + "type": null, + "name": "Something" + } + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "errors": [], + "kind": "class", + "name": "Something", + "members": { + "instance": [], + "static": [] + }, + "path": [ + { + "name": "Something", + "kind": "class" + } + ], + "namespace": "Something" } ] \ No newline at end of file diff --git a/test/fixture/trailing.output.md b/test/fixture/trailing.output.md index 69a681f..ccccd9c 100644 --- a/test/fixture/trailing.output.md +++ b/test/fixture/trailing.output.md @@ -1,3 +1,9 @@ +# fooBar + +ONE + +Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** something + # fooBaz TWO @@ -7,9 +13,3 @@ Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer # Something this is a type - -# fooBar - -ONE - -Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** something diff --git a/test/fixture/trailing.output.md.json b/test/fixture/trailing.output.md.json index ea40e15..2dc7ac8 100644 --- a/test/fixture/trailing.output.md.json +++ b/test/fixture/trailing.output.md.json @@ -1,6 +1,115 @@ { "type": "root", "children": [ + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "fooBar" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "ONE", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 4, + "offset": 3 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 4, + "offset": 3 + }, + "indent": [] + } + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Returns " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "type": "link", + "children": [ + { + "type": "text", + "value": "number" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "something", + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "end": { + "line": 1, + "column": 10, + "offset": 9 + }, + "indent": [] + } + } + ] + }, { "depth": 1, "type": "heading", @@ -154,115 +263,6 @@ }, "indent": [] } - }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "fooBar" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ONE", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 4, - "offset": 3 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 4, - "offset": 3 - }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns " - }, - { - "type": "strong", - "children": [ - { - "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", - "type": "link", - "children": [ - { - "type": "text", - "value": "number" - } - ] - } - ] - }, - { - "type": "text", - "value": " " - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "something", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 10, - "offset": 9 - }, - "indent": [] - } - } - ] } ] } \ No newline at end of file diff --git a/test/fixture/type_application.output.json b/test/fixture/type_application.output.json index 0e9488a..04ec753 100644 --- a/test/fixture/type_application.output.json +++ b/test/fixture/type_application.output.json @@ -181,7 +181,11 @@ "static": [] }, "path": [ - "Address6" - ] + { + "name": "Address6", + "kind": "class" + } + ], + "namespace": "Address6" } ] \ No newline at end of file diff --git a/test/fixture/type_application.output.md b/test/fixture/type_application.output.md index 857d663..2cb8405 100644 --- a/test/fixture/type_application.output.md +++ b/test/fixture/type_application.output.md @@ -4,4 +4,4 @@ Represents an IPv6 address **Parameters** -- `address` **[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)>** An IPv6 address string +- `address` **[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)>** An IPv6 address string diff --git a/test/fixture/type_application.output.md.json b/test/fixture/type_application.output.md.json index 45d13ea..909e374 100644 --- a/test/fixture/type_application.output.md.json +++ b/test/fixture/type_application.output.md.json @@ -89,7 +89,7 @@ }, { "type": "text", - "value": ".<" + "value": "<" }, { "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", diff --git a/test/fixture/typedef.output.json b/test/fixture/typedef.output.json index ac0bf54..d1199fe 100644 --- a/test/fixture/typedef.output.json +++ b/test/fixture/typedef.output.json @@ -246,7 +246,11 @@ "static": [] }, "path": [ - "MyType" - ] + { + "name": "MyType", + "kind": "typedef" + } + ], + "namespace": "MyType" } ] \ No newline at end of file diff --git a/test/lib/hierarchy.js b/test/lib/hierarchy.js index 37b6717..779d08c 100644 --- a/test/lib/hierarchy.js +++ b/test/lib/hierarchy.js @@ -58,11 +58,11 @@ test('hierarchy', function (t) { var classMembers = comments[0].members; t.deepEqual(map(classMembers.static, 'name'), ['isClass', 'MAGIC_NUMBER']); - t.deepEqual(map(classMembers.instance, 'name'), ['getFoo', 'event']); + t.deepEqual(map(classMembers.instance, 'name'), ['getFoo']); - t.deepEqual(classMembers.static[0].path, ['Class', 'isClass']); - t.deepEqual(classMembers.instance[0].path, ['Class', 'getFoo']); - t.deepEqual(classMembers.instance[1].path, ['Class', 'event']); + t.deepEqual(map(classMembers.static[0].path, 'name'), ['Class', 'isClass']); + t.deepEqual(map(classMembers.instance[0].path, 'name'), ['Class', 'getFoo']); + t.deepEqual(map(classMembers.events[0].path, 'name'), ['Class', 'event']); t.end(); }); @@ -97,8 +97,8 @@ test('hierarchy - nesting', function (t) { var enumMembers = classMembers.static[0].members; t.deepEqual(map(enumMembers.static, 'name'), ['Parent', 'Child']); - t.deepEqual(enumMembers.static[0].path, ['Parent', 'enum', 'Parent']); - t.deepEqual(enumMembers.static[1].path, ['Parent', 'enum', 'Child']); + t.deepEqual(map(enumMembers.static[0].path, 'name'), ['Parent', 'enum', 'Parent']); + t.deepEqual(map(enumMembers.static[1].path, 'name'), ['Parent', 'enum', 'Child']); t.end(); }); diff --git a/test/lib/infer/kind.js b/test/lib/infer/kind.js index 8c0a339..351e0b6 100644 --- a/test/lib/infer/kind.js +++ b/test/lib/infer/kind.js @@ -33,6 +33,10 @@ test('inferKind', function (t) { 'class Foo { /** set b */ set b(v) { } }' )).kind, 'member', 'member via set'); + t.equal(inferKind(toComment( + 'var foo = { /** thing */ b: function(v) { } }' + )).kind, 'function', 'function via set'); + t.equal(inferKind(toComment( 'class Foo { /** get b */ get b() { } }' )).kind, 'member', 'member via get'); diff --git a/test/lib/parse.js b/test/lib/parse.js index c27cc5d..3c45914 100644 --- a/test/lib/parse.js +++ b/test/lib/parse.js @@ -24,6 +24,13 @@ function evaluate(fn, filename) { }); } +function addJSDocTag(tree) { + visit(tree, 'link', function (node) { + node.jsdoc = true; + }); + return tree; +} + function removePosition(tree) { visit(tree, function (node) { delete node.position; @@ -911,15 +918,15 @@ test('parse - unknown tag', function (t) { test('parse - {@link}', function (t) { t.deepEqual(removePosition(evaluate(function () { /** {@link Foo} */ - })[0].description), removePosition(remark.parse('[Foo](Foo)'))); + })[0].description), addJSDocTag(removePosition(remark.parse('[Foo](Foo)')))); t.deepEqual(removePosition(evaluate(function () { /** {@link Foo|text} */ - })[0].description), removePosition(remark.parse('[text](Foo)'))); + })[0].description), addJSDocTag(removePosition(remark.parse('[text](Foo)')))); t.deepEqual(removePosition(evaluate(function () { /** {@link Foo text} */ - })[0].description), removePosition(remark.parse('[text](Foo)'))); + })[0].description), addJSDocTag(removePosition(remark.parse('[text](Foo)')))); t.done(); }); @@ -942,6 +949,7 @@ test('parse - {@tutorial}', function (t) { children: [{ type: 'tutorial', url: 'id', + jsdoc: true, title: null, children: [{ type: 'text', @@ -960,6 +968,7 @@ test('parse - {@tutorial}', function (t) { children: [{ type: 'tutorial', url: 'id', + jsdoc: true, title: null, children: [{ type: 'text', @@ -978,6 +987,7 @@ test('parse - {@tutorial}', function (t) { children: [{ type: 'tutorial', url: 'id', + jsdoc: true, title: null, children: [{ type: 'text', diff --git a/test/lib/parsers/polyglot.js b/test/lib/parsers/polyglot.js index a6c4754..4c9bca8 100644 --- a/test/lib/parsers/polyglot.js +++ b/test/lib/parsers/polyglot.js @@ -13,6 +13,7 @@ test('polyglot', function (t) { source: fs.readFileSync(file, 'utf8') }); delete result[0].context.file; + delete result[0].context.sortKey; t.deepEqual(result, [{ errors: [], context: { diff --git a/test/lib/sort.js b/test/lib/sort.js index 9d4d33c..76f6358 100644 --- a/test/lib/sort.js +++ b/test/lib/sort.js @@ -4,19 +4,19 @@ var test = require('tap').test, sort = require('../../lib/sort'); test('sort stream alphanumeric', function (t) { - var apples = { context: { filename: 'a.txt', loc: { start: { line: 0 } } }, name: 'apples' }; - var carrot = { context: { filename: 'a.txt', loc: { start: { line: 1 } } }, name: 'carrot' }; - var banana = { context: { filename: 'a.txt', loc: { start: { line: 2 } } }, name: 'bananas' }; + var apples = { context: { sortKey: 'a' }, name: 'apples' }; + var carrot = { context: { sortKey: 'b' }, name: 'carrot' }; + var banana = { context: { sortKey: 'c' }, name: 'bananas' }; t.deepEqual([ apples, carrot, banana - ].sort(sort.bind(undefined, null)), [ + ].sort(sort), [ apples, carrot, banana ], 'sort stream alphanumeric'); t.deepEqual([ carrot, apples, banana - ].sort(sort.bind(undefined, null)), [ + ].sort(sort), [ apples, carrot, banana ], 'sort stream alphanumeric'); diff --git a/test/test.js b/test/test.js index dcdfbab..0324a38 100644 --- a/test/test.js +++ b/test/test.js @@ -95,7 +95,7 @@ test('html', function (tt) { var clean = result.sort(function (a, b) { return a.path > b.path; }).filter(function (r) { - return !r.path.match(/(json|woff)$/); + return r.path.match(/(html)$/); }).map(function (r) { return r.contents; }).join('\n');