Fix: Links with `.md#` are failing

resolves https://github.com/volosoft/volo/issues/3575
pull/5694/head
Yunus Emre Kalkan 5 years ago
parent 282be6fd2f
commit bf194cc682

@ -74,6 +74,15 @@ namespace Volo.Docs.Markdown
return Regex.Replace(content, MarkdownLinkRegExp, delegate (Match match)
{
var link = match.Groups[3].Value;
var hashPart = "";
if (link.Contains("#"))
{
var linkSplitted = link.Split("#");
link = linkSplitted[0];
hashPart = linkSplitted[1];
}
if (UrlHelper.IsExternalLink(link))
{
return match.Value;
@ -100,6 +109,11 @@ namespace Volo.Docs.Markdown
documentLocalDirectoryNormalized = "/" + documentLocalDirectoryNormalized;
}
if (!string.IsNullOrEmpty(hashPart))
{
documentName += $"#{hashPart}";
}
return string.Format(
MdLinkFormat,
displayText,

Loading…
Cancel
Save