|
1 | 1 | @require '../_variables'
|
2 | 2 |
|
3 | 3 | .content
|
| 4 | + |
4 | 5 | code
|
5 | 6 | color #f81ce5
|
6 | 7 | padding 0.25rem 0.5rem
|
7 | 8 | margin 0
|
8 | 9 | font-size 0.85em
|
| 10 | + background-color rgba(27,31,35,0.05) |
9 | 11 | border-radius 3px
|
10 | 12 |
|
11 | 13 | .content
|
| 14 | + |
12 | 15 | pre, pre[class*="language-"]
|
13 |
| - background-color $codeBgColor |
14 | 16 | line-height 1.4
|
15 |
| - border-radius 6px |
16 |
| - padding 1.5rem 1.5rem |
17 |
| - margin 0.85rem 0 |
18 |
| - white-space pre-wrap |
19 |
| - word-break break-word |
| 17 | + padding 1.25rem 1.5rem |
| 18 | + background transparent |
20 | 19 | overflow auto
|
21 |
| - position relative |
22 | 20 |
|
23 | 21 | code
|
24 | 22 | color #fff
|
25 | 23 | padding 0
|
26 | 24 | background-color transparent
|
27 | 25 | border-radius 0
|
28 | 26 |
|
29 |
| - &:before |
| 27 | +div[class*="language-"] |
| 28 | + position relative |
| 29 | + border: 1px solid $codeBgColor |
| 30 | + margin 0.85rem 0 |
| 31 | + background-color $codeBgColor |
| 32 | + border-radius 6px |
| 33 | + |
| 34 | + .highlight-lines |
| 35 | + user-select none |
| 36 | + position absolute |
| 37 | + top 0 |
| 38 | + left 0 |
| 39 | + width 100% |
| 40 | + padding 1.25rem 0 |
| 41 | + margin: 0.5em 0 |
| 42 | + line-height 1.4 |
| 43 | + |
| 44 | + .highlighted |
| 45 | + background-color rgba(0, 0, 0, 66%) |
| 46 | + |
| 47 | + |
| 48 | + pre |
| 49 | + position relative |
| 50 | + z-index 1 |
| 51 | + |
| 52 | + &::before |
| 53 | + position absolute |
| 54 | + z-index 3 |
| 55 | + top 0.8em |
| 56 | + right 1em |
| 57 | + font-size 0.75rem |
| 58 | + color rgba(255, 255, 255, 0.4) |
| 59 | + |
| 60 | + &:not(.line-numbers-mode) |
| 61 | + |
| 62 | + .line-numbers-wrapper |
| 63 | + display none |
| 64 | + |
| 65 | + &.line-numbers-mode |
| 66 | + |
| 67 | + .highlight-lines .highlighted |
| 68 | + position relative |
| 69 | + |
| 70 | + &:before |
| 71 | + content ' ' |
| 72 | + position absolute |
| 73 | + z-index 3 |
| 74 | + left 0 |
| 75 | + top 0 |
| 76 | + display block |
| 77 | + width 3.5rem |
| 78 | + height 100% |
| 79 | + background-color rgba(0, 0, 0, 66%) |
| 80 | + pre |
| 81 | + padding-left 5.5rem |
| 82 | + vertical-align middle |
| 83 | + |
| 84 | + .line-numbers-wrapper |
30 | 85 | position absolute
|
31 |
| - top 0.8em |
32 |
| - right 1em |
33 |
| - font-size 0.75rem |
34 |
| - color rgba(255, 255, 255, 0.4) |
35 |
| - |
36 |
| - .highlighted-line |
37 |
| - background-color rgba(0, 0, 0, 66%) |
38 |
| - display block |
39 |
| - margin 0 -1.5rem |
40 |
| - padding 0 1.5rem |
41 |
| - |
42 |
| - .examples |
43 |
| - .highlighted-line |
44 |
| - background-color rgba(255, 255, 255, 0.2) |
45 |
| - |
46 |
| -pre[class="language-js"], pre[class="language-javascript"] |
| 86 | + top 0 |
| 87 | + width 3.5rem |
| 88 | + text-align center |
| 89 | + color rgba(255, 255, 255, 0.3) |
| 90 | + padding 1.25rem 0 |
| 91 | + line-height 1.4 |
| 92 | + |
| 93 | + br |
| 94 | + user-select none |
| 95 | + |
| 96 | + .line-number |
| 97 | + position relative |
| 98 | + z-index 4 |
| 99 | + user-select none |
| 100 | + font-size 0.85em |
| 101 | + |
| 102 | + &::after |
| 103 | + content '' |
| 104 | + position absolute |
| 105 | + z-index 2 |
| 106 | + top 0 |
| 107 | + left 0 |
| 108 | + width 3.5rem |
| 109 | + height 100% |
| 110 | + border-radius 6px 0 0 6px |
| 111 | + border-right 1px solid rgba(0, 0, 0, 66%) |
| 112 | + background-color $codeBgColor |
| 113 | + |
| 114 | + |
| 115 | +for lang in js ts html md vue css sass scss less stylus go java c sh yaml |
| 116 | + div{'[class*="language-' + lang + '"]'} |
| 117 | + &:before |
| 118 | + content ('' + lang) |
| 119 | + |
| 120 | +div[class*="language-javascript"] |
47 | 121 | &:before
|
48 | 122 | content "js"
|
49 | 123 |
|
50 |
| -pre[class="language-html"], pre[class="language-markup"] |
| 124 | +div[class*="language-typescript"] |
| 125 | + &:before |
| 126 | + content "ts" |
| 127 | + |
| 128 | +div[class*="language-markup"] |
51 | 129 | &:before
|
52 | 130 | content "html"
|
53 | 131 |
|
54 |
| -pre[class="language-markdown"], pre[class="language-md"] |
| 132 | +div[class*="language-markdown"] |
55 | 133 | &:before
|
56 | 134 | content "md"
|
57 | 135 |
|
58 |
| -pre[class="language-vue"]:before |
59 |
| - content "vue" |
60 |
| - |
61 |
| -pre[class="language-css"]:before |
62 |
| - content "css" |
63 |
| - |
64 |
| -pre[class="language-sass"]:before |
65 |
| - content "sass" |
66 |
| - |
67 |
| -pre[class="language-less"]:before |
68 |
| - content "less" |
69 |
| - |
70 |
| -pre[class="language-scss"]:before |
71 |
| - content "scss" |
72 |
| - |
73 |
| -pre[class="language-stylus"]:before |
74 |
| - content "stylus" |
75 |
| - |
76 |
| -pre[class="language-json"]:before |
| 136 | +div[class*="language-json"]:before |
77 | 137 | content "json"
|
78 | 138 |
|
79 |
| -pre[class="language-ruby"]:before |
| 139 | +div[class*="language-ruby"]:before |
80 | 140 | content "rb"
|
81 | 141 |
|
82 |
| -pre[class="language-python"]:before |
| 142 | +div[class*="language-python"]:before |
83 | 143 | content "py"
|
84 | 144 |
|
85 |
| -pre[class="language-go"]:before |
86 |
| - content "go" |
87 |
| - |
88 |
| -pre[class="language-java"]:before |
89 |
| - content "java" |
| 145 | +div[class*="language-bash"]:before |
| 146 | + content "sh" |
90 | 147 |
|
91 |
| -pre[class="language-c"]:before |
92 |
| - content "c" |
| 148 | +.examples |
| 149 | + div[class*="language-"] |
| 150 | + background: black |
| 151 | + border-color: #333 |
93 | 152 |
|
94 |
| -pre[class="language-bash"]:before |
95 |
| - content "sh" |
| 153 | + .highlighted |
| 154 | + background-color rgba(255, 255, 255, 0.2) !important |
0 commit comments