Search code examples
htmlgithubrestructuredtextreadmeshields.io

Embedding Shields IO Badge HTML in GitHub README.rst


I'm trying to include Shield IO Badges in the README.rst file for a GitHub project I am working on. Shield IO Badges have the functionality to encode for two links (one on the left side of the badge and one on the right side of the badge) and I would like to include this in the project README. From https://shields.io/, in order to use the dual link functionality, the badge must be encoded in a HTML <object> tag. reStructuredText has the raw function and can include HTML code snippets in the files which is parsed and included in the README. The PyCharm interpreter can parse the HTML properly and the dual link functionality is present. However, when I push the file to GitHub, the HTML is not being parsed at all. Was curious if there was a work around to get this functionality in a GitHub README file (Doesn't necessarily have to be reStructuredText).

Example:

.. raw:: html

       <object data="https://img.shields.io/static/v1?label=Question&message=Unanswered&color=lightgrey&link=https://stackoverflow.com/&link=https://stackoverflow.com/questions/66716288/embedding-shields-io-badge-html-in-github-readme-rst"></object>

Example Badge Image:

Example Shield IO Badge Image

Link to Shield IO Static Badge with Dual Link Functionally:

https://img.shields.io/static/v1?label=Question&message=Unanswered&color=lightgrey&link=https://stackoverflow.com/&link=https://stackoverflow.com/questions/66716288/embedding-shields-io-badge-html-in-github-readme-rst


Solution

  • It's not possible. Github strips links from SVG's in Markdown and reStrcturedText. See this issue on Github.

    How to specify the link of left and right on GitHub #5593