({ preface, blocks })
| 92 | } |
| 93 | |
| 94 | function joinChangelog({ preface, blocks }) { |
| 95 | const parts = [preface.join('\n')]; |
| 96 | for (const b of blocks) { |
| 97 | // Reconstruct: header + body. The block body INCLUDES the blank |
| 98 | // line after the header (it was captured verbatim). |
| 99 | parts.push([b.header, ...b.body].join('\n')); |
| 100 | } |
| 101 | return parts.join('\n'); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Split a block body into ordered sub-sections keyed by their |