Skip to content

Commit 1d825f1

Browse files
committed
docs: update README to the new version usage
1 parent 5b28a8c commit 1d825f1

File tree

1 file changed

+183
-79
lines changed

1 file changed

+183
-79
lines changed

README.md

Lines changed: 183 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -6,173 +6,277 @@ A simple tool for every LeetCoder. Support both LeetCode and LeetCode CN.
66

77
Show your dynamically generated LeetCode stats on your GitHub profile or your website!
88

9-
[Playground: Try It Now](https://leetcode.card.workers.dev/)
10-
11-
[![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&update=20210612)](https://leetcode.card.workers.dev/)
12-
13-
> New version is coming soon!
14-
>
15-
> New features:
16-
>
17-
> - [x] Load remote CSS stylesheets.
18-
> - [x] Hide any thing on the card if you don't want to show it.
19-
> - [x] Refactor activity extension, with all themes support.
20-
> - [x] Enable all 1300+ Google Fonts.
21-
> - [ ] Any thoughts? [Let me know!](https://github.com/JacobLinCool/LeetCode-Stats-Card/issues/new)
22-
>
23-
> Playground: <https://leetcard.jacoblin.cool/>
24-
>
25-
> New Version Preview:
26-
>
27-
> [![new preview](https://leetcard.jacoblin.cool/JacobLinCool?theme=unicorn&extension=activity&border=0)](https://leetcard.jacoblin.cool/JacobLinCool?theme=unicorn&extension=activity&border=0)
9+
[Playground: Try It Now](https://leetcard.jacoblin.cool/)
10+
11+
[![LeetCode Stats](https://leetcard.jacoblin.cool/JacobLinCool?theme=unicorn&extension=activity)](https://leetcard.jacoblin.cool/JacobLinCool?theme=unicorn&extension=activity)
12+
13+
## Features
14+
15+
- 📈 Clean and simple LeetCode stats, for both `us` and `cn` sites
16+
- 🎨 Multiple themes and 1,300+ fonts - [Theme](#theme-default-lightdark), [Font](#font-default-baloo2)
17+
- 🪄 Fully customizable using CSS - [Custom Stylesheets](#sheets-default-"")
18+
- ⚡️ Fast and globally edge network - [Cloudflare Workers](https://workers.cloudflare.com/)
19+
- 🚫 No tracking, controlable cache - [Cache](#cache-default-60)
20+
- 🍀 Open source
21+
22+
It also has a [NPM package](https://www.npmjs.com/package/leetcode-card) and a [highly extensible system](./src/core/index.ts), so you can easily customize it to your needs.
23+
24+
CLI tool will be created if I have time.
25+
Want to contribute? Feel free to open a pull request!
2826

2927
## Usage
3028

31-
Just copy the code below, paste it into your readme.md, and change the value of `username`.
29+
Simply copy the code below, paste it into your `README.md`, and change the path to your leetcode username (case-insensitive).
3230

3331
```md
34-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool)
32+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool)
3533
```
3634

3735
Congratulation! You are now showing your LeetCode stats on your profile!
3836

39-
Want hyperlink? Try this:
37+
Want a hyperlink? Try this:
4038

4139
```md
42-
[![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool)](https://leetcode.com/JacobLinCool)
40+
[![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool)](https://leetcode.com/JacobLinCool)
4341
```
4442

4543
### Endpoint
4644

47-
The endpoint of this awesome tool is:
45+
The endpoint of this tool is:
4846

49-
[https://leetcode.card.workers.dev/](https://leetcode.card.workers.dev/)
47+
<https://leetcard.jacoblin.cool/>
5048

51-
### Parameters
49+
> The legacy one: <https://leetcode.card.workers.dev/>
5250
53-
| Key | Description | Default Value | Required |
54-
| --------------- | ----------------------------------------- | ------------- | -------- |
55-
| `username` | Your LeetCode Username: `String` | `null` | YES |
56-
| `theme` | Card [Style](#themes): `String` | `default` | NO |
57-
| `font` | Text [Font](#fonts): `String` | `baloo` | NO |
58-
| `width` | Card Width: `Number` | `500` | NO |
59-
| `height` | Card Height: `Number` | `200` | NO |
60-
| `animation` | Enable Animation: `Boolean` | `true` | NO |
61-
| `border` | Border Width: `Number` | `1` | NO |
62-
| `border_radius` | Border Radius: `Number` | `4` | NO |
63-
| `extension` | Enable [Extension](#extensions): `String` | `null` | NO |
64-
| `show_rank` | Display/Hide Rank: `Boolean` | `true` | NO |
65-
| `cache` | Cache Time (in second): `Number` | `60` | NO |
66-
| `site` | Data source: `us` or `cn` | `us` | NO |
51+
### Options
6752

68-
### Themes
53+
There are many options, you can configure them by passing a query string to the endpoint.
6954

70-
Now we have 5 themes. If you have any great idea, please let me know. Also, any PRs or Issues with cool features or styles are welcomed!
55+
#### `site` (default: `us`)
7156

72-
#### Default
57+
Data source, can be `us` or `cn`.
7358

7459
```md
75-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=default)
60+
![](https://leetcard.jacoblin.cool/leetcode?site=cn)
7661
```
7762

78-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=default)
63+
![](https://leetcard.jacoblin.cool/leetcode?site=cn)
7964

80-
#### Dark
65+
#### `theme` (default: `light,dark`)
66+
67+
Card theme, see [Theme](#themes) for more information.
68+
69+
Use a comma to separate the light and dark theme.
70+
71+
```md
72+
![](https://leetcard.jacoblin.cool/jacoblincool?theme=unicorn)
73+
![](https://leetcard.jacoblin.cool/jacoblincool?theme=light,unicorn)
74+
```
75+
76+
![](https://leetcard.jacoblin.cool/jacoblincool?theme=unicorn)
77+
78+
#### `font` (default: `Baloo_2`)
79+
80+
Card font, you can use all most all fonts on Google Fonts.
81+
82+
It is case-insensitive, and you can use `font=dancing_script` or `font=Dancing%20Script`.
83+
84+
```md
85+
![](https://leetcard.jacoblin.cool/jacoblincool?font=Dancing_Script)
86+
```
87+
88+
![](https://leetcard.jacoblin.cool/jacoblincool?font=Dancing_Script)
89+
90+
#### `width` and `height` (default: `500` and `200`)
91+
92+
Change the card size, it will not resize the content.
93+
94+
But it will be helpful if you want to use custom css.
95+
96+
```md
97+
![](https://leetcard.jacoblin.cool/jacoblincool?width=500&height=500)
98+
```
99+
100+
![](https://leetcard.jacoblin.cool/jacoblincool?width=500&height=500)
101+
102+
#### `border` and `radius` (default: `1` and `4`)
103+
104+
Change the card border and radius.
105+
106+
```md
107+
![](https://leetcard.jacoblin.cool/jacoblincool?border=0&radius=20)
108+
```
109+
110+
![](https://leetcard.jacoblin.cool/jacoblincool?border=0&radius=20)
111+
112+
#### `animation` (default: `true`)
113+
114+
Enable or disable the animation.
115+
116+
```md
117+
![](https://leetcard.jacoblin.cool/jacoblincool?animation=false)
118+
```
119+
120+
![](https://leetcard.jacoblin.cool/jacoblincool?animation=false)
121+
122+
#### `hide` (default: `""`)
123+
124+
Hide elements on the card, it is a comma-separated list of element ids.
81125

82126
```md
83-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=dark)
127+
![](https://leetcard.jacoblin.cool/jacoblincool?hide=ranking,total-solved-text,easy-solved-count,medium-solved-count,hard-solved-count)
84128
```
85129

86-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=dark)
130+
![](https://leetcard.jacoblin.cool/jacoblincool?hide=ranking,total-solved-text,easy-solved-count,medium-solved-count,hard-solved-count)
87131

88-
#### Auto
132+
#### `ext` (default: `""`)
133+
134+
Extension, it is a comma-separated list of extension names.
135+
136+
Now there is only a notable extension: `activity`.
137+
138+
> But actually animation, font, theme, and external stylesheet are all implemented by extensions and enabled by default.
139+
140+
Want to contribute a `contest` or `nyan-cat` extension? PR is welcome!
141+
142+
```md
143+
![](https://leetcard.jacoblin.cool/jacoblincool?ext=activity)
144+
```
145+
146+
![](https://leetcard.jacoblin.cool/jacoblincool?ext=activity)
147+
148+
#### `cache` (default: `60`)
149+
150+
Cache time in seconds.
151+
152+
Note: it will not be a good idea to set it to a long time because GitHub will fetch and cache the card.
89153

90154
```md
91-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=auto)
155+
![](https://leetcard.jacoblin.cool/jacoblincool?cache=0)
92156
```
93157

94-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=auto)
158+
![](https://leetcard.jacoblin.cool/jacoblincool?cache=0)
159+
160+
> You can make `DELETE` request to `/:site/:username` to delete the cache.
161+
162+
#### `sheets` (default: `""`)
163+
164+
External stylesheet, it is a comma-separated list of urls.
165+
166+
You can upload your custom CSS to gist and use the url.
167+
168+
```md
169+
![](https://leetcard.jacoblin.cool/jacoblincool?sheets=url1,url2)
170+
```
171+
172+
They will be injected in the order you specified.
173+
174+
#### Legacy Options
175+
176+
Still work, but deprecated.
177+
178+
| Key | Description | Default Value |
179+
| --------------- | ---------------------------- | ------------- |
180+
| `border_radius` | Same as `radius` | `4` |
181+
| `show_rank` | Display/Hide Rank: `Boolean` | `true` |
182+
| `extension` | Same as `ext` | `""` |
183+
184+
### Themes
185+
186+
Now we have 6 themes. If you have any great idea, please feel free to open a PR!
187+
188+
#### Light
189+
190+
```md
191+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=light)
192+
```
193+
194+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=light)
195+
196+
#### Dark
197+
198+
```md
199+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=dark)
200+
```
201+
202+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=dark)
95203

96204
#### Nord
97205

98206
```md
99-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=nord)
207+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=nord)
100208
```
101209

102-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=nord)
210+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=nord)
103211

104212
#### Forest
105213

106214
```md
107-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=forest)
215+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=forest)
108216
```
109217

110-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=forest)
218+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=forest)
111219

112220
#### WTF
113221

114222
```md
115-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=wtf)
223+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=wtf)
116224
```
117225

118-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=wtf)
226+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=wtf)
119227

120228
#### Unicorn
121229

122230
```md
123-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=unicorn)
231+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=unicorn)
124232
```
125233

126-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&theme=unicorn)
234+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&theme=unicorn)
127235

128236
### Fonts
129237

130-
#### Baloo
238+
You can now use all fonts on [Google Fonts](https://fonts.google.com/).
131239

132-
```md
133-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=baloo)
134-
```
135-
136-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=baloo)
240+
Some examples:
137241

138242
#### Milonga
139243

140244
```md
141-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=milonga)
245+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&font=milonga)
142246
```
143247

144-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=milonga)
248+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&font=milonga)
145249

146250
#### Patrick Hand
147251

148252
```md
149-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=patrick_hand)
253+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&font=patrick_hand)
150254
```
151255

152-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=patrick_hand)
256+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&font=patrick_hand)
153257

154258
#### Ruthie
155259

156260
```md
157-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=ruthie)
261+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&font=ruthie)
158262
```
159263

160-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&font=ruthie)
264+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&font=ruthie)
161265

162-
#### Other Fonts
266+
### Extensions
163267

164-
You can also use some [Web Safe Font](https://www.w3schools.com/cssref/css_websafe_fonts.asp) which you want to display on the card.
268+
Now there is only a notable extension: `activity`.
165269

166-
### Extensions
270+
> But actually animation, font, theme, and external stylesheet are all implemented by extensions and enabled by default.
167271
168-
Extension is still a testing feature.
272+
Want to contribute a `contest` or `nyan-cat` extension? PR is welcome!
169273

170-
It will not work on iOS, the layout is far from perfect.
274+
#### `activity`
171275

172-
But you can try it by adding `extension=activity` to the serach parameter.
276+
Show your recent submissions.
173277

174278
```md
175-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&extension=activity)
279+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&ext=activity)
176280
```
177281

178-
![Leetcode Stats](https://leetcode.card.workers.dev/?username=JacobLinCool&extension=activity)
282+
![Leetcode Stats](https://leetcard.jacoblin.cool/JacobLinCool&ext=activity)

0 commit comments

Comments
 (0)