Github-readme-stats: Flaw with the handling of `hide` parameter (arrays)

Created on 23 Jul 2020  路  3Comments  路  Source: anuraghazra/github-readme-stats

Describe the bug
Currently what we are doing is accepting a hide parameter which needs to be a JSON array ?hide=["js","html"] we are doing this both for stats card & lang card, it works ok but it fails in one scenario

<a>
  <img src="https://github-readme-stats.vercel.app/api/top-langs/?username=name&hide=["glsl","python"]" />
</a>

As we can see it fails because the image src attribute is wrapping it with double quotes and the options array also needs to be wrapped in double quotes, we can easily avoid this issue just by changing the double quote in the src to single quote but i think this is still a problem which users should not care about, as mentioned by @arjunmahishi in this comment https://github.com/anuraghazra/github-readme-stats/pull/150#discussion_r459366024 he wanted to do the standard approach but i stick to the current API because of this reason https://github.com/anuraghazra/github-readme-stats/pull/150#discussion_r459403218

Now i think we can take two approaches,

  • accepting the ['js'] single quote array and we can convert the single quotes to double quotes internally
  • deprecate this approach and use comma separated values as @arjunmahishi did at first. like "?hide=js,html,css"
bug

Most helpful comment

Okay everyone, the API is changed to ?hide=issues,contribs,stars

Closing, see #162

All 3 comments

pinging @arjunmahishi @nombrekeff @martinRenou @terror for their opinions and ideas

IMO, CSV will fly better than JSON in a URL

Okay everyone, the API is changed to ?hide=issues,contribs,stars

Closing, see #162

Was this page helpful?
0 / 5 - 0 ratings