pull/640/head
Alper Ebicoglu 6 years ago
parent bb2e740762
commit 0d6a790569

@ -15,7 +15,7 @@ namespace Volo.Docs.Markdown
public const string Type = "md"; public const string Type = "md";
private const string MdLinkFormat = "[{0}](/documents/{1}/{2}{3}/{4})"; private const string MdLinkFormat = "[{0}](/documents/{1}/{2}{3}/{4})";
private const string MarkdownLinkRegExp = @"\[([^)]+)\]\(([^)]+." + Type + @")\)"; private const string MarkdownLinkRegExp = @"\[(.*)\]\((.*\.md)\)";
private const string AnchorLinkRegExp = @"<a[^>]+href=\""(.*?)\""[^>]*>(.*)?</a>"; private const string AnchorLinkRegExp = @"<a[^>]+href=\""(.*?)\""[^>]*>(.*)?</a>";
public virtual string Convert(ProjectDto project, DocumentWithDetailsDto document, string version) public virtual string Convert(ProjectDto project, DocumentWithDetailsDto document, string version)
@ -36,12 +36,12 @@ namespace Volo.Docs.Markdown
} }
protected virtual string NormalizeLinks( protected virtual string NormalizeLinks(
string content, string content,
string projectShortName, string projectShortName,
string version, string version,
string documentLocalDirectory) string documentLocalDirectory)
{ {
var normalized = Regex.Replace(content, MarkdownLinkRegExp, delegate(Match match) var normalized = Regex.Replace(content, MarkdownLinkRegExp, delegate (Match match)
{ {
var link = match.Groups[2].Value; var link = match.Groups[2].Value;
if (UrlHelper.IsExternalLink(link)) if (UrlHelper.IsExternalLink(link))

Loading…
Cancel
Save