chore: rebase documentation and markdown classes from docs (#7172)
This commit is contained in:
parent
2e251d9d5d
commit
36c5395d2d
|
|
@ -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,6 +319,7 @@ Documentation.Member = class {
|
|||
this.args.set(arg.name, arg);
|
||||
arg.enclosingMethod = this;
|
||||
if (arg.name === 'options') {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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, '');
|
||||
|
|
|
|||
Loading…
Reference in a new issue