@@ -54,7 +54,7 @@ export async function changelogRenderer() {
5454 </div>`
5555 }
5656
57- return ( markdown : string | null , releaseId : string | number ) => {
57+ return ( markdown : string | null , releaseId ? : string | number ) => {
5858 // Collect table of contents items during parsing
5959 const toc : TocItem [ ] = [ ]
6060
@@ -68,7 +68,7 @@ export async function changelogRenderer() {
6868 // Track used heading slugs to handle duplicates (GitHub-style: foo, foo-1, foo-2)
6969 const usedSlugs = new Map < string , number > ( )
7070
71- let lastSemanticLevel = 2 // Start after h2 (the "Readme" section heading)
71+ let lastSemanticLevel = releaseId ? 2 : 1 // Start after h2 (the "Readme" section heading)
7272 renderer . heading = function ( { tokens, depth } : Tokens . Heading ) {
7373 // Calculate the target semantic level based on document structure
7474 // Start at h3 (since page h1 + section h2 already exist)
@@ -89,7 +89,9 @@ export async function changelogRenderer() {
8989
9090 // Prefix with 'user-content-' to avoid collisions with page IDs
9191 // (e.g., #install, #dependencies, #versions are used by the package page)
92- const id = `user-content-${ releaseId } -${ uniqueSlug } `
92+ const id = releaseId
93+ ? `user-content-${ releaseId } -${ uniqueSlug } `
94+ : `user-content-${ uniqueSlug } `
9395
9496 // Collect TOC item with plain text (HTML stripped)
9597 const plainText = text
0 commit comments