Skip to main content

prepend_changelog

Function prepend_changelog 

Source
pub fn prepend_changelog(
    existing: &str,
    version: &str,
    date: &str,
    body: &str,
) -> String
Expand description

Prepend a CHANGELOG entry for version, creating a standard header if the file did not exist. Pure transform over the existing CHANGELOG contents.

body is the Keep-a-Changelog-grouped content crate::version::render_changelog_body produces (D-12) — trimmed of trailing newlines and re-terminated with a single \n. When body.trim() is empty (no version-affecting content, or the caller couldn’t compute one), the fallback line - No changes recorded since the previous release. is substituted instead, so an entry is never silently blank.