Skip to content

Add changelog render --dropdowns#3244

Open
lcawl wants to merge 6 commits intomainfrom
changelog-render-dropdowns
Open

Add changelog render --dropdowns#3244
lcawl wants to merge 6 commits intomainfrom
changelog-render-dropdowns

Conversation

@lcawl
Copy link
Copy Markdown
Contributor

@lcawl lcawl commented May 4, 2026

This PR relates to #3228

In particular, it adds the ability to turn off dropdowns in the "changelog render" output, same as in the changelog directive.

Summary

Users can now use --dropdowns to render separated types (breaking changes, deprecations, known issues, highlights) as MyST dropdowns, or omit the flag for the new default flattened bulleted list format.

Reviewer notes

AI implementation details

All functionality has been successfully implemented according to the plan:

🔹 CLI Command: Added --dropdowns parameter with false default
🔹 Service Layer: Extended with Dropdowns property throughout the rendering pipeline
🔹 All Renderers: Updated to support both dropdown and flattened modes
🔹 Documentation: Added comprehensive CLI documentation
🔹 Tests: Created full test coverage for both rendering modes

There was also an issue with the way content was rendered in the non-dropdown mode when the bulleted item spanned multiple paragraphs. The output is now fixed to work as described in https://elastic.github.io/docs-builder/syntax/lists/#content-within-a-list-item:

Before (broken):

* Show callout for deprecated (in-use) ILM policies.
  The logs, metrics, and synthetics ILM policies have been deprecated...

For more information, check [#243416](https://github.com/elastic/kibana/pull/243416).

After (fixed):

* Show callout for deprecated (in-use) ILM policies.
  The logs, metrics, and synthetics ILM policies have been deprecated...
   
  For more information, check [#243416](https://github.com/elastic/kibana/pull/243416).

Tests

I tested with some made-up changelogs in the kibana repo as follows:

  1. Create some breaking change and deprecation changelogs with some description, impact, and action fields.
  2. Create a bundle.
  3. Run the "changelog render" command with the new --dropdowns option, for example:
    docs-builder changelog render \
    --input ./docs/releases/kibana/changelog-bundle.yaml \
    --file-type markdown \
    --output ./docs/release-notes/_snippets \
    --dropdowns
  4. Preview the output and confirm that the dropdowns look good. For example:
    image
  5. Re-run the command but omit the --dropdowns command option. Preview and verify that it's properly formatted:
    image

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes
  • No
  1. If you answered "Yes" to the previous question, please specify the tool(s) and model(s) used (e.g., Google Gemini, OpenAI ChatGPT-4, etc.).

Tool(s) and model(s) used: composer-2, claude-4-sonnet-thinking

@lcawl lcawl marked this pull request as ready for review May 6, 2026 21:52
@lcawl lcawl requested review from a team as code owners May 6, 2026 21:52
@lcawl lcawl requested a review from cotti May 6, 2026 21:52
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

📝 Walkthrough

Walkthrough

This PR adds a new --dropdowns CLI option that enables conditional rendering of changelog entries as MyST dropdowns. When enabled, the feature passes a Dropdowns boolean flag through the rendering pipeline—from the CLI command through ChangelogRenderingService into ChangelogRenderContext—which is then used by individual Markdown renderers (BreakingChangesMarkdownRenderer, DeprecationsMarkdownRenderer, HighlightsMarkdownRenderer, KnownIssuesMarkdownRenderer) to choose between dropdown-style or flattened bullet-point output. Supporting this required extending MarkdownRendererBase to provide indentation control for PR/Issue links in flattened mode, and documentation and tests were added to demonstrate the feature behavior.

Sequence Diagram

sequenceDiagram
    participant User
    participant ChangelogCommand
    participant ChangelogRenderingService
    participant RenderContext as ChangelogRenderContext
    participant MarkdownRenderers
    participant Output

    User->>ChangelogCommand: Execute CLI with --dropdowns flag
    ChangelogCommand->>ChangelogCommand: Parse dropdowns parameter
    ChangelogCommand->>ChangelogRenderingService: RenderChangelogsArguments(dropdowns=true/false)
    
    ChangelogRenderingService->>ChangelogRenderingService: SetupOutput() processes title/slug
    ChangelogRenderingService->>RenderContext: Initialize with Dropdowns property
    
    alt Dropdowns = true
        ChangelogRenderingService->>MarkdownRenderers: Render each entry type
        MarkdownRenderers->>MarkdownRenderers: Check context.Dropdowns
        MarkdownRenderers->>MarkdownRenderers: Render as dropdown blocks
        MarkdownRenderers->>Output: MyST dropdown syntax
    else Dropdowns = false
        ChangelogRenderingService->>MarkdownRenderers: Render each entry type
        MarkdownRenderers->>MarkdownRenderers: Check context.Dropdowns
        MarkdownRenderers->>MarkdownRenderers: Render as flattened bullets
        MarkdownRenderers->>Output: Flattened Markdown format
    end
    
    Output->>User: Rendered changelog (dropdown or flat)
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add changelog render --dropdowns' directly and clearly summarizes the main change: adding a new CLI option to control changelog rendering format.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly relates to the changeset, documenting the new --dropdowns CLI flag, implementation details, rendering changes across multiple files, and testing approach.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch changelog-render-dropdowns

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs (1)

42-48: ⚡ Quick win

Consider folding the parameters into a small record.

Both overloads now exceed the 4-parameter cap, and call sites pass entryHideLinks positionally next to a second bool indentForListItem. A small PrIssueLinkOptions(ChangelogEntry Entry, string Repo, string Owner, bool HideLinks, bool IndentForListItem) would collapse this to RenderPrIssueLinks(sb, options) and remove the bool-adjacency at call sites.

As per coding guidelines: "Method parameters should not exceed 4 in count. Use a record or options object for methods that require more than 4 parameters. Boolean parameters must be named at call sites."

🤖 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/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs`
around lines 42 - 48, The RenderPrIssueLinks overloads exceed the 4-parameter
guideline and pass two adjacent bools positionally; create a small record (e.g.,
PrIssueLinkOptions with properties ChangelogEntry Entry, string Repo, string
Owner, bool HideLinks, bool IndentForListItem) and change both method signatures
to RenderPrIssueLinks(StringBuilder sb, PrIssueLinkOptions options); update
internal references inside MarkdownRendererBase to use options.* and update all
call sites to pass a named PrIssueLinkOptions instance (ensuring bools are named
via properties) so callers become RenderPrIssueLinks(sb, new PrIssueLinkOptions
{ Entry = entry, Repo = entryRepo, Owner = entryOwner, HideLinks =
entryHideLinks, IndentForListItem = indentForListItem }); ensure overload
forwarding is removed or adjusted accordingly.
🤖 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 `@tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs`:
- Around line 419-422: The test asserts AsciiDoc uses unconstrained strong
markers (“**Impact:**”, “**Action:**”) which is non-idiomatic; update the
DropdownRenderTests.cs assertions to expect idiomatic constrained strong markers
("*Impact:*", "*Action:*") or make the assertions tolerant (e.g., regex or
alternatives) to accept either single- or double-asterisk forms so the test
stays valid if AsciidocRendererBase.cs (where the renderer currently emits
"**Impact:**" / "**Action:**" around lines 91 and 97) is changed to emit the
idiomatic single-asterisk format.

---

Nitpick comments:
In `@src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs`:
- Around line 42-48: The RenderPrIssueLinks overloads exceed the 4-parameter
guideline and pass two adjacent bools positionally; create a small record (e.g.,
PrIssueLinkOptions with properties ChangelogEntry Entry, string Repo, string
Owner, bool HideLinks, bool IndentForListItem) and change both method signatures
to RenderPrIssueLinks(StringBuilder sb, PrIssueLinkOptions options); update
internal references inside MarkdownRendererBase to use options.* and update all
call sites to pass a named PrIssueLinkOptions instance (ensuring bools are named
via properties) so callers become RenderPrIssueLinks(sb, new PrIssueLinkOptions
{ Entry = entry, Repo = entryRepo, Owner = entryOwner, HideLinks =
entryHideLinks, IndentForListItem = indentForListItem }); ensure overload
forwarding is removed or adjusted accordingly.
🪄 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: 0d9d1f38-3e96-48e5-a1c5-c0755a97fcaa

📥 Commits

Reviewing files that changed from the base of the PR and between 9e5d1f3 and e3268b2.

📒 Files selected for processing (11)
  • docs/cli/changelog/render.md
  • src/services/Elastic.Changelog/Rendering/ChangelogRenderContext.cs
  • src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/HighlightsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs
  • src/tooling/docs-builder/Commands/ChangelogCommand.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/TitleTargetTests.cs

Comment on lines +419 to +422
// AsciiDoc should always use bullet format regardless of dropdowns flag
content.Should().Contain("* Breaking API change");
content.Should().Contain("**Impact:** Existing API calls will fail");
content.Should().Contain("**Action:** Update your code");
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot May 6, 2026

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the AsciiDoc renderer for breaking changes
rg -n --type=cs -C5 "Impact|Action" --iglob "*Asciidoc*"
rg -n --type=cs -C5 "Impact|Action" --iglob "*AsciiDoc*"
rg -n --type=cs -C5 "\*\*Impact\|\\*Impact"

Repository: elastic/docs-builder

Length of output: 21526


The test assertions are correct but validate non-idiomatic AsciiDoc formatting.

The renderer at AsciidocRendererBase.cs lines 91 and 97 deliberately emits **Impact:** and **Action:** (double asterisks). The test correctly verifies this output. However, AsciiDoc best practice for standalone words/phrases with surrounding space is constrained strong (*Impact:* with single asterisks), not unconstrained (**Impact:**). The test assertions would need updating if the renderer is fixed to use idiomatic AsciiDoc formatting, but the test logic itself is sound.

🤖 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 `@tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs`
around lines 419 - 422, The test asserts AsciiDoc uses unconstrained strong
markers (“**Impact:**”, “**Action:**”) which is non-idiomatic; update the
DropdownRenderTests.cs assertions to expect idiomatic constrained strong markers
("*Impact:*", "*Action:*") or make the assertions tolerant (e.g., regex or
alternatives) to accept either single- or double-asterisk forms so the test
stays valid if AsciidocRendererBase.cs (where the renderer currently emits
"**Impact:**" / "**Action:**" around lines 91 and 97) is changed to emit the
idiomatic single-asterisk format.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am implementing the Asciidoc-specific fixes in a subsequent PR.

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.

@lcawl Understood, thanks for the heads-up. I'll keep an eye out for the follow-up PR addressing the AsciiDoc renderer formatting.

( - ω -)~♪

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I created #3262

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.

@lcawl Thanks for the link! I'll pick up the review of the AsciiDoc formatting fixes in #3262.

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.

1 participant