API Reference
Formatters¶
The SPDXMarkdown formatter extends commitizen's built-in Markdown changelog
format with YAML frontmatter awareness. It strips ----delimited SPDX headers
before parsing, so license identifiers like Apache-2.0 are never mistaken for
version numbers.
Use this formatter when your changelog includes an SPDX/REUSE header block — set
changelog_format = "spdx-markdown" in your project configuration.
Usage example¶
Configure commitizen in pyproject.toml:
Then generate your changelog:
SPDXMarkdown
¶
Bases: Markdown
Markdown changelog format with YAML frontmatter awareness.
Overrides two methods from :class:commitizen.changelog_formats.markdown.Markdown:
get_metadata()— strips frontmatter via :func:_strip_frontmatter, delegates toget_metadata_from_file(), then shifts the returned line indices by the frontmatter line count.get_latest_full_release()— same stripping and index shift applied toget_latest_full_release_from_file().
Attributes:
| Name | Type | Description |
|---|---|---|
config |
The commitizen configuration object. |
get_latest_full_release(filepath)
¶
Retrieve the latest full release info with frontmatter offset correction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the changelog file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
An |
IncrementalMergeInfo
|
class: |
IncrementalMergeInfo
|
release index adjusted for stripped YAML frontmatter. |
get_metadata(filepath)
¶
Extract changelog metadata with frontmatter offset correction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the changelog file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
Metadata
|
class: |
Metadata
|
indices adjusted for stripped YAML frontmatter. |