Rendering Markdown changelog with underlines not possible since 24.7.0
Our project uses the setext_with_atx heading style for its changelogs:
Changelog for module
====================
1.0.0 (2024-09-03)
------------------
### New features
...
Until towncrier 23.11.0 it worked properly with this configuration:
[tool.towncrier]
filename = "CHANGELOG.md"
underlines = ["-", "", ""]
title_format = "{version} ({project_date})"
After upgrading to 24.7.0 or later the underlines option is ignored. That is caused by these lines: https://github.com/twisted/towncrier/blob/833647e31cde8fd68f0e53063b10e8f3ae4214c3/src/towncrier/build.py#L177 https://github.com/twisted/towncrier/blob/833647e31cde8fd68f0e53063b10e8f3ae4214c3/src/towncrier/build.py#L234-L237
What this means is that the only way to get underlines in Markdown files is to:
- duplicate the Markdown template,
- rename it to something that does not end in
.md, and - specify that template in
towncrier.toml.
I think the rendered jinja output should not be modified in build.py. Any special behavior should be in the template itself, such that it becomes easier to override.
I'll create a pull request when I have time.
Thanks for the report.
I agree that in an ideal world, build.py should only provide model data without any type of markup.
I am happy to review and merge a PR with a fix for this.