Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Sep 9, 2024
1 parent 718bd9b commit 3bbd7de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/playwright/types/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* - Running tests serially, retrying from the start.
*
* **NOTE** Running serially is not recommended. It is usually better to make your tests isolated, so they can be
* run independently.
* run
* independently.
*
* ```js
* // Annotate tests as inter-dependent.
Expand Down
6 changes: 4 additions & 2 deletions utils/doclint/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ function patchLinksInText(classOrMember, text, classesMap, membersMap, linkRende
* @param {MarkdownNode[] | undefined} spec
*/
function generateSourceCodeComment(spec) {
const renderOptions = { maxColumns: 120 - 5, omitLastCR: true, flattenText: true };
const comments = (spec || []).filter(n => !n.type.startsWith('h') && (n.type !== 'li' || n.liType !== 'default')).map(c => md.clone(c));
md.visitAll(comments, node => {
if (node.type === 'li' && node.liType === 'bullet')
Expand All @@ -803,11 +804,12 @@ function generateSourceCodeComment(spec) {
if (node.type === 'note') {
// @ts-ignore
node.type = 'text';
node.text = '**NOTE** ' + node.text;
const text = '**NOTE** ' + (node.children || []).map(child => md.render([child], renderOptions)).join('\n');
node.text = md.wrapText(text.replace(/\n/g, '↵'), renderOptions, '');
}
});
// 5 is a typical member doc offset.
return md.render(comments, { maxColumns: 120 - 5, omitLastCR: true, flattenText: true });
return md.render(comments, renderOptions);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions utils/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

/** @typedef {MarkdownBaseNode & {
* type: 'note',
* text: string,
* noteType: string,
* }} MarkdownNoteNode */

Expand Down Expand Up @@ -208,7 +207,7 @@ function buildTree(lines) {
tokens.push(line.substring(indent.length));
line = lines[++i];
}
node.text = tokens.join('↵');
node.children = buildTree(tokens);
appendNode(indent, node);
continue;
}
Expand Down Expand Up @@ -341,7 +340,8 @@ function innerRenderMdNode(indent, node, lastNode, result, options) {
if (node.type === 'note') {
newLine();
result.push(`${indent}:::${node.noteType}`);
result.push(wrapText(node.text, options, indent));
for (const child of node.children || [])
innerRenderMdNode(indent, child, lastNode, result, options);
result.push(`${indent}:::`);
newLine();
return;
Expand Down

0 comments on commit 3bbd7de

Please sign in to comment.