This repository was archived by the owner on Feb 10, 2025. It is now read-only.
File tree 8 files changed +234
-13
lines changed
views/chat/components/Message
8 files changed +234
-13
lines changed Original file line number Diff line number Diff line change 29
29
" dockerhub" ,
30
30
" esno" ,
31
31
" GPTAPI" ,
32
+ " hljs" ,
32
33
" iconify" ,
33
34
" logprobs" ,
34
35
" nodata" ,
Original file line number Diff line number Diff line change
1
+ ## v2.8.2
2
+
3
+ ` 2023-02-28 `
4
+ ### Enhancement
5
+ - 代码主题调整为 ` One Dark - light|dark ` 适配深色模式
6
+ ### BugFix
7
+ - 修复普通文本代码渲染和深色模式下的问题[ #139 ] [ #154 ]
8
+
1
9
## v2.8.1
2
10
3
11
` 2023-02-27 `
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ version: '3'
174
174
175
175
services :
176
176
app :
177
- image : chenzhaoyu94/chatgpt-web # 总是使用latest,更新时重新pull该tag镜像即可
177
+ image : chenzhaoyu94/chatgpt-web # 总是使用latest,更新时重新pull该tag镜像即可
178
178
ports :
179
179
- 3002:3002
180
180
environment :
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " chatgpt-web" ,
3
- "version" : " 2.8.1 " ,
3
+ "version" : " 2.8.2 " ,
4
4
"private" : false ,
5
5
"description" : " ChatGPT Web" ,
6
6
"author" :
" ChenZhaoYu <[email protected] >" ,
Original file line number Diff line number Diff line change 1
- import 'highlight.js/styles/xcode.css'
2
1
import '@/styles/lib/tailwind.css'
2
+ import '@/styles/lib/highlight.less'
3
3
import '@/styles/lib/github-markdown.less'
4
4
import '@/styles/global.less'
5
5
Original file line number Diff line number Diff line change
1
+ html .dark {
2
+ pre code .hljs {
3
+ display : block ;
4
+ overflow-x : auto ;
5
+ padding : 1em
6
+ }
7
+
8
+ code .hljs {
9
+ padding : 3px 5px
10
+ }
11
+
12
+ .hljs {
13
+ color : #abb2bf ;
14
+ background : #282c34
15
+ }
16
+
17
+ .hljs-keyword ,
18
+ .hljs-operator ,
19
+ .hljs-pattern-match {
20
+ color : #f92672
21
+ }
22
+
23
+ .hljs-function ,
24
+ .hljs-pattern-match .hljs-constructor {
25
+ color : #61aeee
26
+ }
27
+
28
+ .hljs-function .hljs-params {
29
+ color : #a6e22e
30
+ }
31
+
32
+ .hljs-function .hljs-params .hljs-typing {
33
+ color : #fd971f
34
+ }
35
+
36
+ .hljs-module-access .hljs-module {
37
+ color : #7e57c2
38
+ }
39
+
40
+ .hljs-constructor {
41
+ color : #e2b93d
42
+ }
43
+
44
+ .hljs-constructor .hljs-string {
45
+ color : #9ccc65
46
+ }
47
+
48
+ .hljs-comment ,
49
+ .hljs-quote {
50
+ color : #b18eb1 ;
51
+ font-style : italic
52
+ }
53
+
54
+ .hljs-doctag ,
55
+ .hljs-formula {
56
+ color : #c678dd
57
+ }
58
+
59
+ .hljs-deletion ,
60
+ .hljs-name ,
61
+ .hljs-section ,
62
+ .hljs-selector-tag ,
63
+ .hljs-subst {
64
+ color : #e06c75
65
+ }
66
+
67
+ .hljs-literal {
68
+ color : #56b6c2
69
+ }
70
+
71
+ .hljs-addition ,
72
+ .hljs-attribute ,
73
+ .hljs-meta .hljs-string ,
74
+ .hljs-regexp ,
75
+ .hljs-string {
76
+ color : #98c379
77
+ }
78
+
79
+ .hljs-built_in ,
80
+ .hljs-class .hljs-title ,
81
+ .hljs-title.class_ {
82
+ color : #e6c07b
83
+ }
84
+
85
+ .hljs-attr ,
86
+ .hljs-number ,
87
+ .hljs-selector-attr ,
88
+ .hljs-selector-class ,
89
+ .hljs-selector-pseudo ,
90
+ .hljs-template-variable ,
91
+ .hljs-type ,
92
+ .hljs-variable {
93
+ color : #d19a66
94
+ }
95
+
96
+ .hljs-bullet ,
97
+ .hljs-link ,
98
+ .hljs-meta ,
99
+ .hljs-selector-id ,
100
+ .hljs-symbol ,
101
+ .hljs-title {
102
+ color : #61aeee
103
+ }
104
+
105
+ .hljs-emphasis {
106
+ font-style : italic
107
+ }
108
+
109
+ .hljs-strong {
110
+ font-weight : 700
111
+ }
112
+
113
+ .hljs-link {
114
+ text-decoration : underline
115
+ }
116
+ }
117
+
118
+ html {
119
+ pre code .hljs {
120
+ display : block ;
121
+ overflow-x : auto ;
122
+ padding : 1em
123
+ }
124
+
125
+ code .hljs {
126
+ padding : 3px 5px
127
+ }
128
+
129
+ .hljs {
130
+ color : #383a42 ;
131
+ background : #fafafa
132
+ }
133
+
134
+ .hljs-comment ,
135
+ .hljs-quote {
136
+ color : #a0a1a7 ;
137
+ font-style : italic
138
+ }
139
+
140
+ .hljs-doctag ,
141
+ .hljs-formula ,
142
+ .hljs-keyword {
143
+ color : #a626a4
144
+ }
145
+
146
+ .hljs-deletion ,
147
+ .hljs-name ,
148
+ .hljs-section ,
149
+ .hljs-selector-tag ,
150
+ .hljs-subst {
151
+ color : #e45649
152
+ }
153
+
154
+ .hljs-literal {
155
+ color : #0184bb
156
+ }
157
+
158
+ .hljs-addition ,
159
+ .hljs-attribute ,
160
+ .hljs-meta .hljs-string ,
161
+ .hljs-regexp ,
162
+ .hljs-string {
163
+ color : #50a14f
164
+ }
165
+
166
+ .hljs-attr ,
167
+ .hljs-number ,
168
+ .hljs-selector-attr ,
169
+ .hljs-selector-class ,
170
+ .hljs-selector-pseudo ,
171
+ .hljs-template-variable ,
172
+ .hljs-type ,
173
+ .hljs-variable {
174
+ color : #986801
175
+ }
176
+
177
+ .hljs-bullet ,
178
+ .hljs-link ,
179
+ .hljs-meta ,
180
+ .hljs-selector-id ,
181
+ .hljs-symbol ,
182
+ .hljs-title {
183
+ color : #4078f2
184
+ }
185
+
186
+ .hljs-built_in ,
187
+ .hljs-class .hljs-title ,
188
+ .hljs-title.class_ {
189
+ color : #c18401
190
+ }
191
+
192
+ .hljs-emphasis {
193
+ font-style : italic
194
+ }
195
+
196
+ .hljs-strong {
197
+ font-weight : 700
198
+ }
199
+
200
+ .hljs-link {
201
+ text-decoration : underline
202
+ }
203
+ }
Original file line number Diff line number Diff line change @@ -24,11 +24,17 @@ renderer.html = (html) => {
24
24
25
25
renderer .code = (code , language ) => {
26
26
const validLang = !! (language && hljs .getLanguage (language ))
27
- const highlighted = validLang ? hljs .highlight (language , code ).value : code
28
- return ` <pre><code class="hljs ${language }">${highlighted }</code></pre> `
27
+ if (validLang )
28
+ return ` <pre><code class="hljs ${language }">${hljs .highlight (language , code ).value }</code></pre> `
29
+ return ` <pre style="background: none">${hljs .highlightAuto (code ).value }</pre> `
29
30
}
30
31
31
- marked .setOptions ({ renderer })
32
+ marked .setOptions ({
33
+ renderer ,
34
+ highlight(code ) {
35
+ return hljs .highlightAuto (code ).value
36
+ },
37
+ })
32
38
33
39
const wrapClass = computed (() => {
34
40
return [
Original file line number Diff line number Diff line change 2
2
background-color : transparent ;
3
3
font-size : 14px ;
4
4
5
- p {
5
+ p {
6
6
white-space : pre-wrap ;
7
7
}
8
8
23
23
pre {
24
24
background-color : #fff ;
25
25
}
26
+
27
+ code .hljs {
28
+ padding : 0 ;
29
+ }
26
30
}
27
31
28
- .dark {
29
- .markdown-body {
30
- .highlight pre ,
31
- pre {
32
- background-color : #18181c ;
33
- }
32
+ html .dark {
33
+
34
+ .highlight pre ,
35
+ pre {
36
+ background-color : #282c34 ;
34
37
}
35
38
}
You can’t perform that action at this time.
0 commit comments