【问题标题】:Embedding Shields IO Badge HTML in GitHub README.rst在 GitHub README.rst 中嵌入 Shields IO 徽章 HTML
【发布时间】:2021-06-17 08:11:17
【问题描述】:

我正在尝试在我正在处理的 GitHub 项目的 README.rst 文件中包含 Shield IO 徽章。 Shield IO 徽章具有编码两个链接的功能(一个在徽章的左侧,一个在徽章的右侧),我想将其包含在项目 README 中。从https://shields.io/ 开始,为了使用双链接功能,必须将徽章编码在 HTML <object> 标记中。 reStructuredText 具有 raw 功能,可以在文件中包含 HTML 代码 sn-ps,这些文件被解析并包含在 README 中。 PyCharm 解释器可以正确解析 HTML,并且存在双链接功能。但是,当我将文件推送到 GitHub 时,根本没有解析 HTML。很好奇是否有办法在 GitHub README 文件中获得此功能(不一定必须是 reStructuredText)。

例子:

.. 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>

徽章图片示例:

使用双链路功能链接到 Shield IO 静态徽章:

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

【问题讨论】:

    标签: html github restructuredtext readme shields.io


    【解决方案1】:

    这是不可能的。 Github 从 Markdown 和 reStructuredText 中的 SVG 中剥离链接。请在 Github 上查看此问题。

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

    【讨论】:

      【解决方案2】:

      如果你用 Shield.io 徽章包装一个 标记,并带有一个包含你想要的链接的 标记,它就可以工作。我知道在 Markdown 中使用 HTML 是不受欢迎的,但这是我发现的唯一方法,可以按照你的意愿工作。

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

      【讨论】:

        猜你喜欢
        • 2021-12-04
        • 2018-08-14
        • 2021-11-08
        • 2016-04-01
        • 2017-01-25
        • 2021-09-17
        • 2019-05-29
        • 2020-01-03
        • 1970-01-01
        相关资源
        最近更新 更多