Create changelog file content with MyST frontmatter.
(
version: str,
body: str,
date: str | None = None,
title: str | None = None,
)
| 264 | |
| 265 | |
| 266 | def format_changelog( |
| 267 | version: str, |
| 268 | body: str, |
| 269 | date: str | None = None, |
| 270 | title: str | None = None, |
| 271 | ) -> str: |
| 272 | """Create changelog file content with MyST frontmatter.""" |
| 273 | title = title or f"v{version}" |
| 274 | body = convert_to_myst(body) |
| 275 | date_section = f"Date\n: {date}\n" if date else "" |
| 276 | |
| 277 | return f"""--- |
| 278 | short-title: {title} |
| 279 | description: Changelog for {title} |
| 280 | --- |
| 281 | |
| 282 | # {title} |
| 283 | |
| 284 | {date_section} |
| 285 | {body} |
| 286 | """ |
| 287 | |
| 288 | |
| 289 | # ============================================================================= |
no test coverage detected