Skip to content

Commit d88a8ce

Browse files
committed
Fix list indentation
1 parent bffc918 commit d88a8ce

6 files changed

Lines changed: 45 additions & 45 deletions

File tree

src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ public override async Task RenderAsync(ChangelogRenderContext context, Cancel ct
9898
_ = sb.AppendLine();
9999
}
100100

101-
// PR/Issue links with "For more information" pattern
102-
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks);
101+
// PR/Issue links with "For more information" pattern - indented for list continuation
102+
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks, indentForListItem: true);
103103

104-
// Impact and Action sections
104+
// Impact and Action sections - indented for list continuation
105105
if (!string.IsNullOrWhiteSpace(entry.Impact))
106106
{
107-
_ = sb.AppendLine("**Impact:** " + entry.Impact);
107+
_ = sb.AppendLine(ChangelogTextUtilities.Indent("**Impact:** " + entry.Impact));
108108
_ = sb.AppendLine();
109109
}
110110

111111
if (!string.IsNullOrWhiteSpace(entry.Action))
112112
{
113-
_ = sb.AppendLine("**Action:** " + entry.Action);
113+
_ = sb.AppendLine(ChangelogTextUtilities.Indent("**Action:** " + entry.Action));
114114
_ = sb.AppendLine();
115115
}
116116
}

src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ public override async Task RenderAsync(ChangelogRenderContext context, Cancel ct
9595
_ = sb.AppendLine();
9696
}
9797

98-
// PR/Issue links with "For more information" pattern
99-
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks);
98+
// PR/Issue links with "For more information" pattern - indented for list continuation
99+
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks, indentForListItem: true);
100100

101-
// Impact and Action sections
101+
// Impact and Action sections - indented for list continuation
102102
if (!string.IsNullOrWhiteSpace(entry.Impact))
103103
{
104-
_ = sb.AppendLine("**Impact:** " + entry.Impact);
104+
_ = sb.AppendLine(ChangelogTextUtilities.Indent("**Impact:** " + entry.Impact));
105105
_ = sb.AppendLine();
106106
}
107107

108108
if (!string.IsNullOrWhiteSpace(entry.Action))
109109
{
110-
_ = sb.AppendLine("**Action:** " + entry.Action);
110+
_ = sb.AppendLine(ChangelogTextUtilities.Indent("**Action:** " + entry.Action));
111111
_ = sb.AppendLine();
112112
}
113113
}

src/services/Elastic.Changelog/Rendering/Markdown/HighlightsMarkdownRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public override async Task RenderAsync(ChangelogRenderContext context, Cancel ct
8787
_ = sb.AppendLine();
8888
}
8989

90-
// PR/Issue links with "For more information" pattern
91-
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks);
90+
// PR/Issue links with "For more information" pattern - indented for list continuation
91+
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks, indentForListItem: true);
9292
}
9393

9494
if (shouldHide)

src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ public override async Task RenderAsync(ChangelogRenderContext context, Cancel ct
9595
_ = sb.AppendLine();
9696
}
9797

98-
// PR/Issue links with "For more information" pattern
99-
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks);
98+
// PR/Issue links with "For more information" pattern - indented for list continuation
99+
RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks, indentForListItem: true);
100100

101-
// Impact and Action sections
101+
// Impact and Action sections - indented for list continuation
102102
if (!string.IsNullOrWhiteSpace(entry.Impact))
103103
{
104-
_ = sb.AppendLine("**Impact:** " + entry.Impact);
104+
_ = sb.AppendLine(ChangelogTextUtilities.Indent("**Impact:** " + entry.Impact));
105105
_ = sb.AppendLine();
106106
}
107107

108108
if (!string.IsNullOrWhiteSpace(entry.Action))
109109
{
110-
_ = sb.AppendLine("**Action:** " + entry.Action);
110+
_ = sb.AppendLine(ChangelogTextUtilities.Indent("**Action:** " + entry.Action));
111111
_ = sb.AppendLine();
112112
}
113113
}

src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ protected async Task WriteOutputFileAsync(string outputDir, string titleSlug, st
4040
/// Renders PR and issue links for dropdown entries
4141
/// </summary>
4242
protected static void RenderPrIssueLinks(StringBuilder sb, ChangelogEntry entry, string entryRepo, string entryOwner, bool entryHideLinks)
43+
=> RenderPrIssueLinks(sb, entry, entryRepo, entryOwner, entryHideLinks, indentForListItem: false);
44+
45+
/// <summary>
46+
/// Renders PR and issue links with optional indentation for flattened list items
47+
/// </summary>
48+
protected static void RenderPrIssueLinks(StringBuilder sb, ChangelogEntry entry, string entryRepo, string entryOwner, bool entryHideLinks, bool indentForListItem)
4349
{
4450
var prParts = new List<string>();
4551
foreach (var pr in entry.Prs ?? [])
@@ -62,34 +68,28 @@ protected static void RenderPrIssueLinks(StringBuilder sb, ChangelogEntry entry,
6268

6369
if (entryHideLinks)
6470
{
65-
foreach (var s in prParts)
66-
_ = sb.AppendLine(s);
67-
foreach (var s in issueParts)
68-
_ = sb.AppendLine(s);
69-
70-
_ = sb.AppendLine("For more information, check the pull request or issue above.");
71-
}
72-
else
73-
{
74-
_ = sb.Append("For more information, check ");
75-
var first = true;
7671
foreach (var s in prParts)
7772
{
78-
if (!first)
79-
_ = sb.Append(' ');
80-
_ = sb.Append(s);
81-
first = false;
73+
var line = indentForListItem ? ChangelogTextUtilities.Indent(s) : s;
74+
_ = sb.AppendLine(line);
8275
}
83-
8476
foreach (var s in issueParts)
8577
{
86-
if (!first)
87-
_ = sb.Append(' ');
88-
_ = sb.Append(s);
89-
first = false;
78+
var line = indentForListItem ? ChangelogTextUtilities.Indent(s) : s;
79+
_ = sb.AppendLine(line);
9080
}
9181

92-
_ = sb.AppendLine(".");
82+
var infoLine = "For more information, check the pull request or issue above.";
83+
_ = sb.AppendLine(indentForListItem ? ChangelogTextUtilities.Indent(infoLine) : infoLine);
84+
}
85+
else
86+
{
87+
var lineParts = new List<string> { "For more information, check" };
88+
lineParts.AddRange(prParts);
89+
lineParts.AddRange(issueParts);
90+
91+
var fullLine = string.Join(" ", lineParts) + ".";
92+
_ = sb.AppendLine(indentForListItem ? ChangelogTextUtilities.Indent(fullLine) : fullLine);
9393
}
9494

9595
_ = sb.AppendLine();

tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ public async Task RenderChangelogs_WithDropdownsFalse_RendersFlattendFormat()
155155
// Verify flattened format
156156
content.Should().Contain("* Deprecated old API");
157157
content.Should().Contain("The old API is deprecated");
158-
content.Should().Contain("For more information, check");
158+
content.Should().Contain(" For more information, check"); // Indented for list continuation
159159
content.Should().Contain("#456");
160160
content.Should().Contain("#789");
161-
content.Should().Contain("**Impact:** API will be removed in future version");
162-
content.Should().Contain("**Action:** Migrate to the new API");
161+
content.Should().Contain(" **Impact:** API will be removed in future version"); // Indented for list continuation
162+
content.Should().Contain(" **Action:** Migrate to the new API"); // Indented for list continuation
163163

164164
// Should NOT contain dropdown syntax
165165
content.Should().NotContain("::::{dropdown}");
@@ -234,10 +234,10 @@ public async Task RenderChangelogs_DefaultDropdownsFalse_RendersFlattedFormat()
234234
// Verify flattened format (default behavior)
235235
content.Should().Contain("* Known issue with search");
236236
content.Should().Contain("Search results are incomplete under certain conditions");
237-
content.Should().Contain("For more information, check");
237+
content.Should().Contain(" For more information, check"); // Indented for list continuation
238238
content.Should().Contain("#999");
239-
content.Should().Contain("**Impact:** Some search results may be missing");
240-
content.Should().Contain("**Action:** Use the workaround provided in the documentation");
239+
content.Should().Contain(" **Impact:** Some search results may be missing"); // Indented for list continuation
240+
content.Should().Contain(" **Action:** Use the workaround provided in the documentation"); // Indented for list continuation
241241

242242
// Should NOT contain dropdown syntax
243243
content.Should().NotContain("::::{dropdown}");
@@ -331,7 +331,7 @@ public async Task RenderChangelogs_HighlightsWithDropdowns_RendersCorrectFormat(
331331
// Verify flattened format
332332
content.Should().Contain("* Amazing new feature");
333333
content.Should().Contain("This feature revolutionizes how you work with data");
334-
content.Should().Contain("For more information, check");
334+
content.Should().Contain(" For more information, check"); // Indented for list continuation
335335
content.Should().Contain("#555");
336336

337337
// Should NOT contain dropdown syntax

0 commit comments

Comments
 (0)