When multiple spaces are present, label width is computed incorrectly
- Dominant language
- JavaScript
- Stars
- 27.2k
- Forks
- 5.6k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 46
Description
Are you experiencing an issue with...
- [x] [shields.io](https://shields.io/#/)
- [ ] My own instance
- [ ] [badge-maker NPM package](https://www.npmjs.com/package/badge-maker)
:beetle: **Description**
It seems that the width of the badge label/value text is computed incorrectly for space characters. This leads to the rest of the text getting stretched out.
:link: **Link to the badge**
Here are some badges that have their label replaced by `foo` + N spaces + `bar`. Notice that there are no whitespace characters between `f`, `o` and `o` as well as between `b`, `a` and `r`.
`https://raster.shields.io/pypi/v/a?label=foo%20bar`:
[](https://raster.shields.io/pypi/v/a?label=foo%20bar)
`https://raster.shields.io/pypi/v/a?label=foo%20%20bar`:
[](https://raster.shields.io/pypi/v/a?label=foo%20%20bar)
`https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20bar`:
[](https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20bar)
`https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20bar`:
[](https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20bar)
`https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar`:
[](https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar)
`https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar`:
[](https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar)
Compare with the same badges but with `%20` replaced by `_`:
`https://raster.shields.io/pypi/v/a?label=foo_bar`:
[](https://raster.shields.io/pypi/v/a?label=foo_bar)
`https://raster.shields.io/pypi/v/a?label=foo__bar`:
[](https://raster.shields.io/pypi/v/a?label=foo__bar)
`https://raster.shields.io/pypi/v/a?label=foo____bar`:
[](https://raster.shields.io/pypi/v/a?label=foo____bar)
`https://raster.shields.io/pypi/v/a?label=foo________bar`:
[](https://raster.shields.io/pypi/v/a?label=foo________bar)
`https://raster.shields.io/pypi/v/a?label=foo________________bar`:
[](https://raster.shields.io/pypi/v/a?label=foo________________bar)
`https://raster.shields.io/pypi/v/a?label=foo________________________________bar`:
[](https://raster.shields.io/pypi/v/a?label=foo________________________________bar)
And the svg versions
`https://img.shields.io/pypi/v/a?label=foo%20bar`:
[](https://img.shields.io/pypi/v/a?label=foo%20bar)
`https://img.shields.io/pypi/v/a?label=foo%20%20bar`:
[](https://img.shields.io/pypi/v/a?label=foo%20%20bar)
`https://img.shields.io/pypi/v/a?label=foo%20%20%20%20bar`:
[](https://img.shields.io/pypi/v/a?label=foo%20%20%20%20bar)
`https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20bar`:
[](https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20bar)
`https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar`:
[](https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar)
`https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar`:
[](https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar)
`https://img.shields.io/pypi/v/a?label=foo_bar`:
[](https://img.shields.io/pypi/v/a?label=foo_bar)
`https://img.shields.io/pypi/v/a?label=foo__bar`:
[](https://img.shields.io/pypi/v/a?label=foo__bar)
`https://img.shields.io/pypi/v/a?label=foo____bar`:
[](https://img.shields.io/pypi/v/a?label=foo____bar)
`https://img.shields.io/pypi/v/a?label=foo________bar`:
[](https://img.shields.io/pypi/v/a?label=foo________bar)
`https://img.shields.io/pypi/v/a?label=foo________________bar`:
[](https://img.shields.io/pypi/v/a?label=foo________________bar)
`https://img.shields.io/pypi/v/a?label=foo________________________________bar`:
[](https://img.shields.io/pypi/v/a?label=foo________________________________bar)
Contributor guide
Research direction
Start by reproducing the affected shields.io badge URLs with one or more spaces in the label, then trace the label-width handling in the badge-maker NPM package. Compare the spacing behavior with the underscore examples; done means labels preserve their spaces and the remaining text is no longer stretched in SVG and raster badges.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100