Browse Source

resolved: MarkdownDocumentToHtmlConverter miscatches the links

resolved https://github.com/abpframework/abp/issues/2582
pull/2587/head
Yunus Emre Kalkan 7 years ago
parent
commit
f42c452991
  1. 4
      modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs

4
modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs

@ -24,7 +24,7 @@ namespace Volo.Docs.Markdown
}
private const string MdLinkFormat = "[{0}]({1}{2}/{3}/{4}{5}/{6})";
private const string MarkdownLinkRegExp = @"\[(.*?)\]\((.*?\.md)\)";
private const string MarkdownLinkRegExp = @"\[(.*?)\]\((.*?)\)";
private const string AnchorLinkRegExp = @"<a[^>]+href=\""(.*?)\""[^>]*>(.*)?</a>";
public virtual string Convert(ProjectDto project, DocumentWithDetailsDto document, string version,
@ -56,7 +56,7 @@ namespace Volo.Docs.Markdown
var normalized = Regex.Replace(content, MarkdownLinkRegExp, delegate (Match match)
{
var link = match.Groups[2].Value;
if (UrlHelper.IsExternalLink(link))
if (UrlHelper.IsExternalLink(link) || !link.EndsWith(".md"))
{
return match.Value;
}

Loading…
Cancel
Save