Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
2c197f7
Add CLI command documentation drafts
Mpdreamz Sep 29, 2025
771b84b
organize cli command documentation
Mpdreamz Sep 30, 2025
f72e837
Merge remote-tracking branch 'origin/main' into feature/cli-documenta…
Mpdreamz Sep 30, 2025
335d7a6
stage changes
Mpdreamz Sep 30, 2025
9b65802
Finish documenting cli commands
Mpdreamz Sep 30, 2025
69bf2d2
Cleanup migration
Mpdreamz Sep 30, 2025
1daf6c8
touchups
Mpdreamz Sep 30, 2025
a030f85
stage
Mpdreamz Sep 30, 2025
8ed7a3b
stage
Mpdreamz Sep 30, 2025
0bfe134
First pass of claude over building blocks
Mpdreamz Sep 30, 2025
7887ee2
Expanded building blocks
Mpdreamz Oct 1, 2025
6d7f430
update building blocks
Mpdreamz Oct 1, 2025
9a9f20b
update building blocks
Mpdreamz Oct 1, 2025
0c617c5
Include navigation building blocks
Mpdreamz Oct 1, 2025
e593ff0
Small touchups
Mpdreamz Oct 1, 2025
2e0cfd4
update redirects
Mpdreamz Oct 1, 2025
ea39746
Apply suggestions from code review
Mpdreamz Oct 1, 2025
b3b5309
Sentence case
Mpdreamz Oct 1, 2025
eb5f50d
fix links
Mpdreamz Oct 1, 2025
73d827f
List items full stop
Mpdreamz Oct 1, 2025
9a0d94d
colons in list not dashes
Mpdreamz Oct 1, 2025
d552c73
fix test
Mpdreamz Oct 1, 2025
62e97f7
Start on isolated docset config reader
Mpdreamz Oct 1, 2025
855b2b6
Stage before invoking AI
Mpdreamz Oct 1, 2025
1b3aac0
Start on new isolated navigation building
Mpdreamz Oct 2, 2025
b55e06b
toc nesting restrictions
Mpdreamz Oct 2, 2025
011584c
Continue with documentation set navigation, generated a lot of tests,…
Mpdreamz Oct 2, 2025
0384945
Reorg tests
Mpdreamz Oct 2, 2025
c2d9780
chop of /index
Mpdreamz Oct 2, 2025
8a73ddb
encapsulate more rules
Mpdreamz Oct 2, 2025
273908b
explicitly return IndexFileRef when deserialzing the configuration fo…
Mpdreamz Oct 2, 2025
9a103cc
Read through nested toc.yml file definitions
Mpdreamz Oct 2, 2025
295c823
Brand new navigation.yml deserialization
Mpdreamz Oct 2, 2025
0b7a9b4
Initial version of SiteNavigation
Mpdreamz Oct 2, 2025
1fae41b
Post claude test fixes
Mpdreamz Oct 2, 2025
faf31ea
Start on SiteDocumentationNavigation tests
Mpdreamz Oct 2, 2025
3853d09
stage broken state
Mpdreamz Oct 2, 2025
26daf61
stage
Mpdreamz Oct 2, 2025
5835e21
stage
Mpdreamz Oct 2, 2025
14bcfeb
fix tests manually
Mpdreamz Oct 2, 2025
c23eb1b
path_prefix is required now and added more tests
Mpdreamz Oct 2, 2025
763121e
Stage work on path prefix providers
Mpdreamz Oct 2, 2025
ac68fe5
Stage work tests passing again
Mpdreamz Oct 2, 2025
f079581
Add failing test
Mpdreamz Oct 3, 2025
9345203
Refactor TOC navigation handling to simplify nested validation logic …
Mpdreamz Oct 3, 2025
3358f74
fix tests
Mpdreamz Oct 3, 2025
1f4ffc6
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Oct 3, 2025
0cb96f1
dotnet format namespaces
Mpdreamz Oct 3, 2025
12ce150
dotnet format namespaces
Mpdreamz Oct 3, 2025
754b191
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Oct 3, 2025
baeba6e
Add explicit YamlMember
Mpdreamz Oct 3, 2025
9227e26
inject creating IDocumentationFile
Mpdreamz Oct 3, 2025
c1d81d6
stage
Mpdreamz Oct 3, 2025
00f65d3
Preserve covariance of interface
Mpdreamz Oct 6, 2025
0c5c82a
Start on moving the new navigation into position
Mpdreamz Oct 6, 2025
21de5d8
Started on removing GlobalNavigation
Mpdreamz Oct 6, 2025
903d714
TocItem just reads path (dumb) its up to nav to preserve relative path
Mpdreamz Oct 6, 2025
5a777b8
commit failing test
Mpdreamz Oct 6, 2025
6a77e32
fix deeply linked children, especially those with a parent deep/linke…
Mpdreamz Oct 6, 2025
6a1671d
increased complexity of test
Mpdreamz Oct 6, 2025
916366e
Fix FileInfo property
Mpdreamz Oct 6, 2025
d24e490
Get rid od Markdown.Url, navigation builds urls
Mpdreamz Oct 7, 2025
cd42982
Remove TableOfContentsTree
Mpdreamz Oct 7, 2025
20b3abe
remove CrossLinkNavigationItem
Mpdreamz Oct 7, 2025
19b688b
remove FileNavigationItem
Mpdreamz Oct 7, 2025
d307260
Remove DocumentationGroup
Mpdreamz Oct 7, 2025
1f8e1bc
remove namespace usages
Mpdreamz Oct 7, 2025
d0ec3b0
Move new navigation into place
Mpdreamz Oct 7, 2025
5e46a28
fix compilation of ApiExplorer needs revisiting
Mpdreamz Oct 8, 2025
7cbb599
stage commit
Mpdreamz Oct 8, 2025
ad27f98
stage
Mpdreamz Oct 8, 2025
5871376
Simplify folder and TOC children validation logic
Mpdreamz Oct 8, 2025
3c80da9
Update tests
Mpdreamz Oct 8, 2025
10ab418
Refactor TOC path construction to support TemporaryNavigationPlaceholder
Mpdreamz Oct 8, 2025
154721e
add nested folder back
Mpdreamz Oct 8, 2025
f77d0a0
fix test
Mpdreamz Oct 8, 2025
70faf0b
fix test
Mpdreamz Oct 8, 2025
b6ef3ae
fix test
Mpdreamz Oct 8, 2025
e835527
fix test
Mpdreamz Oct 8, 2025
f2e34ed
Fixing markdown tests
Mpdreamz Oct 8, 2025
070b53a
Fixing markdown tests
Mpdreamz Oct 8, 2025
1056eb4
Esnure path prefix on build context is reflected in the urls
Mpdreamz Oct 8, 2025
d7bdc38
Fix test
Mpdreamz Oct 8, 2025
2b91770
fix typo
Mpdreamz Oct 8, 2025
a545f23
fix tests
Mpdreamz Oct 8, 2025
d6b9a45
fix test
Mpdreamz Oct 8, 2025
43bf080
Fix tests
Mpdreamz Oct 8, 2025
166c494
Fix navigation rendering
Mpdreamz Oct 8, 2025
f658863
Include node navigations in crosslink lookup
Mpdreamz Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<PackageVersion Include="AWSSDK.Core" Version="4.0.0.2" />
<PackageVersion Include="AWSSDK.SQS" Version="4.0.0.1" />
<PackageVersion Include="AWSSDK.S3" Version="4.0.0.1" />
<PackageVersion Include="Generator.Equals" Version="3.2.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
<PackageVersion Include="KubernetesClient" Version="17.0.14" />
<PackageVersion Include="Elastic.Aspire.Hosting.Elasticsearch" Version="9.3.0" />
<PackageVersion Include="Elastic.Clients.Elasticsearch" Version="9.1.4" />
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docs-builder
#ocs-builder

[![ci](https://github.com/elastic/docs-builder/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/elastic/docs-builder/actions/workflows/ci.yml)

Expand Down
304 changes: 298 additions & 6 deletions docs-builder.sln

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/_docset.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
project: 'doc-builder'
max_toc_depth: 2
# indicates this documentation set is not linkable by assembler.
Expand Down Expand Up @@ -174,6 +174,8 @@
- file: index.md
- file: req.md
- folder: nested
children:
- file: index.md
- file: cross-links.md
children:
- title: "Getting Started Guide"
Expand Down
39 changes: 39 additions & 0 deletions src/Elastic.ApiExplorer/ApiIndexLeafNavigation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using Elastic.Documentation.Navigation;

namespace Elastic.ApiExplorer;

public class ApiIndexLeafNavigation<TModel>(
TModel model, string url, string navigationTitle,
IRootNavigationItem<INavigationModel, INavigationItem> rootNavigation,
INodeNavigationItem<INavigationModel, INavigationItem>? parent = null
) : ILeafNavigationItem<TModel>
where TModel : IApiModel
{
/// <inheritdoc />
public string Url { get; } = url;

/// <inheritdoc />
public string NavigationTitle { get; } = navigationTitle;

/// <inheritdoc />
public IRootNavigationItem<INavigationModel, INavigationItem> NavigationRoot { get; } = rootNavigation;

/// <inheritdoc />
public INodeNavigationItem<INavigationModel, INavigationItem>? Parent { get; set; } = parent;

/// <inheritdoc />
public bool Hidden { get; }

/// <inheritdoc />
public int NavigationIndex { get; set; }

/// <inheritdoc />
public bool IsCrossLink { get; }

/// <inheritdoc />
public TModel Model { get; } = model;
}
1 change: 1 addition & 0 deletions src/Elastic.ApiExplorer/ApiRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using Elastic.Documentation;
using Elastic.Documentation.Configuration;
using Elastic.Documentation.Navigation;
using Elastic.Documentation.Site.FileProviders;
using Elastic.Documentation.Site.Navigation;
using Microsoft.OpenApi.Models;
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.ApiExplorer/ApiViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using Elastic.Documentation.Configuration.Assembler;
using Elastic.Documentation.Configuration.Builder;
using Elastic.Documentation.Extensions;
using Elastic.Documentation.Navigation;
using Elastic.Documentation.Site;
using Elastic.Documentation.Site.FileProviders;
using Elastic.Documentation.Site.Navigation;
using Microsoft.AspNetCore.Html;

namespace Elastic.ApiExplorer;
Expand Down
1 change: 1 addition & 0 deletions src/Elastic.ApiExplorer/Endpoints/ApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information

using System.IO.Abstractions;
using Elastic.Documentation.Navigation;
using Elastic.Documentation.Site.Navigation;
using Microsoft.OpenApi.Models.Interfaces;
using RazorSlices;
Expand Down
24 changes: 12 additions & 12 deletions src/Elastic.ApiExplorer/Landing/LandingNavigationItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.IO.Abstractions;
using Elastic.ApiExplorer.Operations;
using Elastic.Documentation.Extensions;
using Elastic.Documentation.Site.Navigation;
using Elastic.Documentation.Navigation;
using RazorSlices;

namespace Elastic.ApiExplorer.Landing;
Expand All @@ -29,27 +29,23 @@ public class LandingNavigationItem : IApiGroupingNavigationItem<ApiLanding, INav
public IRootNavigationItem<INavigationModel, INavigationItem> NavigationRoot { get; }
public string Id { get; }
public int Depth { get; }
public ApiLanding Index { get; }
public ILeafNavigationItem<ApiLanding> Index { get; }
public IReadOnlyCollection<INavigationItem> NavigationItems { get; set; } = [];
public INodeNavigationItem<INavigationModel, INavigationItem>? Parent { get; set; }
public int NavigationIndex { get; set; }
public bool IsCrossLink => false; // API landing items are never cross-links
public string Url { get; }
public string Url => Index.Url;
public bool Hidden => false;

//TODO
public string NavigationTitle { get; } = "API Overview";
public string NavigationTitle => Index.NavigationTitle;

public LandingNavigationItem(string url)
{
Depth = 0;
NavigationRoot = this;
Id = ShortId.Create("root");

var landing = new ApiLanding();
Url = url;

Index = landing;
Index = new ApiIndexLeafNavigation<ApiLanding>(landing, url, "Api Overview", this);
}

/// <inheritdoc />
Expand All @@ -63,7 +59,8 @@ public interface IApiGroupingNavigationItem<out TGroupingModel, out TNavigationI
public abstract class ApiGroupingNavigationItem<TGroupingModel, TNavigationItem>(
TGroupingModel groupingModel,
IRootNavigationItem<IApiGroupingModel, INavigationItem> rootNavigation,
INodeNavigationItem<INavigationModel, INavigationItem> parent)
INodeNavigationItem<INavigationModel, INavigationItem> parent
)
: IApiGroupingNavigationItem<TGroupingModel, TNavigationItem>
where TGroupingModel : IApiGroupingModel
where TNavigationItem : INavigationItem
Expand Down Expand Up @@ -91,8 +88,10 @@ public abstract class ApiGroupingNavigationItem<TGroupingModel, TNavigationItem>

/// <inheritdoc />
public abstract string Id { get; }

//TODO ensure Index is not newed everytime
/// <inheritdoc />
public TGroupingModel Index { get; } = groupingModel;
public ILeafNavigationItem<TGroupingModel> Index => new ApiIndexLeafNavigation<TGroupingModel>(groupingModel, Url, NavigationTitle, rootNavigation, Parent);

/// <inheritdoc />
public IReadOnlyCollection<TNavigationItem> NavigationItems { get; set; } = [];
Expand Down Expand Up @@ -151,8 +150,9 @@ public class EndpointNavigationItem(ApiEndpoint endpoint, IRootNavigationItem<IA
/// <inheritdoc />
public string Id { get; } = ShortId.Create(nameof(EndpointNavigationItem), endpoint.Operations.First().ApiName, endpoint.Operations.First().Route);

//TODO ensure Index is not newed everytime
/// <inheritdoc />
public ApiEndpoint Index { get; } = endpoint;
public ILeafNavigationItem<ApiEndpoint> Index => new ApiIndexLeafNavigation<ApiEndpoint>(endpoint, Url, NavigationTitle, rootNavigation, Parent);

/// <inheritdoc />
public IReadOnlyCollection<OperationNavigationItem> NavigationItems { get; set; } = [];
Expand Down
1 change: 1 addition & 0 deletions src/Elastic.ApiExplorer/Landing/LandingView.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@inherits RazorSliceHttpResult<Elastic.ApiExplorer.Landing.LandingViewModel>
@using Elastic.ApiExplorer.Landing
@using Elastic.ApiExplorer.Operations
@using Elastic.Documentation.Navigation
@using Elastic.Documentation.Site.Navigation
@implements IUsesLayout<Elastic.ApiExplorer._Layout, GlobalLayoutViewModel>
@functions {
Expand Down
5 changes: 3 additions & 2 deletions src/Elastic.ApiExplorer/OpenApiGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Elastic.ApiExplorer.Operations;
using Elastic.Documentation;
using Elastic.Documentation.Configuration;
using Elastic.Documentation.Navigation;
using Elastic.Documentation.Site.FileProviders;
using Elastic.Documentation.Site.Navigation;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -265,7 +266,7 @@ public async Task Generate(Cancel ctx = default)
CurrentNavigation = navigation,
MarkdownRenderer = markdownStringRenderer
};
_ = await Render(prefix, navigation, navigation.Index, renderContext, navigationRenderer, ctx);
_ = await Render(prefix, navigation, navigation.Index.Model, renderContext, navigationRenderer, ctx);
await RenderNavigationItems(prefix, renderContext, navigationRenderer, navigation, ctx);

}
Expand All @@ -275,7 +276,7 @@ private async Task RenderNavigationItems(string prefix, ApiRenderContext renderC
{
if (currentNavigation is INodeNavigationItem<IApiModel, INavigationItem> node)
{
_ = await Render(prefix, node, node.Index, renderContext, navigationRenderer, ctx);
_ = await Render(prefix, node, node.Index.Model, renderContext, navigationRenderer, ctx);
foreach (var child in node.NavigationItems)
await RenderNavigationItems(prefix, renderContext, navigationRenderer, child, ctx);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.IO.Abstractions;
using Elastic.ApiExplorer.Landing;
using Elastic.Documentation.Extensions;
using Elastic.Documentation.Site.Navigation;
using Elastic.Documentation.Navigation;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using RazorSlices;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Text.RegularExpressions;
using Elastic.Documentation.Extensions;
using YamlDotNet.Serialization;
using YamlStaticContext = Elastic.Documentation.Configuration.Serialization.YamlStaticContext;

namespace Elastic.Documentation.Configuration.Assembler;

Expand Down
7 changes: 7 additions & 0 deletions src/Elastic.Documentation.Configuration/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Reflection;
using Elastic.Documentation.Configuration.Assembler;
using Elastic.Documentation.Configuration.Builder;
using Elastic.Documentation.Configuration.DocSet;
using Elastic.Documentation.Configuration.LegacyUrlMappings;
using Elastic.Documentation.Configuration.Products;
using Elastic.Documentation.Configuration.Versions;
Expand All @@ -28,6 +29,8 @@ public record BuildContext : IDocumentationSetContext, IDocumentationConfigurati

public ConfigurationFile Configuration { get; }

public DocumentationSetFile ConfigurationYaml { get; set; }

public VersionsConfiguration VersionsConfiguration { get; }
public ConfigurationFileProvider ConfigurationFileProvider { get; }
public DocumentationEndpoints Endpoints { get; }
Expand Down Expand Up @@ -108,9 +111,13 @@ public BuildContext(

Git = gitCheckoutInformation ?? GitCheckoutInformation.Create(DocumentationCheckoutDirectory, ReadFileSystem);
Configuration = new ConfigurationFile(this, VersionsConfiguration, ProductsConfiguration);

var yaml = readFileSystem.File.ReadAllText(Configuration.SourceFile.FullName);
ConfigurationYaml = DocumentationSetFile.Deserialize(yaml);
GoogleTagManager = new GoogleTagManagerConfiguration
{
Enabled = false
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public record ConfigurationFile : ITableOfContentsScope

public HashSet<Product> Products { get; } = [];

public HashSet<string> ImplicitFolders { get; } = new(StringComparer.OrdinalIgnoreCase);

public Glob[] Globs { get; } = [];

private readonly Dictionary<string, string> _substitutions = new(StringComparer.OrdinalIgnoreCase);
public IReadOnlyDictionary<string, string> Substitutions => _substitutions;

Expand Down Expand Up @@ -195,8 +191,6 @@ public ConfigurationFile(IDocumentationSetContext context, VersionsConfiguration
reader.EmitError("Could not load docset.yml", e);
throw;
}

Globs = [.. ImplicitFolders.Select(f => Glob.Parse($"{f}{Path.DirectorySeparatorChar}*.md"))];
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,7 @@ file is null && crossLink is null && folder is null && toc is null &&
}

if (folder is not null)
{
if (children is null)
_ = _configuration.ImplicitFolders.Add(parentPath.TrimStart(Path.DirectorySeparatorChar));

return [new FolderReference(this, $"{parentPath}".TrimStart(Path.DirectorySeparatorChar), children ?? [])];
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO.Abstractions;
using System.Text.RegularExpressions;
using Elastic.Documentation.Configuration.Assembler;
using Elastic.Documentation.Configuration.DocSet;
using Elastic.Documentation.Configuration.Serialization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand All @@ -21,6 +22,10 @@ public partial class ConfigurationFileProvider

internal static IDeserializer Deserializer { get; } = new StaticDeserializerBuilder(new YamlStaticContext())
.WithNamingConvention(UnderscoredNamingConvention.Instance)
.WithTypeConverter(new TocItemCollectionYamlConverter())
.WithTypeConverter(new TocItemYamlConverter())
.WithTypeConverter(new SiteTableOfContentsCollectionYamlConverter())
.WithTypeConverter(new SiteTableOfContentsRefYamlConverter())
.Build();

public ConfigurationSource ConfigurationSource { get; }
Expand Down
Loading
Loading