|
10 | 10 | using Elastic.Documentation.Site.Navigation; |
11 | 11 | using Elastic.Markdown.IO; |
12 | 12 | using Elastic.Markdown.IO.Navigation; |
| 13 | +using Elastic.Markdown.Myst.Renderers.LlmMarkdown; |
13 | 14 |
|
14 | 15 | namespace Documentation.Assembler.Navigation; |
15 | 16 |
|
@@ -43,7 +44,7 @@ public string GenerateNavigationSections(GlobalNavigation navigation) |
43 | 44 | foreach (var child in firstLevelChildren) |
44 | 45 | { |
45 | 46 | var title = child.NavigationTitle; |
46 | | - var url = ConvertToAbsoluteMarkdownUrl(child.Url); |
| 47 | + var url = LlmRenderingHelpers.ConvertToAbsoluteMarkdownUrl(child.Url); |
47 | 48 | var description = GetDescription(child); |
48 | 49 |
|
49 | 50 | _ = !string.IsNullOrEmpty(description) |
@@ -77,27 +78,6 @@ private static string GetCategoryDisplayName(string navigationTitle) => |
77 | 78 | private static IEnumerable<INavigationItem> GetFirstLevelChildren(DocumentationGroup group) => |
78 | 79 | group.NavigationItems.Where(i => !i.Hidden); |
79 | 80 |
|
80 | | - private static string ConvertToAbsoluteMarkdownUrl(string url) |
81 | | - { |
82 | | - // Convert HTML URLs to .md URLs for LLM consumption |
83 | | - // e.g., "/docs/solutions/search/" -> "https://www.elastic.co/docs/solutions/search.md" |
84 | | - var cleanUrl = url.TrimStart('/'); |
85 | | - |
86 | | - // Remove "docs/" prefix if present for the markdown filename |
87 | | - var markdownPath = cleanUrl; |
88 | | - if (markdownPath.StartsWith("docs/", StringComparison.Ordinal)) |
89 | | - markdownPath = markdownPath.Substring(5); |
90 | | - |
91 | | - // Convert directory URLs to .md files |
92 | | - if (markdownPath.EndsWith('/')) |
93 | | - markdownPath = markdownPath.TrimEnd('/') + ".md"; |
94 | | - else if (!markdownPath.EndsWith(".md", StringComparison.Ordinal)) |
95 | | - markdownPath += ".md"; |
96 | | - |
97 | | - // Make absolute URL using the canonical base URL (always https://www.elastic.co for production) |
98 | | - var baseUrl = "https://www.elastic.co"; |
99 | | - return $"{baseUrl}/docs/{markdownPath}"; |
100 | | - } |
101 | 81 |
|
102 | 82 | private static string? GetDescription(INavigationItem navigationItem) => navigationItem switch |
103 | 83 | { |
|
0 commit comments