Skip to content

Rendering Markdown changelog with underlines not possible since 24.7.0 #668

@frankkusters

Description

@frankkusters

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:

is_markdown = template_extension.lower() == ".md"
if is_markdown:
parts = [top_line]
else:
parts = [top_line, config.underlines[0] * len(top_line)]

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions