forked from mxx1111/mdlook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-options.ts
More file actions
124 lines (109 loc) · 4.24 KB
/
Copy pathconfig-options.ts
File metadata and controls
124 lines (109 loc) · 4.24 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
export type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
export type HeadingStyleType = 'default' | 'color-only' | 'border-bottom' | 'border-left' | 'custom'
/**
* Static option lists for MCP tools.
* Defined here (not imported from @md/shared/configs/style) because style.ts
* pulls in theme-css with Vite ?raw imports that Node.js cannot resolve.
*/
export const colorOptions = [
{ value: `#0F4C81`, label: `经典蓝`, desc: `稳重冷静` },
{ value: `#009874`, label: `翡翠绿`, desc: `自然平衡` },
{ value: `#FA5151`, label: `活力橘`, desc: `热情活力` },
{ value: `#FECE00`, label: `柠檬黄`, desc: `明亮温暖` },
{ value: `#92617E`, label: `薰衣紫`, desc: `优雅神秘` },
{ value: `#55C9EA`, label: `天空蓝`, desc: `清爽自由` },
{ value: `#B76E79`, label: `玫瑰金`, desc: `奢华现代` },
{ value: `#556B2F`, label: `橄榄绿`, desc: `沉稳自然` },
{ value: `#333333`, label: `石墨黑`, desc: `内敛极简` },
{ value: `#A9A9A9`, label: `雾烟灰`, desc: `柔和低调` },
{ value: `#FFB7C5`, label: `樱花粉`, desc: `浪漫甜美` },
] as const
export const themeOptions = [
{ value: `default`, label: `经典`, desc: `` },
{ value: `grace`, label: `优雅`, desc: `@brzhang` },
{ value: `simple`, label: `简洁`, desc: `@okooo5km` },
] as const
export const fontFamilyOptions = [
{
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: `Menlo, Monaco, 'Courier New', monospace`,
desc: `字体123Abc`,
},
] as const
export const fontSizeOptions = [
{ 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: `更大` },
] as const
export const legendOptions = [
{ 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: `` },
] as const
export type LegendValue = typeof legendOptions[number][`value`]
export const headingStyleOptions = [
{ label: `默认`, value: `default`, desc: `` },
{ label: `主题色文字`, value: `color-only`, desc: `` },
{ label: `下边框`, value: `border-bottom`, desc: `` },
{ label: `左边框`, value: `border-left`, desc: `` },
{ label: `自定义`, value: `custom`, desc: `` },
] as const
export type HeadingStylesInput = Partial<Record<HeadingLevel, HeadingStyleType>>
const codeBlockUrlPrefix = `https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/highlightjs/11.11.1/styles/`
const codeBlockThemeList = [
`github`,
`github-dark`,
`atom-one-light`,
`atom-one-dark`,
`monokai`,
`vs`,
`xcode`,
`nord`,
`tokyo-night-light`,
`tokyo-night-dark`,
] as const
export const codeBlockThemeOptions = codeBlockThemeList.map(name => ({
label: name,
value: `${codeBlockUrlPrefix}${name}.min.css`,
desc: ``,
}))
export const allowedCodeBlockThemeUrls = new Set(
codeBlockThemeOptions.map(option => option.value),
)
export function assertAllowedCodeBlockThemeUrl(url: string): void {
if (!allowedCodeBlockThemeUrls.has(url)) {
throw new Error(
`codeBlockTheme must be a preset URL from list_code_block_themes. Received: ${url}`,
)
}
}
export const defaultRenderOptions = {
theme: `default` as const,
primaryColor: colorOptions[0].value,
fontFamily: fontFamilyOptions[0].value,
fontSize: fontSizeOptions[2].value,
legend: legendOptions[3].value as LegendValue,
codeBlockTheme: codeBlockThemeOptions[0].value,
isMacCodeBlock: false,
isShowLineNumber: false,
citeStatus: false,
countStatus: false,
themeMode: `light` as const,
isUseIndent: false,
isUseJustify: false,
}