Skip to content

Commit 2480f4b

Browse files
docs(readme): add installation and usage examples and instructions
1 parent 0c79840 commit 2480f4b

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
11
# github-corners
2+
3+
[![NPM](https://nodei.co/npm/github-corners.png)](https://nodei.co/npm/github-corners/)
4+
5+
[![NPM version](https://img.shields.io/npm/v/github-corners.svg)](https://www.npmjs.com/package/github-corners)
6+
7+
Embed script for [Tim Holman](https://github.com/tholman)'s [Github Corners](http://tholman.com/github-corners).
8+
9+
## Installation
10+
11+
Include the [embed script](https://unpkg.com/github-corners/dist/) from the [unpkg](https://unpkg.com) CDN in your page:
12+
13+
```html
14+
<!-- placed preferably before the closing `<body>` tag -->
15+
<script src="https://unpkg.com/github-corners/dist/embed.min.js"></script>
16+
```
17+
18+
It's recommended that you specify a [version](https://registry.npmjs.org/github-corners) or you may experience breaking changes:
19+
20+
```html
21+
<!-- replace `latest` with a version like `0.1.0` -->
22+
<script src="https://unpkg.com/github-corners@latest/dist/embed.min.js"></script>
23+
```
24+
25+
## Usage
26+
27+
So the GitHub Corner renders on your page. Great! But how do I specify a link?
28+
29+
You can set it using the `data-href` attribute:
30+
31+
```html
32+
<script data-href="https://github.com/tholman/github-corners" src="https://unpkg.com/github-corners/dist/embed.min.js"></script>
33+
```
34+
35+
Now what if I want the link to open in a new tab?
36+
37+
Set `data-target` to `_blank`:
38+
39+
```html
40+
<script data-href="https://github.com/tholman/github-corners" data-target="_blank" src="https://unpkg.com/github-corners/dist/embed.min.js"></script>
41+
```
42+
43+
And what if I want to change the color or position of the corner?
44+
45+
You can always override the default styling of the svg:
46+
47+
```html
48+
<!-- placed preferably after the embed script -->
49+
<style>
50+
.github-corner > svg {
51+
fill: skyblue;
52+
}
53+
</style>
54+
```
55+
56+
## License
57+
58+
[MIT](LICENSE)
59+
60+
See [license/acknowledgements](https://github.com/tholman/github-corners#licenseacknowledgements) from original project.

0 commit comments

Comments
 (0)