Skip to content

Commit

Permalink
fix(xmldocs): over-greedy regex for md links and clean-up (#5798)
Browse files Browse the repository at this point in the history
* fix(xmldocs): over-greedy regex for Markdown links
* fix(dotnet): missing using and extra spaces
  • Loading branch information
avodovnik authored Mar 11, 2021
1 parent 6a8c8d9 commit 43de259
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion utils/doclint/generateDotnetApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <see cref="${translateMemberName("interface", parent.name)}.${translateMemberName(member.kind, member.name, member)}" />.`);
documentedResults.set(newName, `Result of calling <see cref="${translateMemberName("interface", parent.name)}.${translateMemberName(member.kind, member.name, member)}"/>.`);
return newName;
});

Expand Down
1 change: 1 addition & 0 deletions utils/doclint/templates/interface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
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;
Expand Down
6 changes: 3 additions & 3 deletions utils/doclint/xmlDocumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ function _wrapAndEscape(node, maxColumns = 0) {


let text = node.text;
text = text.replace(/`([^`]*)`/g, (match, code) => `<c>${code.replace('<', '&lt;').replace('>', '&gt;')}</c>`);
text = text.replace(/\[(.*?)\]\((.*?\))/g, (match, linkName, linkUrl) => {
text = text.replace(/\[(.*?)\]\((.*?)\)/g, (match, linkName, linkUrl) => {
return `<a href="${linkUrl}">${linkName}</a>`;
});
text = text.replace(/\[(.*?)\]/g, (match, link) => `<see cref="${link}" />`);
text = text.replace(/(?<!`)\[(.*?)\]/g, (match, link) => `<see cref="${link}"/>`);
text = text.replace(/`([^`]*)`/g, (match, code) => `<c>${code.replace('<', '&lt;').replace('>', '&gt;')}</c>`);
const words = text.split(' ');
let line = '';
for (let i = 0; i < words.length; i++) {
Expand Down

0 comments on commit 43de259

Please sign in to comment.