【问题标题】:How to use Github buttons in Markdown (README.md)如何在 Markdown 中使用 Github 按钮 (README.md)
【发布时间】:2020-08-28 12:06:12
【问题描述】:

我想在我的 markdown 中添加按钮,当按下这些按钮时,让查看者 fork、star 或 watch 一个 github 存储库。

我已经尝试将 html 添加到我的 README.md,但它不起作用。

特别是

<script async defer src="https://buttons.github.io/buttons.js></script>

似乎不起作用(它只是显示链接)

有没有办法在 markdown (.md) 文件中使用 Github 按钮 (https://buttons.github.io)?

或者还有其他方法可以实现吗?

【问题讨论】:

    标签: javascript html github markdown


    【解决方案1】:

    如果您使用按钮创建了图像文件,则可以将其直接合并到 markdown 中。

    例如:

    [![](https://s18955.pcdn.co/wp-content/uploads/2018/02/github.png)](https://github.com/user/repository/subscription)
    

    要控制按钮的大小,您可能需要合并从这个答案Changing image size in Markdown借用的html

    [<img src="https://s18955.pcdn.co/wp-content/uploads/2018/02/github.png" width="25"/>](https://github.com/user/repository/subscription)
    

    【讨论】:

      【解决方案2】:

      在 Markdown 文件中使用 非官方的 Github 按钮似乎是不可能的。

      但是,您可以使用不同的链接来访问这些操作(markdown 样式):

      • 叉子:

      [fork my repository](https://github.com/user/repository/fork)

      • 观看/关注:

      [watch this repo](https://github.com/user/repository/subscription)

      • 创建问题:

      [create issue](https://github.com/user/repository/issues/new)

      如果有人知道 star a repo 的链接,我会将其添加到此答案中:)

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-07
      • 1970-01-01
      • 2021-04-07
      • 2021-10-11
      • 2023-01-01
      • 2019-05-29
      • 2013-02-03
      相关资源
      最近更新 更多