Skip to content

[Changelog] Fix missing links in changelog directive and render command#3228

Merged
lcawl merged 11 commits intomainfrom
changelog-missing-links
May 4, 2026
Merged

[Changelog] Fix missing links in changelog directive and render command#3228
lcawl merged 11 commits intomainfrom
changelog-missing-links

Conversation

@lcawl
Copy link
Copy Markdown
Contributor

@lcawl lcawl commented May 2, 2026

Problem

The changelog directive currently outputs incomplete phrases when the only links or issues are private (sanitized) links.

This would seem to be a regression due to changes in our method for sanitizing links, because I don't remember seeing this in earlier tests.

Expected behavior

If there are no public links, the phrase should be omitted.

Screenshots

Image

Solution

  1. Fix the rendering such that if there are no public links, the "For more information..." text is omitted.
  2. Add a new option to turn off dropdowns, since for private repos like this there's nothing to warrant that specialized formatting. Maybe we'll remove that formatting entirely in subsequent PRs, but for now this option lets team configure their preference to align with existing pages.

AI implementation summary

Main Feature: :dropdowns: Option for Changelog Directive

Problem Solved: When using :description-visibility: auto/hide-descriptions, separated types (breaking changes, deprecations, known issues, highlights) would render as empty clickable dropdown shells, creating poor UX.

(Note, this problem occurs with or without that description-visibility option, but there were enough dependencies to warrant stacking the PRs).

Solution: Added a new :dropdowns: directive option that controls rendering behavior for separated types.

Key Changes

1. New Directive Option Implementation

  • File: src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs
  • Added DropdownsEnabled property using PropBool("dropdowns")
  • Follows existing patterns (like :subsections:) where omission = false, presence = true
  • Default behavior: Separated types render as flattened bulleted lists
  • With :dropdowns:: Separated types render as Myst dropdown sections

2. Rendering Logic Updates

  • File: src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs
  • Added RenderDetailedEntriesFlattened() and RenderDetailedEntryFlattened() methods
  • Branched all separated type rendering paths (breaking changes, deprecations, known issues, highlights) between dropdown vs flattened rendering
  • Flattened renderer uses same styling as regular entries (no bold titles) with Impact: and Action: sections properly formatted
  • Fixed link rendering in flattened mode to include PR/issue links inline

3. Private Links Bug Fix

  • Files: src/Elastic.Documentation/ReleaseNotes/ChangelogTextUtilities.cs, ChangelogInlineRenderer.cs
  • Fixed rendering issues with private repository links in changelog entries
  • Improved link visibility detection and formatting

4. Comprehensive Test Coverage

  • New file: tests/Elastic.Markdown.Tests/Directives/ChangelogDropdownsTests.cs
  • Added tests for default behavior (flattened), explicit dropdown behavior, interaction with :description-visibility:, and mixed type scenarios
  • Updated existing tests: Added :dropdowns: and :description-visibility: keep-descriptions to maintain backward compatibility in ChangelogPrivateLinkBugTests.cs and ChangelogHideLinksTests.cs

5. Bug Fixes

  • Fixed incorrect bold formatting in flattened renderer titles (should match regular entry styling)
  • Ensured Impact/Action sections render correctly in both modes

Behavior Summary

Scenario Rendering
Default (no :dropdowns:) Separated types → flattened bulleted lists
With :dropdowns: Separated types → Myst dropdown sections
Regular types Unchanged (always bulleted lists)

Breaking Change

  • Impact: Teams currently relying on implicit dropdown rendering for separated types
  • Mitigation: Add explicit :dropdowns: to maintain current behavior
  • Scope: Limited impact (only 2 teams currently using the tooling)

Files Modified

  • src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs
  • src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs
  • src/Elastic.Documentation/ReleaseNotes/ChangelogTextUtilities.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogDropdownsTests.cs (new)
  • tests/Elastic.Markdown.Tests/Directives/ChangelogPrivateLinkBugTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogHideLinksTests.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/PrivateLinkBugTests.cs
  • tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/ChangelogTextUtilitiesTests.cs

Note: Documentation update for docs/syntax/changelog.md still pending to document the new :dropdowns: option.

Testing

  1. I verified that it works for pages that want dropdowns, for example, in a kibana deprecations.md file like this:

    :::{changelog} /releases/kibana
    :subsections:
    :type: deprecation
    :dropdowns:
    :descriptions-visibility: keep-descriptions
    :::

    It renders the same as current Kibana pages:
    image

  2. I also verified that it works for pages that don't want dropdowns, for example, in a private repo where we're using the default options (i.e. no dropdowns or descriptions-visibility set), it shows a nice plain bulleted list now:

    image

    Ditto for breaking changes:

    image

    ... and known issues:

    image
  3. I confirmed that the missing links no longer appear in the "changelog render" command output, though it means there are some empty dropdowns possible. This will be pursued in a follow-up PR.

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 added the fix label May 2, 2026
@lcawl lcawl marked this pull request as ready for review May 2, 2026 03:41
@lcawl lcawl requested a review from a team as a code owner May 2, 2026 03:41
@lcawl lcawl requested a review from cotti May 2, 2026 03:41
cotti and others added 2 commits May 4, 2026 13:16
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs
#	src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs
Adds the option row, details subsection, and updates the section-types
table and record-descriptions note to reflect that separated types
render as flattened bullets by default and require :dropdowns: to keep
the previous expandable layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cotti cotti requested a review from a team as a code owner May 4, 2026 16:25
Base automatically changed from changelog-descriptions to main May 4, 2026 16:28
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

📝 Walkthrough

Walkthrough

The PR adds a new :dropdowns: option to the {changelog} directive that toggles rendering of "separated" entry types (breaking changes, deprecations, known issues, highlights) between flattened bulleted lists (default) and expandable Myst dropdowns. A DropdownsEnabled property was added to ChangelogBlock; ChangelogInlineRenderer now accepts and branches on this flag, adding flattened-render helpers. A new utility ChangelogTextUtilities.HasVisibleLinks centralizes link-visibility checks. Documentation and tests were updated to cover both rendering modes and private/public link edge cases.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ChangelogBlock
  participant ChangelogInlineRenderer
  participant ChangelogTextUtilities
  participant FileSystem/Output

  User->>ChangelogBlock: invoke {changelog} directive (options include :dropdowns:)
  ChangelogBlock->>ChangelogBlock: parse options -> set DropdownsEnabled
  ChangelogBlock->>ChangelogInlineRenderer: call RenderChangelogMarkdown(bundle, DropdownsEnabled, ...)
  ChangelogInlineRenderer->>ChangelogInlineRenderer: RenderSingleBundle -> GenerateMarkdown
  alt dropdownsEnabled == true
    ChangelogInlineRenderer->>ChangelogInlineRenderer: RenderDetailedEntries (dropdown syntax)
  else dropdownsEnabled == false
    ChangelogInlineRenderer->>ChangelogInlineRenderer: RenderDetailedEntriesFlattened (bulleted layout)
  end
  ChangelogInlineRenderer->>ChangelogTextUtilities: HasVisibleLinks(entry, repo, hidePrivateLinks, owner)
  ChangelogTextUtilities-->>ChangelogInlineRenderer: boolean (visible links?)
  ChangelogInlineRenderer->>FileSystem/Output: write generated markdown/html files
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.44% 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 accurately summarizes the main changes: fixing missing/incomplete links in the changelog directive and adding the render command capability.
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 explains the problems being solved: incomplete phrases when only private links exist, and the need for a :dropdowns: option to control rendering. It details the implementation approach, testing verification, and files modified.

✏️ 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-missing-links

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/syntax/changelog.md (1)

123-145: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix the #dropdowns fragment target.

The new intra-page links point at #dropdowns, but #### \:dropdowns:` [dropdowns]` does not create that fragment, and markdownlint is already flagging MD051 here. Those links will ship broken.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/syntax/changelog.md` around lines 123 - 145, The intra-page link target
"#dropdowns" is missing because the heading "#### `:dropdowns:` [dropdowns]"
does not generate that fragment (MD051); update the heading to supply an
explicit fragment so links work — e.g. replace the heading "#### `:dropdowns:`
[dropdowns]" with one that defines the anchor (such as "#### `:dropdowns:`
{`#dropdowns`}" or add an explicit HTML anchor like "<a id=\"dropdowns\"></a>"
immediately before the "#### `:dropdowns:`" heading) so the "#dropdowns" links
resolve correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs`:
- Around line 463-488: RenderDetailedEntriesFlattened currently groups entries
by subtype but never emits the subtype header when groupBySubtype is true,
causing different subtypes to be collapsed; update
RenderDetailedEntriesFlattened to write a subtype heading for each group before
iterating its entries (use the group's Key for the label) and then call
RenderDetailedEntryFlattened for each entry; reference the
RenderDetailedEntriesFlattened method and ensure the heading output format
matches other render paths (the same markup used elsewhere for subtype headings
or the helper used by RenderDetailedEntries) so flattened output preserves
subtype labels.
- Around line 490-523: RenderDetailedEntryFlattened currently prefixes
description/impact/action with only a single "  " so embedded newlines break the
list; before appending entry.Description, entry.Impact and entry.Action (and
only when the corresponding checks pass, e.g. !hideEntryDescriptions and not
null/whitespace), call ChangelogTextUtilities.Indent(...) on each value to
produce a properly-indented multi-line block and append that result (instead of
the raw property) so every line keeps the bullet indentation; update the three
places that append those fields in RenderDetailedEntryFlattened to use the
indented text.
- Around line 525-552: GetLinksText is stripping out formatted links that begin
with '%' (commented-out links produced by
ChangelogTextUtilities.FormatPrLink/FormatIssueLink when hideLinks is true), so
the flattened renderer drops all PR/issue references; remove the StartsWith('%')
filter in GetLinksText (i.e., add non-empty formatted values to linksParts
regardless of a leading '%') so commented links are preserved in the output,
leaving HasVisibleLinks logic unchanged and ensuring linksParts and the final
$"[{string.Join(", ", linksParts)}]" continue to work.

---

Outside diff comments:
In `@docs/syntax/changelog.md`:
- Around line 123-145: The intra-page link target "#dropdowns" is missing
because the heading "#### `:dropdowns:` [dropdowns]" does not generate that
fragment (MD051); update the heading to supply an explicit fragment so links
work — e.g. replace the heading "#### `:dropdowns:` [dropdowns]" with one that
defines the anchor (such as "#### `:dropdowns:` {`#dropdowns`}" or add an explicit
HTML anchor like "<a id=\"dropdowns\"></a>" immediately before the "####
`:dropdowns:`" heading) so the "#dropdowns" links resolve correctly.
🪄 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: 3373137b-a46d-452e-9c2f-e99a64ebd0a1

📥 Commits

Reviewing files that changed from the base of the PR and between 914d54b and ba5d1dd.

📒 Files selected for processing (9)
  • docs/syntax/changelog.md
  • src/Elastic.Documentation/ReleaseNotes/ChangelogTextUtilities.cs
  • src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs
  • src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/PrivateLinkBugTests.cs
  • tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/ChangelogTextUtilitiesTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogDropdownsTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogHideLinksTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogPrivateLinkBugTests.cs

@lcawl lcawl merged commit b4f6a94 into main May 4, 2026
24 checks passed
@lcawl lcawl deleted the changelog-missing-links branch May 4, 2026 21:40
@lcawl lcawl mentioned this pull request May 4, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants