Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion docs/cli-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4500,7 +4500,7 @@
"shortName": null,
"type": "string",
"required": false,
"summary": "Optional: Output file type. Valid values: \u0022markdown\u0022 or \u0022asciidoc\u0022. Defaults to \u0022markdown\u0022",
"summary": "Optional: Output file type. Valid values: \u0022markdown\u0022, \u0022asciidoc\u0022, or \u0022gfm\u0022. Defaults to \u0022markdown\u0022",
"defaultValue": "markdown"
},
{
Expand Down Expand Up @@ -4539,6 +4539,15 @@
"summary": "Optional: Render separated types (breaking changes, deprecations, known issues, highlights) as MyST dropdowns. When false (default), renders as flattened bulleted lists. Defaults to false",
"defaultValue": "false"
},
{
"role": "flag",
"name": "no-descriptions",
"shortName": null,
"type": "boolean",
"required": false,
"summary": "Optional: Hide changelog record descriptions from output. When enabled, entry titles, PR/issue links, Impact and Action sections remain visible. Bundle-level descriptions are unaffected. Defaults to false",
"defaultValue": "false"
},
{
"role": "flag",
"name": "title",
Expand Down
35 changes: 34 additions & 1 deletion docs/cli/changelog/cmd-render.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,33 @@ AsciiDoc output ignores the `--dropdowns` flag and always uses a standardized fo
- Strong text formatting uses idiomatic single asterisk syntax (`*Impact:*`, `*Action:*`) following AsciiDoc best practices
- All content blocks are properly attached to their parent list items for correct rendering.

### GFM format

When `--file-type gfm` is specified, the command generates a single GitHub Flavored Markdown file optimized for GitHub releases:

- `changelog.md` - Contains all sections in a single file with clean headings
- Clean section headings without anchor links (for example, `### Features and enhancements`)
- Simplified structure focused on readability
- Suitable for copy/pasting into GitHub releases

The GFM output includes the following sections in order when entries are present:

- Highlights (only included when at least one entry has `highlight: true`)
- Features and enhancements
- Breaking changes
- Deprecations
- Bug fixes (includes security updates)
- Known issues
- Documentation
- Regressions
- Other changes

AsciiDoc output ignores the `--dropdowns` flag and always uses a standardized format with the following characteristics:

- Multi-block entries (containing description, Impact, and Action sections) use proper list continuation markers (`+`) to maintain list structure
- Strong text formatting uses idiomatic single asterisk syntax (`*Impact:*`, `*Action:*`) following AsciiDoc best practices
- All content blocks are properly attached to their parent list items for correct rendering

### Multiple PR and issue links

Changelog entries can reference multiple pull requests and issues via the `prs` and `issues` array fields. All links are rendered inline:
Expand All @@ -66,7 +93,7 @@ Changelog entries can reference multiple pull requests and issues via the `prs`
# Render a single bundle
docs-builder changelog render \
--input "./docs/changelog/bundles/9.3.0.yaml" \
--output ./release-notes
--output ./release-notes \

# Render with explicit changelog dir and repo
docs-builder changelog render \
Expand Down Expand Up @@ -94,4 +121,10 @@ docs-builder changelog render \
--input "./docs/changelog/bundles/9.3.0.yaml" \
--output ./release-notes \
--dropdowns

# Render as GitHub Flavored Markdown
docs-builder changelog render \
--input "./docs/changelog/bundles/9.3.0.yaml" \
--output ./release-notes \
--file-type gfm
```
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ private static void RenderEntryTitleAndLinks(StringBuilder sb, ChangelogEntry en
/// <summary>
/// Renders an entry's description with optional comment handling and list continuation
/// </summary>
private static void RenderEntryDescription(StringBuilder sb, ChangelogEntry entry, bool shouldHide, bool needsContinuation = true)
private static void RenderEntryDescription(StringBuilder sb, ChangelogEntry entry, ChangelogRenderContext context, bool shouldHide, bool needsContinuation = true)
{
if (string.IsNullOrWhiteSpace(entry.Description))
if (context.HideDescriptions || string.IsNullOrWhiteSpace(entry.Description))
return;

_ = sb.AppendLine();
Expand Down Expand Up @@ -113,7 +113,7 @@ protected void RenderBasicEntry(StringBuilder sb, ChangelogEntry entry, Changelo
{
var (entryRepo, _, hideLinks, shouldHide) = ChangelogRenderUtilities.GetEntryContext(entry, context);
RenderEntryTitleAndLinks(sb, entry, entryRepo, hideLinks, shouldHide);
RenderEntryDescription(sb, entry, shouldHide, needsContinuation: !string.IsNullOrWhiteSpace(entry.Description));
RenderEntryDescription(sb, entry, context, shouldHide, needsContinuation: !string.IsNullOrWhiteSpace(entry.Description));
_ = sb.AppendLine();
}

Expand All @@ -127,7 +127,7 @@ protected void RenderEntryWithImpactAction(StringBuilder sb, ChangelogEntry entr

// Description needs continuation when it exists
var hasDescription = !string.IsNullOrWhiteSpace(entry.Description);
RenderEntryDescription(sb, entry, shouldHide, needsContinuation: hasDescription);
RenderEntryDescription(sb, entry, context, shouldHide, needsContinuation: hasDescription);

RenderImpactAndAction(sb, entry);
_ = sb.AppendLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public record ChangelogRenderContext
public required IReadOnlyDictionary<ChangelogEntryType, IReadOnlyCollection<ChangelogEntry>> EntriesByType { get; init; }
public required bool Subsections { get; init; }
public required bool Dropdowns { get; init; }
public required bool HideDescriptions { get; init; }
public required HashSet<string> FeatureIdsToHide { get; init; }
public required Dictionary<ChangelogEntry, HashSet<string>> EntryToBundleProducts { get; init; }
public required Dictionary<ChangelogEntry, string> EntryToRepo { get; init; }
Expand Down
11 changes: 11 additions & 0 deletions src/services/Elastic.Changelog/Rendering/ChangelogRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public async Task RenderAsync(
await RenderMarkdownAsync(context, ctx);
break;

case ChangelogFileType.Gfm:
await RenderGfmAsync(context, ctx);
break;

default:
throw new ArgumentException($"Unknown changelog file type: {fileType}", nameof(fileType));
}
Expand All @@ -51,4 +55,11 @@ private async Task RenderMarkdownAsync(ChangelogRenderContext context, Cancel ct
await markdownRenderer.RenderAsync(context, ctx);
logger.LogInformation("Rendered changelog markdown files to {OutputDir}", context.OutputDir);
}

private async Task RenderGfmAsync(ChangelogRenderContext context, Cancel ctx)
{
var gfmRenderer = new ChangelogGfmRenderer(fileSystem);
await gfmRenderer.RenderAsync(context, ctx);
logger.LogInformation("Rendered changelog GFM file to {OutputDir}", context.OutputDir);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public record RenderChangelogsArguments
public string[]? HideFeatures { get; init; }
public string? Config { get; init; }
public ChangelogFileType FileType { get; init; } = ChangelogFileType.Markdown;
public bool HideDescriptions { get; init; }

}

Expand Down Expand Up @@ -59,11 +60,14 @@ public enum ChangelogFileType
Markdown,
[Display(Name = "asciidoc")]
[JsonStringEnumMemberName("asciidoc")]
Asciidoc
Asciidoc,
[Display(Name = "gfm")]
[JsonStringEnumMemberName("gfm")]
Gfm
}

/// <summary>
/// Service for rendering changelog output (markdown or asciidoc)
/// Service for rendering changelog output (markdown, asciidoc, or gfm)
/// </summary>
public class ChangelogRenderingService(
ILoggerFactory logFactory,
Expand Down Expand Up @@ -341,6 +345,7 @@ private static ChangelogRenderContext BuildRenderContext(
EntriesByType = entriesByType,
Subsections = input.Subsections,
Dropdowns = input.Dropdowns,
HideDescriptions = input.HideDescriptions,
FeatureIdsToHide = featureIdsToHide,
EntryToBundleProducts = entryToBundleProducts,
EntryToRepo = entryToRepo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public override async Task RenderAsync(ChangelogRenderContext context, Cancel ct
{
// Dropdown rendering (current logic)
_ = sb.AppendLine(InvariantCulture, $"::::{{dropdown}} {ChangelogTextUtilities.Beautify(entry.Title)}");
_ = sb.AppendLine(entry.Description ?? "% Describe the functionality that changed");
if (!context.HideDescriptions)
_ = sb.AppendLine(entry.Description ?? "% Describe the functionality that changed");
_ = sb.AppendLine();
RenderPrIssueLinks(sb, new PrIssueLinkOptions(entry, entryRepo, entryOwner, entryHideLinks));

Expand All @@ -92,7 +93,7 @@ public override async Task RenderAsync(ChangelogRenderContext context, Cancel ct
_ = sb.AppendLine();

// Description with proper indentation
if (!string.IsNullOrWhiteSpace(entry.Description))
if (!context.HideDescriptions && !string.IsNullOrWhiteSpace(entry.Description))
{
_ = sb.AppendLine(ChangelogTextUtilities.Indent(entry.Description));
_ = sb.AppendLine();
Expand Down
Loading
Loading