kefranabg / readme-md-generator

πŸ“„ CLI that generates beautiful README.md files
https://www.npmjs.com/package/readme-md-generator
MIT License
10.94k stars 1.37k forks source link

Version number containing dashes break the version badge #189

Closed Errorname closed 4 years ago

Errorname commented 4 years ago

Describe the bug If the project has a version number containing dashes, it will break the version badge.

To Reproduce Steps to reproduce the behavior:

  1. npx readme-md-generator
  2. When asked for a version, enter: "1.0.0-alpha"
  3. In the generated readme, find the url of the badge (https://img.shields.io/badge/version-1.0.0--alpha-blue)
  4. Observe the error: "404 badge not found"

Expected behavior It should show the correct badge

Additional context On the shields.io documentation, there is the following part:

Using dash "-" separator

https://img.shields.io/badge/<LABEL>-<MESSAGE>-<COLOR>

Dashes --   β†’   - Dash
Underscores __  β†’   _ Underscore
_ or Space      β†’     Space

Because shields.io uses dashes to separate the variables, if we want a dash in our version number, we actually need to put two dashes.

So, when building a shield badge, we should first replace all dashes with double dashes, all underscors with double underscores, and all spaces with underscores

kefranabg commented 4 years ago

Thanks for this clean issue report πŸ™

This kind of bug has been fixed for the license badge.

I'll do the same for the version ;)

kefranabg commented 4 years ago

Will be available in the next release πŸ‘Œ