absolute-version / commit-and-tag-version

Fork of the excellent standard-version. Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org :trophy:
ISC License
360 stars 33 forks source link

Escape characters like < and > #122

Open AmirHosseinKarimi opened 6 months ago

AmirHosseinKarimi commented 6 months ago

Describe the bug Characters like < and > are parsed as markdown syntax and won't shown in output. Something like feat: add <Header> to <App> will shown as: feat: add to

Current behavior Characters like < and > are parsed as markdown syntax.

Expected behavior Escape markdown syntax from commit messages.

Environment

TimothyJones commented 6 months ago

I'm not able to reproduce this -

mkdir example
cd example
touch readme.md
git add readme.md
git commit -m "feat: example <with tag>"
npx commit-and-tag-version

generates a changelog with:

## 1.1.0 (2024-01-15)

### Features

* example <with tag> dfa9580

As an aside, I think having markdown syntax in commit messages is actually helpful - as it lets you format code (useful for the tag syntax):

# note the single quotes
 git commit -m 'feat: example `<with tag>`' 
AmirHosseinKarimi commented 6 months ago

Yea, the generated changelog is correct. But the < & > characters will be parsed and won't shown in the output. Also, I agree that having markdown syntax in the commit message is helpful, But I think it will be awesome if we can have an option to parse or escape it.

TimothyJones commented 6 months ago

Ah, I see what you're getting at.

...characters will be parsed

Am I right in understanding that the issue is that they're parsed by markdown, because they weren't escaped at the time the markdown file is written?

I think escaping the characters that markdown interprets would be a bit unexpected, so this doesn't feel like a bug to me. But, I see how it might be useful to be able to do this with a config option.

This project is intended to be a wrapper around conventional-changelog. Conventional-changelog controls the writing of the changelog, and I think the package that knows how to write markdown is conventional-changelog-writer (although I'm not certain). You might want to open an issue / PR over there.