sugar-high 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -4
- package/lib/index.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# Sugar High
|
|
2
|
-
|
|
2
|
+
### Introduction
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Super lightweight JSX syntax highlighter, around 1KB after minified and gzipped
|
|
5
|
+
|
|
6
|
+
> ⚠️ Still in experiment! Use it in production with caution!
|
|
7
|
+
|
|
8
|
+
### Usage
|
|
5
9
|
|
|
6
10
|
```sh
|
|
7
11
|
npm install --save sugar-high
|
|
8
12
|
```
|
|
9
13
|
|
|
10
|
-
### Usage
|
|
11
|
-
|
|
12
14
|
```js
|
|
13
15
|
import { highlight } from 'sugar-high'
|
|
14
16
|
|
|
@@ -17,6 +19,42 @@ const codeHTML = highlight(code)
|
|
|
17
19
|
document.querySelector('pre > code').innerHTML = codeHTML
|
|
18
20
|
```
|
|
19
21
|
|
|
22
|
+
### Highlight with CSS
|
|
23
|
+
|
|
24
|
+
Then make your own theme with customized colors and put in global CSS
|
|
25
|
+
|
|
26
|
+
```css
|
|
27
|
+
/*
|
|
28
|
+
* 0 - comment
|
|
29
|
+
* 1 - keyword
|
|
30
|
+
* 2 - break
|
|
31
|
+
* 3 - string
|
|
32
|
+
* 4 - space
|
|
33
|
+
* 5 - sign
|
|
34
|
+
* 6 - identifier
|
|
35
|
+
* 7 - Class, number and null
|
|
36
|
+
*/
|
|
37
|
+
.sh__7 {
|
|
38
|
+
color: #3476cb;
|
|
39
|
+
}
|
|
40
|
+
.sh__6 {
|
|
41
|
+
color: #2d333b;
|
|
42
|
+
}
|
|
43
|
+
.sh__5 {
|
|
44
|
+
color: #818c9b;
|
|
45
|
+
font-weight: bold;
|
|
46
|
+
}
|
|
47
|
+
.sh__3 {
|
|
48
|
+
color: #00a99a;
|
|
49
|
+
}
|
|
50
|
+
.sh__1 {
|
|
51
|
+
color: #f47067;
|
|
52
|
+
}
|
|
53
|
+
.sh__0 {
|
|
54
|
+
color: #818c9b;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
20
58
|
### LICENSE
|
|
21
59
|
|
|
22
60
|
MIT
|
package/lib/index.mjs
CHANGED