@hyperfrontend/versioning/changelog/serializeserialize
Serializers that convert structured Changelog objects back to Keep-a-Changelog markdown or to JSON.
serializeChangelog produces a stable, deterministic markdown rendering driven by SerializeOptions (heading style, bullet markers, link references, spacing). Helpers (getSectionHeading, formatLink, getListMarker, createSpacing) expose the underlying templating primitives for downstream tools that want to format individual fragments. serializeChangelogToJson and toJsonObject produce a JsonSerializeOptions-controlled JSON shape suitable for archiving or for tools that prefer structured data over markdown.
API Reference
ƒ Functions
Returns
stringExample
Creating blank line spacing
createSpacing(2, '\n')
// => '\n\n'Parameters
Returns
stringExample
Formatting a markdown link
formatLink('1.0.0', 'https://github.com/org/repo/releases/tag/v1.0.0')
// => '[1.0.0](https://github.com/org/repo/releases/tag/v1.0.0)'Parameters
| Name | Type | Description |
|---|---|---|
§useAsterisks | boolean | Whether to use * instead of - |
Returns
stringExample
Getting list markers
getListMarker(false) // => '- '
getListMarker(true) // => '* 'getSectionHeading(type: ChangelogSectionType, customHeadings?: Partial<Record<ChangelogSectionType, string>>): string
Parameters
Returns
stringExample
Getting section headings
getSectionHeading('features')
// => 'Added'
getSectionHeading('features', { features: 'New Features' })
// => 'New Features'Parameters
| Name | Type | Description |
|---|---|---|
§options? | SerializeOptions | User-provided options |
Returns
Required<SerializeOptions>Example
Resolving serialize options with defaults
const opts = resolveOptions({ includeCommits: true })
// => { includeCommits: true, includeScope: true, lineEnding: '\n', ... }Parameters
Returns
stringExamples
Basic serialization
const markdown = serializeChangelog(changelog)Serializing with custom options
const markdown = serializeChangelog(changelog, {
includeCommits: false,
useAsterisks: true,
})Parameters
Returns
stringExamples
Basic JSON serialization
const json = serializeChangelogToJson(changelog)Pretty-printing with custom indentation
const json = serializeChangelogToJson(changelog, {
pretty: true,
indent: 4,
})toJsonObject(changelog: Changelog, options?: JsonSerializeOptions): Record<string, unknown>
Parameters
Returns
Record<string, unknown>Example
Converting changelog to plain object
const obj = toJsonObject(changelog, { includeSource: true })
// => { source: 'CHANGELOG.md', header: { title: '...', ... }, entries: [...] }
// Send as API response
res.json(obj)◈ Interfaces
Properties
Properties
readonly sectionHeadings?:Partial<Record<ChangelogSectionType, string>>—