Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(docs): improve xmldoc inline code parsing (#5480)

Anže Vodovnik8f3a6c6b45d2
diff --git a/utils/doclint/xmlDocumentation.js b/utils/doclint/xmlDocumentation.js
index f480b51449..37c1858fe0 100644
--- a/utils/doclint/xmlDocumentation.js
+++ b/utils/doclint/xmlDocumentation.js
@@ -103,7 +103,12 @@ function _wrapAndEscape(node, maxColumns = 0) {
lines.push(text);
};
- const text = node.text.replace(/[^\[]`([^\]]*[^\[])`[^\]]/g, (m, g1) => ` <c>${g1}</c> `);
+
+ let text = node.text;
+ text = text.replace(/`([^`]*)`/g, (match, code) => `<c>${code.replace('<', '&lt;').replace('>', '&gt;')}</c>`);
+ text = text.replace(/\[(.*?)\]\((.*?\))/g, (match, linkName, linkUrl) => {
+ return `<a href="${linkUrl}">${linkName}</a>`;
+ });
const words = text.split(' ');
let line = '';
for (let i = 0; i < words.length; i++) {