Skip to content

Commit c313647

Browse files
committed
test
1 parent d92266f commit c313647

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,18 @@ private static void ValidateAnchor(InlineProcessor processor, MarkdownFile markd
237237

238238
private static void UpdateLinkUrl(LinkInline link, string url, ParserContext context, string? anchor, IFileInfo file)
239239
{
240+
var newUrl = url;
240241
var urlPathPrefix = context.Build.UrlPathPrefix ?? string.Empty;
241242
if (url.EndsWith(".md"))
242-
url = Path.ChangeExtension(url, ".html");
243-
243+
newUrl = Path.ChangeExtension(newUrl, ".html");
244244

245245
if (!url.StartsWith('/'))
246-
url = GetRootRelativePath(context, file);
246+
newUrl = GetRootRelativePath(context, file);
247247

248248
if (!string.IsNullOrWhiteSpace(urlPathPrefix))
249-
url = $"{urlPathPrefix.TrimEnd('/')}{url}";
249+
newUrl = $"{urlPathPrefix.TrimEnd('/')}{newUrl}";
250250

251-
link.Url = !string.IsNullOrEmpty(anchor) ? $"{url}#{anchor}" : url;
251+
link.Url = !string.IsNullOrEmpty(anchor) ? $"{newUrl}#{anchor}" : newUrl;
252252
}
253253

254254
private static string GetRootRelativePath(ParserContext context, IFileInfo file)

tests/Elastic.Markdown.Tests/Inline/InlineLinkTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ public class LinkToPageTests(ITestOutputHelper output) : LinkTestBase(output,
5858
public void GeneratesHtml() =>
5959
// language=html
6060
Html.Should().Contain(
61-
<<<<<<< Updated upstream
62-
"""<p><a href="testing/req.html">Requirements</a></p>"""
63-
=======
6461
"""<p><a href="/testing/req">Requirements</a></p>"""
65-
>>>>>>> Stashed changes
6662
);
6763

6864
[Fact]
@@ -110,11 +106,7 @@ public class LinkReferenceTest(ITestOutputHelper output) : LinkTestBase(output,
110106
public void GeneratesHtml() =>
111107
// language=html
112108
Html.Should().Contain(
113-
<<<<<<< Updated upstream
114-
"""<p><a href="testing/req.html">test</a></p>"""
115-
=======
116109
"""<p><a href="/testing/req">test</a></p>"""
117-
>>>>>>> Stashed changes
118110
);
119111

120112
[Fact]

0 commit comments

Comments
 (0)