md2any 1.0.0
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 +136 -0
- package/SKILL.md +80 -0
- package/bin/md2any.js +227 -0
- package/lib/actions.js +262 -0
- package/lib/converter.js +864 -0
- package/lib/extract.js +195 -0
- package/lib/llm.js +281 -0
- package/lib/social.js +264 -0
- package/lib/store.js +70 -0
- package/lib/themes.js +588 -0
- package/lib/zhihu.js +666 -0
- package/package.json +65 -0
- package/scripts/social_worker.js +774 -0
- package/scripts/xhs_screenshot.js +260 -0
package/lib/themes.js
ADDED
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
// 内置主题定义
|
|
5
|
+
// 每个主题包含:
|
|
6
|
+
// id — 唯一标识
|
|
7
|
+
// name — 显示名称
|
|
8
|
+
// css — 注入 article-wrapper 内部的 CSS(预览 & 复制均使用)
|
|
9
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
const THEMES = [
|
|
12
|
+
// ── 1. 微信经典(默认) ────────────────────────────────────────────────────
|
|
13
|
+
{
|
|
14
|
+
id: 'wechat',
|
|
15
|
+
name: '🟢 微信经典',
|
|
16
|
+
css: `
|
|
17
|
+
p, li, td, th {
|
|
18
|
+
color: #3f3f3f;
|
|
19
|
+
line-height: 1.75em;
|
|
20
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont,
|
|
21
|
+
'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
|
22
|
+
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
}
|
|
25
|
+
strong { font-weight: 600; color: rgb(0, 122, 170); }
|
|
26
|
+
a { color: orange; }
|
|
27
|
+
h1 { font-size: 140%; color: #de7456; text-align: center; }
|
|
28
|
+
h2 {
|
|
29
|
+
font-size: 120%; font-weight: bold; color: #de7456;
|
|
30
|
+
text-align: center; line-height: 2;
|
|
31
|
+
border-bottom: 1px solid #de7456;
|
|
32
|
+
margin: 1em auto; padding-bottom: 4px;
|
|
33
|
+
}
|
|
34
|
+
h3 {
|
|
35
|
+
font-size: 110%; color: rgb(0, 122, 170);
|
|
36
|
+
border-left: 3px solid rgb(0, 122, 170);
|
|
37
|
+
padding-left: 10px; margin: 24px 0;
|
|
38
|
+
}
|
|
39
|
+
h4, h5, h6 { font-size: 100%; color: rgb(0, 122, 170); margin: 16px 0; }
|
|
40
|
+
blockquote {
|
|
41
|
+
border-left: 4px solid #ddd; margin: 1.2em 0;
|
|
42
|
+
padding: 0.5em 1em; color: #666; background: #fafafa;
|
|
43
|
+
}
|
|
44
|
+
blockquote p { margin: 0; }
|
|
45
|
+
code {
|
|
46
|
+
background: #f0f0f0; padding: 2px 6px; border-radius: 3px;
|
|
47
|
+
font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
|
|
48
|
+
font-size: 14px; color: #c7254e;
|
|
49
|
+
}
|
|
50
|
+
table { border-collapse: collapse; width: 100%; margin: 1em 0; }
|
|
51
|
+
table td, table th { border: 1px solid #999; padding: 8px 10px; }
|
|
52
|
+
table th { background: #f2f2f2; font-weight: bold; text-align: center; }
|
|
53
|
+
ul, ol { padding-left: 1.5em; }
|
|
54
|
+
hr { border: none; border-top: 1px solid #eee; margin: 1.5em 0; }
|
|
55
|
+
figure { margin: 1.5em auto; text-align: center; }
|
|
56
|
+
figcaption { display: block; text-align: center; color: #999; font-size: 14px; margin-top: 8px; }
|
|
57
|
+
`,
|
|
58
|
+
wrapperBg: '#ffffff',
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// ── 2. Claude 风格 ────────────────────────────────────────────────────────
|
|
62
|
+
{
|
|
63
|
+
id: 'claude',
|
|
64
|
+
name: '🟠 Claude 风格',
|
|
65
|
+
css: `
|
|
66
|
+
p, li, td, th {
|
|
67
|
+
color: #1a1a1a;
|
|
68
|
+
line-height: 1.8em;
|
|
69
|
+
font-family: 'Georgia', 'Palatino Linotype', 'Book Antiqua',
|
|
70
|
+
'Noto Serif SC', 'Source Han Serif SC', serif;
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
letter-spacing: 0.01em;
|
|
73
|
+
}
|
|
74
|
+
strong { font-weight: 700; color: #d97706; }
|
|
75
|
+
a { color: #b45309; text-decoration: underline; text-underline-offset: 2px; }
|
|
76
|
+
h1 {
|
|
77
|
+
font-size: 1.8em; font-weight: 700; color: #92400e;
|
|
78
|
+
text-align: left; border-bottom: 2px solid #fbbf24;
|
|
79
|
+
padding-bottom: 8px; margin-bottom: 24px;
|
|
80
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
81
|
+
}
|
|
82
|
+
h2 {
|
|
83
|
+
font-size: 1.3em; font-weight: 700; color: #92400e;
|
|
84
|
+
text-align: left; margin-top: 2em; margin-bottom: 0.8em;
|
|
85
|
+
border-left: 4px solid #f59e0b; padding-left: 12px;
|
|
86
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
87
|
+
}
|
|
88
|
+
h3 {
|
|
89
|
+
font-size: 1.1em; font-weight: 600; color: #b45309;
|
|
90
|
+
margin-top: 1.5em; margin-bottom: 0.5em;
|
|
91
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
92
|
+
}
|
|
93
|
+
h4, h5, h6 {
|
|
94
|
+
font-size: 1em; font-weight: 600; color: #b45309;
|
|
95
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
96
|
+
}
|
|
97
|
+
blockquote {
|
|
98
|
+
border-left: 3px solid #f59e0b; margin: 1.5em 0;
|
|
99
|
+
padding: 0.8em 1.2em; color: #78350f;
|
|
100
|
+
background: #fffbeb; border-radius: 0 6px 6px 0;
|
|
101
|
+
}
|
|
102
|
+
blockquote p { margin: 0; }
|
|
103
|
+
code {
|
|
104
|
+
background: #fef3c7; padding: 2px 6px; border-radius: 4px;
|
|
105
|
+
font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
|
|
106
|
+
font-size: 13.5px; color: #92400e;
|
|
107
|
+
border: 1px solid #fde68a;
|
|
108
|
+
}
|
|
109
|
+
table { border-collapse: collapse; width: 100%; margin: 1.5em 0; }
|
|
110
|
+
table td, table th { border: 1px solid #fde68a; padding: 10px 14px; }
|
|
111
|
+
table th { background: #fef3c7; font-weight: 700; color: #92400e; text-align: left; }
|
|
112
|
+
table tr:nth-child(even) td { background: #fffbeb; }
|
|
113
|
+
ul, ol { padding-left: 1.6em; }
|
|
114
|
+
ul li::marker { color: #f59e0b; }
|
|
115
|
+
hr { border: none; border-top: 2px solid #fde68a; margin: 2em 0; }
|
|
116
|
+
figure { margin: 1.5em auto; text-align: center; }
|
|
117
|
+
figcaption { display: block; text-align: center; color: #a16207; font-size: 13px; margin-top: 8px; font-style: italic; }
|
|
118
|
+
p { margin: 1em 0; }
|
|
119
|
+
`,
|
|
120
|
+
wrapperBg: '#fffdf7',
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
// ── 3. macOS 简约 ─────────────────────────────────────────────────────────
|
|
124
|
+
{
|
|
125
|
+
id: 'macos',
|
|
126
|
+
name: '🍎 macOS 简约',
|
|
127
|
+
css: `
|
|
128
|
+
p, li, td, th {
|
|
129
|
+
color: #1d1d1f;
|
|
130
|
+
line-height: 1.7em;
|
|
131
|
+
font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue',
|
|
132
|
+
'PingFang SC', Arial, sans-serif;
|
|
133
|
+
font-size: 16px;
|
|
134
|
+
-webkit-font-smoothing: antialiased;
|
|
135
|
+
}
|
|
136
|
+
strong { font-weight: 600; color: #0071e3; }
|
|
137
|
+
a { color: #0071e3; text-decoration: none; }
|
|
138
|
+
a:hover { text-decoration: underline; }
|
|
139
|
+
h1 {
|
|
140
|
+
font-size: 2em; font-weight: 700; color: #1d1d1f; text-align: left;
|
|
141
|
+
letter-spacing: -0.03em; margin: 0.6em 0 0.4em;
|
|
142
|
+
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
|
|
143
|
+
}
|
|
144
|
+
h2 {
|
|
145
|
+
font-size: 1.4em; font-weight: 700; color: #1d1d1f;
|
|
146
|
+
letter-spacing: -0.02em; margin: 1.8em 0 0.6em;
|
|
147
|
+
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
|
|
148
|
+
}
|
|
149
|
+
h3 {
|
|
150
|
+
font-size: 1.1em; font-weight: 600; color: #1d1d1f;
|
|
151
|
+
margin: 1.4em 0 0.4em;
|
|
152
|
+
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
|
|
153
|
+
}
|
|
154
|
+
h4, h5, h6 { font-size: 1em; font-weight: 600; color: #6e6e73; }
|
|
155
|
+
blockquote {
|
|
156
|
+
border-left: none; margin: 1.5em 0; padding: 1em 1.4em;
|
|
157
|
+
background: #f5f5f7; border-radius: 12px; color: #3d3d3f;
|
|
158
|
+
}
|
|
159
|
+
blockquote p { margin: 0; }
|
|
160
|
+
code {
|
|
161
|
+
background: #f5f5f7; padding: 2px 7px; border-radius: 6px;
|
|
162
|
+
font-family: 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
|
|
163
|
+
font-size: 13.5px; color: #1d1d1f;
|
|
164
|
+
}
|
|
165
|
+
table { border-collapse: collapse; width: 100%; margin: 1.5em 0; border-radius: 8px; overflow: hidden; }
|
|
166
|
+
table td, table th { border: none; border-bottom: 1px solid #e5e5ea; padding: 10px 14px; }
|
|
167
|
+
table th { background: #f5f5f7; font-weight: 600; color: #1d1d1f; text-align: left; }
|
|
168
|
+
table tr:last-child td { border-bottom: none; }
|
|
169
|
+
ul, ol { padding-left: 1.6em; }
|
|
170
|
+
hr { border: none; border-top: 1px solid #e5e5ea; margin: 2em 0; }
|
|
171
|
+
figure { margin: 2em auto; text-align: center; }
|
|
172
|
+
figcaption { display: block; text-align: center; color: #6e6e73; font-size: 13px; margin-top: 8px; }
|
|
173
|
+
p { margin: 0.9em 0; }
|
|
174
|
+
img { border-radius: 8px; }
|
|
175
|
+
`,
|
|
176
|
+
wrapperBg: '#ffffff',
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
// ── 4. 深夜极客(暗色) ──────────────────────────────────────────────────
|
|
180
|
+
{
|
|
181
|
+
id: 'dark',
|
|
182
|
+
name: '🌙 深夜极客',
|
|
183
|
+
css: `
|
|
184
|
+
p, li, td, th {
|
|
185
|
+
color: #cdd6f4;
|
|
186
|
+
line-height: 1.8em;
|
|
187
|
+
font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono',
|
|
188
|
+
'SF Mono', Menlo, Consolas, monospace;
|
|
189
|
+
font-size: 15px;
|
|
190
|
+
}
|
|
191
|
+
strong { font-weight: 700; color: #89dceb; }
|
|
192
|
+
a { color: #89b4fa; text-decoration: none; border-bottom: 1px dashed #89b4fa; }
|
|
193
|
+
h1 {
|
|
194
|
+
font-size: 1.6em; font-weight: 700; color: #cba6f7;
|
|
195
|
+
text-align: left; margin: 0.8em 0 0.5em;
|
|
196
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
197
|
+
}
|
|
198
|
+
h2 {
|
|
199
|
+
font-size: 1.25em; font-weight: 700; color: #89b4fa;
|
|
200
|
+
margin: 1.8em 0 0.6em; padding: 6px 12px;
|
|
201
|
+
background: rgba(137,180,250,0.1); border-radius: 6px;
|
|
202
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
203
|
+
}
|
|
204
|
+
h3 {
|
|
205
|
+
font-size: 1.05em; font-weight: 600; color: #a6e3a1;
|
|
206
|
+
border-left: 3px solid #a6e3a1; padding-left: 10px;
|
|
207
|
+
margin: 1.2em 0 0.4em;
|
|
208
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
209
|
+
}
|
|
210
|
+
h4, h5, h6 { font-size: 1em; font-weight: 600; color: #f38ba8; }
|
|
211
|
+
blockquote {
|
|
212
|
+
border-left: 3px solid #6c7086; margin: 1.5em 0;
|
|
213
|
+
padding: 0.8em 1.2em; color: #a6adc8;
|
|
214
|
+
background: rgba(108,112,134,0.15); border-radius: 0 6px 6px 0;
|
|
215
|
+
}
|
|
216
|
+
blockquote p { margin: 0; }
|
|
217
|
+
code {
|
|
218
|
+
background: rgba(49,50,68,0.8); padding: 2px 7px; border-radius: 4px;
|
|
219
|
+
font-family: 'Cascadia Code', 'Fira Code', Menlo, monospace;
|
|
220
|
+
font-size: 13.5px; color: #f38ba8;
|
|
221
|
+
border: 1px solid #45475a;
|
|
222
|
+
}
|
|
223
|
+
table { border-collapse: collapse; width: 100%; margin: 1.5em 0; }
|
|
224
|
+
table td, table th { border: 1px solid #45475a; padding: 8px 12px; }
|
|
225
|
+
table th { background: rgba(49,50,68,0.8); font-weight: 600; color: #89b4fa; text-align: left; }
|
|
226
|
+
table tr:nth-child(even) td { background: rgba(49,50,68,0.4); }
|
|
227
|
+
ul, ol { padding-left: 1.6em; }
|
|
228
|
+
ul li::marker { color: #89b4fa; }
|
|
229
|
+
ol li::marker { color: #89b4fa; }
|
|
230
|
+
hr { border: none; border-top: 1px solid #45475a; margin: 2em 0; }
|
|
231
|
+
figure { margin: 1.5em auto; text-align: center; }
|
|
232
|
+
figcaption { display: block; text-align: center; color: #6c7086; font-size: 13px; margin-top: 8px; }
|
|
233
|
+
p { margin: 0.9em 0; }
|
|
234
|
+
`,
|
|
235
|
+
wrapperBg: '#1e1e2e',
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
// ── 5. 知乎精选 ────────────────────────────────────────────────────────────
|
|
239
|
+
{
|
|
240
|
+
id: 'zhihu',
|
|
241
|
+
name: '🔵 知乎精选',
|
|
242
|
+
css: `
|
|
243
|
+
p, li, td, th {
|
|
244
|
+
color: #1a1a1a;
|
|
245
|
+
line-height: 1.8em;
|
|
246
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
|
|
247
|
+
'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
|
|
248
|
+
font-size: 16px;
|
|
249
|
+
}
|
|
250
|
+
strong { font-weight: 600; color: #0f6fec; }
|
|
251
|
+
a { color: #0f6fec; text-decoration: none; }
|
|
252
|
+
a:hover { text-decoration: underline; }
|
|
253
|
+
h1 {
|
|
254
|
+
font-size: 1.7em; font-weight: 700; color: #121212;
|
|
255
|
+
text-align: left; border-bottom: 2px solid #0f6fec;
|
|
256
|
+
padding-bottom: 8px; margin-bottom: 20px;
|
|
257
|
+
}
|
|
258
|
+
h2 {
|
|
259
|
+
font-size: 1.3em; font-weight: 600; color: #0f6fec;
|
|
260
|
+
text-align: left; margin-top: 2em;
|
|
261
|
+
padding: 4px 0 4px 14px; border-left: 4px solid #0f6fec;
|
|
262
|
+
}
|
|
263
|
+
h3 { font-size: 1.1em; font-weight: 600; color: #121212; margin-top: 1.5em; }
|
|
264
|
+
h4, h5, h6 { font-size: 1em; font-weight: 600; color: #444; }
|
|
265
|
+
blockquote {
|
|
266
|
+
border-left: 3px solid #0f6fec; margin: 1.5em 0;
|
|
267
|
+
padding: 0.8em 1.2em; color: #666;
|
|
268
|
+
background: #f4f8ff; border-radius: 0 6px 6px 0;
|
|
269
|
+
}
|
|
270
|
+
blockquote p { margin: 0; }
|
|
271
|
+
code {
|
|
272
|
+
background: #f4f8ff; padding: 2px 6px; border-radius: 4px;
|
|
273
|
+
font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
|
|
274
|
+
font-size: 14px; color: #0f6fec; border: 1px solid #d0e4ff;
|
|
275
|
+
}
|
|
276
|
+
table { border-collapse: collapse; width: 100%; margin: 1.2em 0; }
|
|
277
|
+
table td, table th { border: 1px solid #dde5f0; padding: 10px 14px; }
|
|
278
|
+
table th { background: #f0f4ff; font-weight: 600; color: #0f6fec; text-align: left; }
|
|
279
|
+
table tr:nth-child(even) td { background: #f8f9fc; }
|
|
280
|
+
ul, ol { padding-left: 1.6em; }
|
|
281
|
+
ul li::marker { color: #0f6fec; }
|
|
282
|
+
hr { border: none; border-top: 1px solid #e0e0e0; margin: 2em 0; }
|
|
283
|
+
figure { margin: 1.5em auto; text-align: center; }
|
|
284
|
+
figcaption { display: block; text-align: center; color: #aaa; font-size: 13px; margin-top: 8px; }
|
|
285
|
+
p { margin: 1em 0; }
|
|
286
|
+
`,
|
|
287
|
+
wrapperBg: '#ffffff',
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
// ── 6. 极简黑白 ────────────────────────────────────────────────────────────
|
|
291
|
+
{
|
|
292
|
+
id: 'monochrome',
|
|
293
|
+
name: '⬛ 极简黑白',
|
|
294
|
+
css: `
|
|
295
|
+
p, li, td, th {
|
|
296
|
+
color: #111;
|
|
297
|
+
line-height: 1.85em;
|
|
298
|
+
font-family: 'Georgia', 'Noto Serif SC', 'Source Han Serif', serif;
|
|
299
|
+
font-size: 16px;
|
|
300
|
+
}
|
|
301
|
+
strong { font-weight: 700; color: #000; }
|
|
302
|
+
a { color: #333; text-decoration: underline; }
|
|
303
|
+
h1 {
|
|
304
|
+
font-size: 2em; font-weight: 700; color: #000;
|
|
305
|
+
text-align: center; letter-spacing: -0.02em;
|
|
306
|
+
border-bottom: 3px solid #000; padding-bottom: 10px; margin-bottom: 24px;
|
|
307
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
308
|
+
}
|
|
309
|
+
h2 {
|
|
310
|
+
font-size: 1.4em; font-weight: 700; color: #000;
|
|
311
|
+
text-align: left; margin-top: 2.5em;
|
|
312
|
+
border-bottom: 1px solid #000; padding-bottom: 4px;
|
|
313
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
314
|
+
}
|
|
315
|
+
h3 {
|
|
316
|
+
font-size: 1.15em; font-weight: 700; color: #000;
|
|
317
|
+
text-transform: uppercase; letter-spacing: 0.05em;
|
|
318
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
319
|
+
}
|
|
320
|
+
h4, h5, h6 { font-size: 1em; font-weight: 700; color: #333; font-family: system-ui, sans-serif; }
|
|
321
|
+
blockquote {
|
|
322
|
+
border-left: 4px solid #000; margin: 2em 0;
|
|
323
|
+
padding: 0.8em 1.4em; color: #444; background: #f9f9f9;
|
|
324
|
+
}
|
|
325
|
+
blockquote p { margin: 0; font-style: italic; }
|
|
326
|
+
code {
|
|
327
|
+
background: #f2f2f2; padding: 2px 6px; border-radius: 3px;
|
|
328
|
+
font-family: 'Cascadia Code', Menlo, Consolas, monospace;
|
|
329
|
+
font-size: 14px; color: #000; border: 1px solid #ddd;
|
|
330
|
+
}
|
|
331
|
+
table { border-collapse: collapse; width: 100%; margin: 1.5em 0; }
|
|
332
|
+
table td, table th { border: 1px solid #000; padding: 8px 12px; }
|
|
333
|
+
table th { background: #000; color: #fff; font-weight: 700; text-align: left; }
|
|
334
|
+
ul, ol { padding-left: 1.6em; }
|
|
335
|
+
ul li::marker { color: #000; }
|
|
336
|
+
hr { border: none; border-top: 2px solid #000; margin: 2.5em 0; }
|
|
337
|
+
figure { margin: 2em auto; text-align: center; }
|
|
338
|
+
figcaption { display: block; text-align: center; color: #888; font-size: 13px; margin-top: 8px; }
|
|
339
|
+
p { margin: 1.1em 0; }
|
|
340
|
+
img { filter: grayscale(10%); }
|
|
341
|
+
`,
|
|
342
|
+
wrapperBg: '#ffffff',
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
// ── 7. 春日清新 ────────────────────────────────────────────────────────────
|
|
346
|
+
{
|
|
347
|
+
id: 'spring',
|
|
348
|
+
name: '🌸 春日清新',
|
|
349
|
+
css: `
|
|
350
|
+
p, li, td, th {
|
|
351
|
+
color: #3d4040;
|
|
352
|
+
line-height: 1.85em;
|
|
353
|
+
font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
|
|
354
|
+
font-size: 16px;
|
|
355
|
+
}
|
|
356
|
+
strong { font-weight: 600; color: #e86f8c; }
|
|
357
|
+
a { color: #e86f8c; text-decoration: none; }
|
|
358
|
+
h1 {
|
|
359
|
+
font-size: 1.7em; font-weight: 700; color: #c94f72;
|
|
360
|
+
text-align: center; padding: 8px 0;
|
|
361
|
+
background: linear-gradient(90deg, transparent, #ffe4ee 30%, #ffe4ee 70%, transparent);
|
|
362
|
+
margin-bottom: 24px;
|
|
363
|
+
}
|
|
364
|
+
h2 {
|
|
365
|
+
font-size: 1.25em; font-weight: 700; color: #c94f72;
|
|
366
|
+
text-align: left; padding: 6px 12px;
|
|
367
|
+
background: #fff0f4; border-radius: 6px; margin-top: 2em;
|
|
368
|
+
border-left: 4px solid #e86f8c;
|
|
369
|
+
}
|
|
370
|
+
h3 {
|
|
371
|
+
font-size: 1.1em; font-weight: 600; color: #c94f72;
|
|
372
|
+
border-bottom: 1px dashed #f5a7be; padding-bottom: 4px; margin-top: 1.5em;
|
|
373
|
+
}
|
|
374
|
+
h4, h5, h6 { font-size: 1em; font-weight: 600; color: #d06080; }
|
|
375
|
+
blockquote {
|
|
376
|
+
border-left: 3px solid #f5a7be; margin: 1.5em 0;
|
|
377
|
+
padding: 0.8em 1.2em; color: #7a4050;
|
|
378
|
+
background: #fff5f7; border-radius: 0 8px 8px 0;
|
|
379
|
+
}
|
|
380
|
+
blockquote p { margin: 0; }
|
|
381
|
+
code {
|
|
382
|
+
background: #fff0f4; padding: 2px 6px; border-radius: 4px;
|
|
383
|
+
font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
|
|
384
|
+
font-size: 14px; color: #c94f72; border: 1px solid #f5a7be;
|
|
385
|
+
}
|
|
386
|
+
table { border-collapse: collapse; width: 100%; margin: 1.2em 0; }
|
|
387
|
+
table td, table th { border: 1px solid #f5c5d0; padding: 8px 12px; }
|
|
388
|
+
table th { background: #ffe4ee; font-weight: 600; color: #c94f72; text-align: left; }
|
|
389
|
+
table tr:nth-child(even) td { background: #fff8fa; }
|
|
390
|
+
ul, ol { padding-left: 1.6em; }
|
|
391
|
+
ul li::marker { color: #e86f8c; }
|
|
392
|
+
hr { border: none; border-top: 2px dashed #f5a7be; margin: 2em 0; }
|
|
393
|
+
figure { margin: 1.5em auto; text-align: center; }
|
|
394
|
+
figcaption { display: block; text-align: center; color: #c994a8; font-size: 13px; margin-top: 8px; }
|
|
395
|
+
p { margin: 1em 0; }
|
|
396
|
+
`,
|
|
397
|
+
wrapperBg: '#fff8fa',
|
|
398
|
+
},
|
|
399
|
+
|
|
400
|
+
// ── 8. 学术论文 ────────────────────────────────────────────────────────────
|
|
401
|
+
{
|
|
402
|
+
id: 'academic',
|
|
403
|
+
name: '📄 学术论文',
|
|
404
|
+
css: `
|
|
405
|
+
p, li, td, th {
|
|
406
|
+
color: #1a1a1a;
|
|
407
|
+
line-height: 2em;
|
|
408
|
+
font-family: 'Times New Roman', 'Noto Serif SC', 'Source Han Serif', Georgia, serif;
|
|
409
|
+
font-size: 16px;
|
|
410
|
+
text-align: justify;
|
|
411
|
+
}
|
|
412
|
+
strong { font-weight: 700; color: #1a1a1a; }
|
|
413
|
+
em { font-style: italic; }
|
|
414
|
+
a { color: #1a0dab; text-decoration: underline; }
|
|
415
|
+
h1 {
|
|
416
|
+
font-size: 1.6em; font-weight: 700; color: #1a1a1a;
|
|
417
|
+
text-align: center; margin: 0.5em 0 0.2em;
|
|
418
|
+
font-family: 'Times New Roman', Georgia, serif;
|
|
419
|
+
}
|
|
420
|
+
h2 {
|
|
421
|
+
font-size: 1.2em; font-weight: 700; color: #1a1a1a;
|
|
422
|
+
text-align: left; margin-top: 2em; counter-increment: section;
|
|
423
|
+
font-family: 'Times New Roman', Georgia, serif;
|
|
424
|
+
border: none; padding: 0;
|
|
425
|
+
}
|
|
426
|
+
h3 {
|
|
427
|
+
font-size: 1.05em; font-weight: 700; color: #1a1a1a;
|
|
428
|
+
font-style: italic; margin-top: 1.5em;
|
|
429
|
+
font-family: 'Times New Roman', Georgia, serif;
|
|
430
|
+
}
|
|
431
|
+
h4, h5, h6 {
|
|
432
|
+
font-size: 1em; font-weight: 700; color: #1a1a1a;
|
|
433
|
+
font-family: 'Times New Roman', Georgia, serif;
|
|
434
|
+
}
|
|
435
|
+
blockquote {
|
|
436
|
+
border-left: 2px solid #666; margin: 1.5em 2em;
|
|
437
|
+
padding: 0.5em 1em; color: #444; background: transparent;
|
|
438
|
+
}
|
|
439
|
+
blockquote p { margin: 0; font-style: italic; }
|
|
440
|
+
code {
|
|
441
|
+
background: #f5f5f5; padding: 1px 5px; border-radius: 2px;
|
|
442
|
+
font-family: 'Courier New', Courier, monospace;
|
|
443
|
+
font-size: 14px; color: #333;
|
|
444
|
+
}
|
|
445
|
+
table { border-collapse: collapse; width: 100%; margin: 1.5em auto; }
|
|
446
|
+
table td, table th { border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 6px 12px; border-left: none; border-right: none; }
|
|
447
|
+
table th { border-top: 2px solid #000; border-bottom: 2px solid #000; font-weight: 700; text-align: center; background: transparent; }
|
|
448
|
+
table tr:last-child td { border-bottom: 2px solid #000; }
|
|
449
|
+
ul, ol { padding-left: 2em; }
|
|
450
|
+
hr { border: none; border-top: 1px solid #999; margin: 2em auto; width: 60%; }
|
|
451
|
+
figure { margin: 1.5em auto; text-align: center; }
|
|
452
|
+
figcaption { display: block; text-align: center; color: #444; font-size: 14px; margin-top: 6px; font-style: italic; }
|
|
453
|
+
p { margin: 0.8em 0; text-indent: 2em; }
|
|
454
|
+
h1 + p, h2 + p, h3 + p, h4 + p { text-indent: 0; }
|
|
455
|
+
`,
|
|
456
|
+
wrapperBg: '#ffffff',
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
// ── 9. 小红书风格 ──────────────────────────────────────────────────────────
|
|
460
|
+
{
|
|
461
|
+
id: 'xhs',
|
|
462
|
+
name: '📱 小红书风格',
|
|
463
|
+
css: `
|
|
464
|
+
p, li, td, th {
|
|
465
|
+
color: #2c2c2c;
|
|
466
|
+
line-height: 1.95em;
|
|
467
|
+
font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
|
|
468
|
+
font-size: 17px;
|
|
469
|
+
}
|
|
470
|
+
strong { font-weight: 700; color: #ff2442; }
|
|
471
|
+
em { font-style: italic; color: #555; }
|
|
472
|
+
a { color: #ff2442; text-decoration: none; }
|
|
473
|
+
h1 {
|
|
474
|
+
font-size: 1.55em; font-weight: 800; color: #1a1a1a;
|
|
475
|
+
text-align: center;
|
|
476
|
+
padding: 16px 24px;
|
|
477
|
+
background: linear-gradient(135deg, #fff0f2 0%, #ffe4e8 100%);
|
|
478
|
+
border-radius: 16px; margin: 0.5em 0 1.5em;
|
|
479
|
+
letter-spacing: 0.03em;
|
|
480
|
+
}
|
|
481
|
+
h2 {
|
|
482
|
+
font-size: 1.2em; font-weight: 700; color: #1a1a1a;
|
|
483
|
+
padding: 10px 16px;
|
|
484
|
+
background: #fff5f7; border-radius: 10px; margin-top: 2em; margin-bottom: 0.8em;
|
|
485
|
+
border-left: 5px solid #ff2442;
|
|
486
|
+
}
|
|
487
|
+
h3 {
|
|
488
|
+
font-size: 1.08em; font-weight: 700; color: #ff2442;
|
|
489
|
+
margin-top: 1.8em; margin-bottom: 0.6em;
|
|
490
|
+
padding-left: 12px; border-left: 3px solid #ffb3c1;
|
|
491
|
+
}
|
|
492
|
+
h4, h5, h6 { font-size: 1em; font-weight: 700; color: #555; margin: 1.2em 0 0.5em; }
|
|
493
|
+
blockquote {
|
|
494
|
+
border-left: none; margin: 1.6em 0;
|
|
495
|
+
padding: 1em 1.4em; color: #555;
|
|
496
|
+
background: #fff8f9; border-radius: 12px;
|
|
497
|
+
border: 1.5px solid #ffd6dc;
|
|
498
|
+
}
|
|
499
|
+
blockquote p { margin: 0; }
|
|
500
|
+
code {
|
|
501
|
+
background: #fff0f2; padding: 3px 8px; border-radius: 6px;
|
|
502
|
+
font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
|
|
503
|
+
font-size: 14px; color: #cc1f3c; border: 1px solid #ffb3c1;
|
|
504
|
+
}
|
|
505
|
+
table { border-collapse: collapse; width: 100%; margin: 1.2em 0; border-radius: 10px; overflow: hidden; }
|
|
506
|
+
table td, table th { border: 1px solid #ffd6dc; padding: 10px 14px; }
|
|
507
|
+
table th { background: #ffe4e8; font-weight: 700; color: #cc1f3c; text-align: left; }
|
|
508
|
+
table tr:nth-child(even) td { background: #fff8f9; }
|
|
509
|
+
ul { padding-left: 1.4em; list-style: none; }
|
|
510
|
+
ul li { position: relative; padding-left: 1.2em; }
|
|
511
|
+
ul li::before { content: "♥"; position: absolute; left: 0; color: #ff2442; font-size: 0.75em; top: 0.25em; }
|
|
512
|
+
ol { padding-left: 1.8em; }
|
|
513
|
+
ol li::marker { color: #ff2442; font-weight: 700; }
|
|
514
|
+
hr { border: none; height: 2px; background: linear-gradient(90deg, transparent, #ffb3c1 20%, #ffb3c1 80%, transparent); margin: 2.5em 0; }
|
|
515
|
+
figure { margin: 1.8em auto; text-align: center; }
|
|
516
|
+
figcaption { display: block; text-align: center; color: #aaa; font-size: 13px; margin-top: 8px; }
|
|
517
|
+
p { margin: 1em 0; }
|
|
518
|
+
img { border-radius: 12px; max-width: 100%; }
|
|
519
|
+
`,
|
|
520
|
+
wrapperBg: '#fffcfd',
|
|
521
|
+
},
|
|
522
|
+
|
|
523
|
+
// ── 10. Notion 简洁 ────────────────────────────────────────────────────────
|
|
524
|
+
{
|
|
525
|
+
id: 'notion',
|
|
526
|
+
name: '📋 Notion 简洁',
|
|
527
|
+
css: `
|
|
528
|
+
p, li, td, th {
|
|
529
|
+
color: #37352f;
|
|
530
|
+
line-height: 1.75em;
|
|
531
|
+
font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
|
532
|
+
Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
533
|
+
font-size: 16px;
|
|
534
|
+
}
|
|
535
|
+
strong { font-weight: 600; color: #37352f; }
|
|
536
|
+
a { color: #0f7b6c; text-decoration: underline; text-underline-offset: 2px; }
|
|
537
|
+
h1 {
|
|
538
|
+
font-size: 1.875em; font-weight: 700; color: #37352f;
|
|
539
|
+
text-align: left; margin: 1.4em 0 0.4em; letter-spacing: -0.02em;
|
|
540
|
+
border: none;
|
|
541
|
+
}
|
|
542
|
+
h2 {
|
|
543
|
+
font-size: 1.4em; font-weight: 600; color: #37352f;
|
|
544
|
+
text-align: left; margin: 1.4em 0 0.4em; letter-spacing: -0.01em;
|
|
545
|
+
border: none; padding: 0;
|
|
546
|
+
}
|
|
547
|
+
h3 {
|
|
548
|
+
font-size: 1.15em; font-weight: 600; color: #37352f;
|
|
549
|
+
margin: 1.2em 0 0.3em; border: none; padding: 0;
|
|
550
|
+
}
|
|
551
|
+
h4, h5, h6 { font-size: 1em; font-weight: 600; color: #37352f; }
|
|
552
|
+
blockquote {
|
|
553
|
+
border-left: 3px solid #37352f30; margin: 1em 0;
|
|
554
|
+
padding: 0.4em 1em; color: #37352f99; background: transparent;
|
|
555
|
+
}
|
|
556
|
+
blockquote p { margin: 0; }
|
|
557
|
+
code {
|
|
558
|
+
background: rgba(135,131,120,.15); padding: 2px 6px; border-radius: 4px;
|
|
559
|
+
font-family: 'SFMono-Regular', Menlo, Consolas, 'PT Mono', 'Liberation Mono', Courier, monospace;
|
|
560
|
+
font-size: 85%; color: #eb5757;
|
|
561
|
+
}
|
|
562
|
+
table { border-collapse: collapse; width: 100%; margin: 1em 0; }
|
|
563
|
+
table td, table th { border: 1px solid rgba(55,53,47,.2); padding: 8px 12px; }
|
|
564
|
+
table th { background: rgba(55,53,47,.05); font-weight: 600; text-align: left; }
|
|
565
|
+
table tr:hover td { background: rgba(55,53,47,.03); }
|
|
566
|
+
ul, ol { padding-left: 1.7em; }
|
|
567
|
+
ul li::marker { color: #37352f99; }
|
|
568
|
+
hr { border: none; border-top: 1px solid rgba(55,53,47,.2); margin: 2em 0; }
|
|
569
|
+
figure { margin: 1.5em auto; text-align: center; }
|
|
570
|
+
figcaption { display: block; text-align: center; color: #37352f66; font-size: 13px; margin-top: 6px; }
|
|
571
|
+
p { margin: 0.6em 0; }
|
|
572
|
+
`,
|
|
573
|
+
wrapperBg: '#ffffff',
|
|
574
|
+
},
|
|
575
|
+
];
|
|
576
|
+
|
|
577
|
+
const DEFAULT_THEME_ID = 'wechat';
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* 根据 id 获取主题,不存在则返回默认
|
|
581
|
+
* @param {string} id
|
|
582
|
+
* @returns {{ id, name, css, wrapperBg }}
|
|
583
|
+
*/
|
|
584
|
+
function getTheme(id) {
|
|
585
|
+
return THEMES.find((t) => t.id === id) || THEMES[0];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
module.exports = { THEMES, DEFAULT_THEME_ID, getTheme };
|