最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use Github buttons in Markdown (README.md) - Stack Overflow

programmeradmin2浏览0评论

I want to add buttons to my markdown that, when pressed, let the viewer fork, star or watch a github repository.

I already tried adding the html to my README.md, but it does not work.

Especially

<script async defer src=".js></script>

does not seem to work (it just displays the link)

Is there a way to use Github Buttons () in a markdown (.md) file?

Or are there other ways to inplement this?

I want to add buttons to my markdown that, when pressed, let the viewer fork, star or watch a github repository.

I already tried adding the html to my README.md, but it does not work.

Especially

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

does not seem to work (it just displays the link)

Is there a way to use Github Buttons (https://buttons.github.io) in a markdown (.md) file?

Or are there other ways to inplement this?

Share Improve this question edited May 12, 2020 at 15:25 publicdomain asked May 12, 2020 at 15:12 publicdomainpublicdomain 1,7224 gold badges24 silver badges39 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 9

It seems impossible to use the unofficial Github Buttons in a Markdown file.

However, you can use different links to access those actions (markdown style):

  • Fork:

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

  • Watch/ Follow:

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

  • Create Issues:

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

If somebody knows a link to star a repo, I will add that to this answer :)

If you created an image file with the button you could incorporate it directly in markdown.

For example:

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

To control the size of the button you may need to incorporate html borrowing from this answer Changing image size in Markdown

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

评论列表(0)

  1. 暂无评论