Skip to content

feat(cli-reference): support title overrides#3487

Merged
theletterf merged 5 commits into
mainfrom
cli-reference-title-overrides
Jun 10, 2026
Merged

feat(cli-reference): support title overrides#3487
theletterf merged 5 commits into
mainfrom
cli-reference-title-overrides

Conversation

@theletterf

Copy link
Copy Markdown
Member

Summary

  • Adds title and navigation_title support to cli: TOC entries.
  • Uses those overrides for the generated CLI root page title and navigation label while preserving schema.name for command usage examples.
  • Documents the new keys in the CLI reference how-to.

Test plan

  • dotnet test tests/Elastic.Documentation.Configuration.Tests/Elastic.Documentation.Configuration.Tests.csproj.
  • dotnet test tests/Elastic.Markdown.Tests/Elastic.Markdown.Tests.csproj --filter FullyQualifiedName~CliMarkdownGeneratorTests.
  • dotnet build.

Made with Cursor

Allow cli TOC entries to override the generated root page title and navigation label without changing schema command names.

Co-authored-by: GPT-5.5 <gpt-5.5@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@theletterf theletterf enabled auto-merge (squash) June 10, 2026 13:06
@theletterf

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Resolve the CLI reference generator overlap by preserving supplemental frontmatter output and keeping the root title override for the generated H1.

Co-authored-by: GPT-5.5 <gpt-5.5@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@theletterf theletterf temporarily deployed to integration-tests June 10, 2026 13:22 — with GitHub Actions Inactive
coderabbitai[bot]
coderabbitai Bot previously requested changes Jun 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Elastic.Markdown/Extensions/CliReference/CliMarkdownGenerator.cs`:
- Line 17: The H1 fallback uses title ?? schema.Name which treats empty or
whitespace titles as present; change it to treat blank titles as missing by
replacing the expression with a whitespace check (e.g., use
string.IsNullOrWhiteSpace(title) ? schema.Name : title) where sb.AppendLine($"#
{title ?? schema.Name}") is called in CliMarkdownGenerator (method building the
header) so empty/whitespace title overrides fall back to schema.Name.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 755e1183-0231-4023-b713-b5740f39502b

📥 Commits

Reviewing files that changed from the base of the PR and between 7d8e36e and b495530.

📒 Files selected for processing (1)
  • src/Elastic.Markdown/Extensions/CliReference/CliMarkdownGenerator.cs

var sb = new StringBuilder();
AppendFrontMatter(sb, supplemental);
_ = sb.AppendLine($"# {schema.Name}");
_ = sb.AppendLine($"# {title ?? schema.Name}");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fallback should ignore blank title overrides.

At Line 17, title ?? schema.Name will render an empty H1 when title is "" or whitespace. Treat blank values as missing so generated pages always have a valid heading.

Suggested fix
-		_ = sb.AppendLine($"# {title ?? schema.Name}");
+		var pageTitle = string.IsNullOrWhiteSpace(title) ? schema.Name : title.Trim();
+		_ = sb.AppendLine($"# {pageTitle}");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_ = sb.AppendLine($"# {title ?? schema.Name}");
var pageTitle = string.IsNullOrWhiteSpace(title) ? schema.Name : title.Trim();
_ = sb.AppendLine($"# {pageTitle}");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Elastic.Markdown/Extensions/CliReference/CliMarkdownGenerator.cs` at line
17, The H1 fallback uses title ?? schema.Name which treats empty or whitespace
titles as present; change it to treat blank titles as missing by replacing the
expression with a whitespace check (e.g., use string.IsNullOrWhiteSpace(title) ?
schema.Name : title) where sb.AppendLine($"# {title ?? schema.Name}") is called
in CliMarkdownGenerator (method building the header) so empty/whitespace title
overrides fall back to schema.Name.

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved and pushed. Merge conflicts are fixed in commit 629708ac (now included on branch head 51b9694f).

Copilot AI temporarily deployed to integration-tests June 10, 2026 13:34 Inactive
@theletterf theletterf removed the request for review from cotti June 10, 2026 13:38
Co-authored-by: GPT-5.5 <gpt-5.5@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@theletterf theletterf temporarily deployed to integration-tests June 10, 2026 13:44 — with GitHub Actions Inactive
@elastic elastic deleted a comment from coderabbitai Bot Jun 10, 2026
@theletterf theletterf merged commit 9c4e40f into main Jun 10, 2026
25 checks passed
@theletterf theletterf deleted the cli-reference-title-overrides branch June 10, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants