forked from mxx1111/mdlook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle.ts
More file actions
313 lines (297 loc) · 6.59 KB
/
Copy pathstyle.ts
File metadata and controls
313 lines (297 loc) · 6.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
import type { IConfigOption } from '../types'
export const fontFamilyOptions: IConfigOption[] = [
{
label: `无衬线`,
value: `-apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif`,
desc: `字体123Abc`,
},
{
label: `衬线`,
value: `Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif`,
desc: `字体123Abc`,
},
{
label: `宋体`,
value: `'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', STSong, '宋体', Georgia, serif`,
desc: `字体123Abc`,
},
{
label: `仿宋(公文)`,
value: `FangSong, 'FangSong_GB2312', STFangsong, '仿宋', '仿宋_GB2312', 'Songti SC', serif`,
desc: `字体123Abc`,
},
{
label: `等宽`,
value: `Menlo, Monaco, 'Courier New', monospace`,
desc: `字体123Abc`,
},
]
export const fontSizeOptions: IConfigOption[] = [
{
label: `14px`,
value: `14px`,
desc: `更小`,
},
{
label: `15px`,
value: `15px`,
desc: `稍小`,
},
{
label: `16px`,
value: `16px`,
desc: `推荐`,
},
{
label: `17px`,
value: `17px`,
desc: `稍大`,
},
{
label: `18px`,
value: `18px`,
desc: `更大`,
},
]
export const colorOptions: IConfigOption[] = [
{
label: `经典蓝`,
value: `#0F4C81`,
desc: `稳重冷静`,
},
{
label: `珊瑚橙`,
value: `#D97757`,
desc: `温暖编辑感`,
},
{
label: `翡翠绿`,
value: `#009874`,
desc: `自然平衡`,
},
{
label: `活力橘`,
value: `#FA5151`,
desc: `热情活力`,
},
{
label: `柠檬黄`,
value: `#FECE00`,
desc: `明亮温暖`,
},
{
label: `薰衣紫`,
value: `#92617E`,
desc: `优雅神秘`,
},
{
label: `天空蓝`,
value: `#55C9EA`,
desc: `清爽自由`,
},
{
label: `玫瑰金`,
value: `#B76E79`,
desc: `奢华现代`,
},
{
label: `橄榄绿`,
value: `#556B2F`,
desc: `沉稳自然`,
},
{
label: `石墨黑`,
value: `#333333`,
desc: `内敛极简`,
},
{
label: `雾烟灰`,
value: `#A9A9A9`,
desc: `柔和低调`,
},
{
label: `樱花粉`,
value: `#FFB7C5`,
desc: `浪漫甜美`,
},
]
export const widthOptions: IConfigOption[] = [
{
label: `移动端`,
value: `w-[375px]`,
desc: `固定`,
},
{
label: `电脑端`,
value: `w-full`,
desc: `适应`,
},
]
const codeBlockUrlPrefix = `https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/highlightjs/11.11.1/styles/`
const codeBlockThemeList = [
`1c-light`,
`a11y-dark`,
`a11y-light`,
`agate`,
`an-old-hope`,
`androidstudio`,
`arduino-light`,
`arta`,
`ascetic`,
`atom-one-dark-reasonable`,
`atom-one-dark`,
`atom-one-light`,
`brown-paper`,
`codepen-embed`,
`color-brewer`,
`dark`,
`default`,
`devibeans`,
`docco`,
`far`,
`felipec`,
`foundation`,
`github-dark-dimmed`,
`github-dark`,
`github`,
`gml`,
`googlecode`,
`gradient-dark`,
`gradient-light`,
`grayscale`,
`hybrid`,
`idea`,
`intellij-light`,
`ir-black`,
`isbl-editor-dark`,
`isbl-editor-light`,
`kimbie-dark`,
`kimbie-light`,
`lightfair`,
`lioshi`,
`magula`,
`mono-blue`,
`monokai-sublime`,
`monokai`,
`night-owl`,
`nnfx-dark`,
`nnfx-light`,
`nord`,
`obsidian`,
`panda-syntax-dark`,
`panda-syntax-light`,
`paraiso-dark`,
`paraiso-light`,
`pojoaque`,
`purebasic`,
`qtcreator-dark`,
`qtcreator-light`,
`rainbow`,
`routeros`,
`school-book`,
`shades-of-purple`,
`srcery`,
`stackoverflow-dark`,
`stackoverflow-light`,
`sunburst`,
`tokyo-night-dark`,
`tokyo-night-light`,
`tomorrow-night-blue`,
`tomorrow-night-bright`,
`vs`,
`vs2015`,
`xcode`,
`xt256`,
]
export const codeBlockThemeOptions: IConfigOption[] = codeBlockThemeList.map(codeBlockTheme => ({
label: codeBlockTheme,
value: `${codeBlockUrlPrefix}${codeBlockTheme}.min.css`,
desc: ``,
}))
export const headingLevelOptions: IConfigOption[] = [
{ label: `一级标题`, value: `h1`, desc: `` },
{ label: `二级标题`, value: `h2`, desc: `` },
{ label: `三级标题`, value: `h3`, desc: `` },
{ label: `四级标题`, value: `h4`, desc: `` },
{ label: `五级标题`, value: `h5`, desc: `` },
{ label: `六级标题`, value: `h6`, desc: `` },
]
export const headingStyleOptions: IConfigOption[] = [
{ label: `默认`, value: `default`, desc: `` },
{ label: `主题色文字`, value: `color-only`, desc: `` },
{ label: `下边框`, value: `border-bottom`, desc: `` },
{ label: `左边框`, value: `border-left`, desc: `` },
{ label: `自定义`, value: `custom`, desc: `` },
]
export type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
export type HeadingStyleType = 'default' | 'color-only' | 'border-bottom' | 'border-left' | 'custom'
export type HeadingStyles = {
[K in HeadingLevel]?: HeadingStyleType
}
export const defaultHeadingStyles: HeadingStyles = {}
export const legendOptions: IConfigOption[] = [
{
label: `title 优先`,
value: `title-alt`,
desc: ``,
},
{
label: `alt 优先`,
value: `alt-title`,
desc: ``,
},
{
label: `只显示 title`,
value: `title`,
desc: ``,
},
{
label: `只显示 alt`,
value: `alt`,
desc: ``,
},
{
label: `文件名`,
value: `filename`,
desc: ``,
},
{
label: `不显示`,
value: `none`,
desc: ``,
},
]
export const defaultStyleConfig = {
isCiteStatus: false,
isMacCodeBlock: true,
isShowLineNumber: false,
isCountStatus: false,
theme: `claude`,
fontFamily: fontFamilyOptions[0].value,
fontSize: fontSizeOptions[2].value,
primaryColor: colorOptions[1].value,
codeBlockTheme: codeBlockThemeOptions[23].value,
legend: legendOptions[3].value,
headingStyles: defaultHeadingStyles as HeadingStyles,
}
export interface PerThemeSettings {
primaryColor: string
fontFamily: string
fontSize: string
codeBlockTheme: string
headingStyles: HeadingStyles
isShowLineNumber: boolean
isMacCodeBlock: boolean
}
export function defaultPerThemeSettings(): PerThemeSettings {
return {
primaryColor: defaultStyleConfig.primaryColor,
fontFamily: defaultStyleConfig.fontFamily,
fontSize: defaultStyleConfig.fontSize,
codeBlockTheme: defaultStyleConfig.codeBlockTheme,
headingStyles: { ...defaultStyleConfig.headingStyles },
isShowLineNumber: defaultStyleConfig.isShowLineNumber,
isMacCodeBlock: defaultStyleConfig.isMacCodeBlock,
}
}
export type PerThemeSettingsMap = Partial<Record<string, PerThemeSettings>>