Skip to content

Commit 02f9a32

Browse files
committed
feat(changelog): show commit body in PR changelog
Breaking changes show body directly since they're important. Non-breaking commits use collapsible <details> section. GitHub markdown quirks: - <details> must be on same line as list item - No empty lines inside - use <br> instead
1 parent d588439 commit 02f9a32

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/domain/changelog.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,18 @@ const TYPE_ORDER = [
4343
function formatCommit(commit: Commit, inBreakingSection = false): string {
4444
const scope = commit.scope ? `**${commit.scope}:** ` : '';
4545
// Only show breaking prefix if not already in breaking section
46-
const breaking = (commit.breaking && !inBreakingSection) ? '⚠️ BREAKING: ' : '';
46+
const breaking = commit.breaking && !inBreakingSection ? '⚠️ BREAKING: ' : '';
4747
const summary = `- ${breaking}${scope}${commit.description}`;
4848

4949
// If commit has a body, show it
5050
if (commit.body && commit.body.trim()) {
51-
// Replace blank lines with <br> for GitHub markdown compatibility
52-
const body = commit.body.trim().split(/\n\n+/).join('<br>\n');
51+
// Escape HTML entities, then replace blank lines with <br> for GitHub markdown
52+
const escaped = commit.body
53+
.trim()
54+
.replace(/&/g, '&amp;')
55+
.replace(/</g, '&lt;')
56+
.replace(/>/g, '&gt;');
57+
const body = escaped.split(/\n\n+/).join('<br>\n');
5358

5459
// Breaking changes: show body directly (important to see), no indentation
5560
if (commit.breaking) {

0 commit comments

Comments
 (0)