Skip to content

Commit 769acca

Browse files
committed
Make all absolute LLM links use md terminations
1 parent e684ff4 commit 769acca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Elastic.Markdown/Myst/Renderers/LlmMarkdown/LlmBlockRenderers.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,22 @@ public static void RenderBlockWithIndentation(LlmMarkdownRenderer renderer, Mark
3939
}
4040

4141
/// <summary>
42-
/// Converts relative URLs to absolute URLs using BuildContext.CanonicalBaseUrl for better LLM consumption
42+
/// Converts relative URLs to absolute URLs using BuildContext.CanonicalBaseUrl for better LLM consumption.
43+
/// For documentation URLs, converts them to .md format for consistency with LLM-generated files.
4344
/// </summary>
4445
public static string? MakeAbsoluteUrl(LlmMarkdownRenderer renderer, string? url)
4546
{
4647
if (renderer.BuildContext.CanonicalBaseUrl == null)
4748
return url;
4849

50+
// For documentation URLs (starting with /docs/), convert to .md format for LLM consistency
51+
if (!string.IsNullOrEmpty(url) && url.StartsWith("/docs/", StringComparison.Ordinal))
52+
{
53+
var markdownUrl = ConvertToMarkdownUrl(url);
54+
return MakeAbsoluteUrl(renderer.BuildContext.CanonicalBaseUrl, markdownUrl);
55+
}
56+
57+
// For other URLs (images, external links), use regular absolute URL conversion
4958
return MakeAbsoluteUrl(renderer.BuildContext.CanonicalBaseUrl, url);
5059
}
5160

0 commit comments

Comments
 (0)