-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
New Badge Pattern makes inline badges impossible #361
Comments
What happens when you try to have the badge without the start/end comments? |
When putting all on 1 line GitHub does not recognize it as a linked image. |
That's actually something we should have I believe, that way the only README updates would be on the table and the badge would dynamically show the numbers. Do you know how we could go about this? |
Maybe the |
I just added all-contributors and dealing with the same problem, it forces my build badge onto a new line. How is all-contributors doing it? I looked at the README.md and there doesn't exist those comment tags. |
@szepeviktor you can have the server generate the image on the fly for every request. all-contributors could use a url that has the repo name in it which the server could then use to link back to to retrieve the json configuration file to get the contributor count without having to store the data themselves. |
That's how it used to be before the start/end comment was introduced for the badge. Fun fact: the number you see on the badge is outdated, it should be 66 as of b6d1aac (not 54). I also checked on the CLI repo and the numbers (on the badge vs the length of So the badge simply does not work the way it's portrayed on this repo and on the CLI (i.e. without the comments around it). That's a regression which would need to be looked at (PRs are welcome). I suspect #243 would help sort this issue out as the current approach doesn't use any servers rendering so @szepeviktor's approach unfeasible. |
Ok I think I have a nice solution that doesn't require any additional server, this can be done with dynamic shields. If you check out the section titled Dynamic they provide a method for doing exactly what we want. The trick is to provide the full raw URL of the .all-contributorsrc json file as the data url and then using a JSONPath attribute All inputs for dynamic badge, This is the generated badge output,
And here is an example of it working as expect on my repo, https://github.com/wil3/gymfc/ Basically the user would just have to encode their json url and set it as the |
That's awesome. |
Here's an option that doesn't require any configuration to set up. Define the All-Contributors badge image earlier in the Markdown:
And later in the Markdown file, reference the defined image where you want your badge:
In the example above, I wrap the image badge inside a link. Here's a working example: https://github.com/squirrellyjs/squirrelly/blob/master/README.md |
That's pretty sweet didn't know you could do that in markdown. Nice solution. |
I have just opened a new issue, as there is now an 'All Contributors' badge making its way into production on Shields. This would solve the issue completely as it is dynamic and simple. Hopefully once it hits production the badge system here can be updated to use it and solve this issue too. |
Just to add, the badge has now been deployed and is live. You can see it on shields.io now. Below is an example of this repo pulling from the live server: It can of course be styled in the usual ways, for example: Hope this makes it easier to maintain inline badges while still showing off actual contributor numbers and such! |
@JoeIzzard Sweet! @all-contributors/core what do guys think about that? |
to new version so it doesn't need to be changed manually see: all-contributors/all-contributors#361 (comment)
The current all-contributors CLI adds a shield that doesn't work inline, so this is based on all-contributors/cli#266 and all-contributors/all-contributors#361 👍
@gr2m Any thoughts on this? |
I think we shouldn't generate static badges, we should instead make it easier to shield and others to generate the badge dynamically, and/or generate a dynamic SVG badge ourselves via the app. |
@gr2m What about @JoeIzzard 's suggestion? |
Does the workaround from #361 (comment) work for anyone? Seems the bot will unfortunately undo this: https://github.com/prisma/docs/pull/2555/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L4 |
The following works for me: |
Ah, I was missing the |
Describe the bug
With the new badge pattern:
Due to the way comments are rendered in Markdown, you cannot get a badge to show up inline with other badges.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
There'd be a way to customize the pattern
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
All-Contributors itself isn't using the new syntax.
The text was updated successfully, but these errors were encountered: