From 43de259522b08f95ea2d5592a7ed237954038543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C5=BEe=20Vodovnik?= Date: Thu, 11 Mar 2021 18:07:45 +0100 Subject: [PATCH] fix(xmldocs): over-greedy regex for md links and clean-up (#5798) * fix(xmldocs): over-greedy regex for Markdown links * fix(dotnet): missing using and extra spaces --- utils/doclint/generateDotnetApi.js | 2 +- utils/doclint/templates/interface.cs | 1 + utils/doclint/xmlDocumentation.js | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/doclint/generateDotnetApi.js b/utils/doclint/generateDotnetApi.js index 4e4be34761..2d25b22ae2 100644 --- a/utils/doclint/generateDotnetApi.js +++ b/utils/doclint/generateDotnetApi.js @@ -364,7 +364,7 @@ function generateEnumNameIfApplicable(member, name, type, parent) { function renderMethod(member, parent, output, name) { const typeResolve = (type) => translateType(type, parent, (t) => { let newName = `${parent.name}${translateMemberName(member.kind, member.name, null)}Result`; - documentedResults.set(newName, `Result of calling .`); + documentedResults.set(newName, `Result of calling .`); return newName; }); diff --git a/utils/doclint/templates/interface.cs b/utils/doclint/templates/interface.cs index b792a2cd13..25f9c76536 100644 --- a/utils/doclint/templates/interface.cs +++ b/utils/doclint/templates/interface.cs @@ -39,6 +39,7 @@ using System.Globalization; using System.IO; using System.Runtime.Serialization; using System.Text.Json; +using System.Text.Json.Serialization; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; diff --git a/utils/doclint/xmlDocumentation.js b/utils/doclint/xmlDocumentation.js index 2f27f76c1b..64bc6e62c5 100644 --- a/utils/doclint/xmlDocumentation.js +++ b/utils/doclint/xmlDocumentation.js @@ -118,11 +118,11 @@ function _wrapAndEscape(node, maxColumns = 0) { let text = node.text; - text = text.replace(/`([^`]*)`/g, (match, code) => `${code.replace('<', '<').replace('>', '>')}`); - text = text.replace(/\[(.*?)\]\((.*?\))/g, (match, linkName, linkUrl) => { + text = text.replace(/\[(.*?)\]\((.*?)\)/g, (match, linkName, linkUrl) => { return `${linkName}`; }); - text = text.replace(/\[(.*?)\]/g, (match, link) => ``); + text = text.replace(/(? ``); + text = text.replace(/`([^`]*)`/g, (match, code) => `${code.replace('<', '<').replace('>', '>')}`); const words = text.split(' '); let line = ''; for (let i = 0; i < words.length; i++) {