Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Include Migration steps in changelog bodySection (#48496)

Francesco Sansalvadore00d12c305c9d
diff --git a/apps/www/lib/changelog-entries-core.mjs b/apps/www/lib/changelog-entries-core.mjs
index e7f8d5ed948..22661f85d72 100644
--- a/apps/www/lib/changelog-entries-core.mjs
+++ b/apps/www/lib/changelog-entries-core.mjs
@@ -106,7 +106,10 @@ export function toPublicFrontmatter(frontmatter) {
}
export function stripInternalBlock(body) {
- let sanitized = body.replace(/<!--\s*internal\s*-->[\s\S]*?<!--\s*\/internal\s*-->/gi, '')
+ // An unmatched opening `<!-- internal -->` (no closing `<!-- /internal -->`) must
+ // still swallow everything after it — otherwise the follow-up comment-stripper
+ // would remove the opener alone and leak the internal text into publicBody.
+ let sanitized = body.replace(/<!--\s*internal\s*-->[\s\S]*?(?:<!--\s*\/internal\s*-->|$)/gi, '')
// MDX doesn't support raw HTML comments (only {/* */}) — strip any that are left
// (e.g. author/template notes) so they can't break rendering. Applied repeatedly:
// a single pass could in principle leave a fresh `<!-- ... -->` behind.
@@ -175,11 +178,21 @@ export function parseChangelogEntryFile(filename, raw) {
frontmatter: toPublicFrontmatter(frontmatter),
sortDate: toDateString(frontmatter.publish_date) ?? resolveDateFromFilename(filename) ?? '',
summary: extractSection(publicBody, 'Summary'),
- bodySection: extractSection(publicBody, 'Body', ['Migration steps']),
- migrationSteps: extractSection(publicBody, 'Migration steps'),
+ bodySection: extractBodySection(publicBody),
}
}
+/**
+ * Everything under `## Body` to the end of the public content. The internal
+ * block is already stripped upstream (`stripInternalBlock`), so we don't stop
+ * at any specific heading — the `<!-- internal -->` marker is the boundary.
+ */
+function extractBodySection(publicBody) {
+ const match = publicBody.match(/^##\s+Body\s*\n/im)
+ if (!match) return ''
+ return publicBody.slice(match.index + match[0].length).trim()
+}
+
/** `public: true` and not scheduled for a future `publish_date`. */
export function isPublished(entry) {
if (entry.frontmatter.public !== true) return false
diff --git a/apps/www/lib/changelog-entries-core.test.ts b/apps/www/lib/changelog-entries-core.test.ts
index de0636c1eec..18c663a0125 100644
--- a/apps/www/lib/changelog-entries-core.test.ts
+++ b/apps/www/lib/changelog-entries-core.test.ts
@@ -104,6 +104,94 @@ describe('parseChangelogEntryFile', () => {
expect(nullDate.sortDate).toBe('2026-07-22')
})
+ it('includes everything under ## Body up to the internal block, and excludes internal content', () => {
+ const entry = parseChangelogEntryFile(
+ '20260714-breaking.md',
+ `---
+title: Breaking change
+change_type: breaking-change
+public: true
+publish_date: 2026-07-14
+---
+
+## Summary
+
+Short summary.
+
+## Body
+
+## What changed
+
+The thing changed.
+
+## Migration steps
+
+1. Do the thing.
+2. Do the other thing.
+
+## Rollout timeline
+
+| Date | Milestone |
+| ---- | --------- |
+| 2026 | done |
+
+<!-- internal -->
+
+## Internal notes
+
+secret
+
+<!-- /internal -->
+`
+ )
+
+ expect(entry.bodySection).toContain('## What changed')
+ expect(entry.bodySection).toContain('## Migration steps')
+ expect(entry.bodySection).toContain('Do the thing.')
+ expect(entry.bodySection).toContain('## Rollout timeline')
+ expect(entry.bodySection).not.toContain('## Summary')
+ expect(entry.bodySection).not.toContain('Short summary.')
+ expect(entry.bodySection).not.toContain('Internal notes')
+ expect(entry.bodySection).not.toContain('secret')
+ })
+
+ it('treats an unmatched opening <!-- internal --> marker as internal through end of file', () => {
+ const entry = parseChangelogEntryFile(
+ '20260714-unclosed-internal.md',
+ `---
+title: Unclosed internal
+change_type: improvement
+public: true
+publish_date: 2026-07-14
+---
+
+## Summary
+
+Short summary.
+
+## Body
+
+Public body text.
+
+<!-- internal -->
+
+## Internal notes
+
+super secret
+
+## Support FAQ
+
+more secret
+`
+ )
+
+ expect(entry.bodySection).toContain('Public body text.')
+ expect(entry.bodySection).not.toContain('Internal notes')
+ expect(entry.bodySection).not.toContain('super secret')
+ expect(entry.bodySection).not.toContain('Support FAQ')
+ expect(entry.bodySection).not.toContain('more secret')
+ })
+
it('normalizes date frontmatter reaching detail-page props, even when unquoted', () => {
// `[slug].tsx` ships `entry.frontmatter` into props; a Date would break serialization.
const entry = parseChangelogEntryFile(
diff --git a/apps/www/lib/changelog-repo.ts b/apps/www/lib/changelog-repo.ts
index c5d6e7cbfae..322c22dfaeb 100644
--- a/apps/www/lib/changelog-repo.ts
+++ b/apps/www/lib/changelog-repo.ts
@@ -43,10 +43,12 @@ export type ChangelogEntry = {
sortDate: string
/** Contents of `## Summary` only. */
summary: string
- /** Contents of `## Body` only. Never includes the internal block. */
+ /**
+ * Everything under `## Body` to the end of the public content. The
+ * `<!-- internal -->` block is the only boundary — content authors want kept
+ * off the published page goes inside that block.
+ */
bodySection: string
- /** Contents of `## Migration steps`, if present. */
- migrationSteps: string
}
function createChangelogRepoOctokit() {