diff --git a/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs b/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs index 65b76668d6..55a9eacb37 100644 --- a/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs +++ b/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs @@ -119,13 +119,6 @@ namespace Volo.Docs.Markdown { return match.Value; } - - - var hasUrlParameter = match.Groups.Count > 3 && !match.Groups[4].Value.IsNullOrEmpty(); - if (hasUrlParameter) - { - documentName += match.Groups[4].Value; - } var documentLocalDirectoryNormalized = documentLocalDirectory.TrimStart('/').TrimEnd('/'); if (!string.IsNullOrWhiteSpace(documentLocalDirectoryNormalized)) @@ -133,8 +126,12 @@ namespace Volo.Docs.Markdown documentLocalDirectoryNormalized = "/" + documentLocalDirectoryNormalized; } + var hasUrlParameter = match.Groups.Count > 3 && !match.Groups[4].Value.IsNullOrEmpty(); + return string.Format(MdLinkFormat, displayText, - _docsLinkGenerator.GenerateLink(projectShortName, languageCode, $"{version}{documentLocalDirectoryNormalized}", documentName) + (hashPart.IsNullOrWhiteSpace() ? string.Empty : "#" + hashPart)); + _docsLinkGenerator.GenerateLink(projectShortName, languageCode, $"{version}{documentLocalDirectoryNormalized}", documentName) + + (hasUrlParameter ? match.Groups[4].Value : string.Empty) + + (hashPart.IsNullOrWhiteSpace() ? string.Empty : "#" + hashPart)); }); }