Skip to content

Commit

Permalink
Fix root links (#382)
Browse files Browse the repository at this point in the history
* Fix root links

* Fix

* Update src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs

Co-authored-by: Martijn Laarman <[email protected]>

* Update src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs

---------

Co-authored-by: Martijn Laarman <[email protected]>
  • Loading branch information
reakaleek and Mpdreamz authored Jan 30, 2025
1 parent b51d311 commit 6162b10
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public override bool Match(InlineProcessor processor, ref StringSlice slice)
// rooted links might need the configured path prefix to properly link
var prefix = processor.GetBuildContext().UrlPathPrefix;
if (url.StartsWith("/") && !string.IsNullOrWhiteSpace(prefix))
link.Url = $"{prefix}/{link.Url}";
link.Url = $"{prefix.TrimEnd('/')}/{link.Url}";

if (!string.IsNullOrEmpty(anchor))
link.Url += $"#{anchor}";
Expand Down

0 comments on commit 6162b10

Please sign in to comment.