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

This commit is contained in:
Anže Vodovnik 2021-02-17 19:45:15 +01:00 committed by GitHub
parent cc749fe679
commit 8f3a6c6b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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++) {