Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering Markdown changelog with underlines not possible since 24.7.0 #668

Open
frankkusters opened this issue Sep 3, 2024 · 1 comment

Comments

@frankkusters
Copy link

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.

@adiroiban
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants