diff --git a/utils/doclint/documentation.js b/utils/doclint/documentation.js index 4073a34481..d40cfe797c 100644 --- a/utils/doclint/documentation.js +++ b/utils/doclint/documentation.js @@ -304,6 +304,11 @@ Documentation.Member = class { }; this.async = false; this.alias = name; + /** + * Param is true and option false + * @type {Boolean} + */ + this.paramOrOption = null; } index() { @@ -314,7 +319,8 @@ Documentation.Member = class { this.args.set(arg.name, arg); arg.enclosingMethod = this; if (arg.name === 'options') { - arg.type.properties.forEach(p => p.enclosingMethod = this ); + arg.type.properties.sort((p1, p2) => p1.name.localeCompare(p2.name)); + arg.type.properties.forEach(p => p.enclosingMethod = this); } } } @@ -344,6 +350,7 @@ Documentation.Member = class { clone() { const result = new Documentation.Member(this.kind, this.langs, this.name, this.type, this.argsArray, this.spec, this.required); result.async = this.async; + result.paramOrOption = this.paramOrOption; return result; } diff --git a/utils/markdown.js b/utils/markdown.js index 91e68899a2..699c8b7e07 100644 --- a/utils/markdown.js +++ b/utils/markdown.js @@ -227,7 +227,7 @@ function render(nodes, maxColumns) { */ function innerRenderMdNode(indent, node, lastNode, result, maxColumns) { const newLine = () => { - if (result.length && result[result.length - 1] !== '') + if (result[result.length - 1] !== '') result.push(''); }; @@ -370,12 +370,13 @@ function visit(node, visitor, depth = 0) { /** * @param {MarkdownNode[]} nodes + * @param {boolean=} h3 * @returns {string} */ -function generateToc(nodes) { +function generateToc(nodes, h3) { const result = []; visitAll(nodes, (node, depth) => { - if (node.type === 'h1' || node.type === 'h2') { + if (node.type === 'h1' || node.type === 'h2' || (h3 && node.type === 'h3')) { let link = node.text.toLowerCase(); link = link.replace(/[ ]+/g, '-'); link = link.replace(/[^\w-_]/g, '');