@wenyan-md/core 2.0.4 → 2.0.6
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/dist/configStore-lZ5bhrcC.js +111 -0
- package/dist/core.js +18 -22
- package/dist/publish.js +156 -29
- package/dist/types/core/parser/frontMatterParser.d.ts +3 -1
- package/dist/types/http.d.ts +0 -4
- package/dist/types/node/configStore.d.ts +1 -2
- package/dist/types/node/publish.d.ts +9 -1
- package/dist/types/node/tokenStore.d.ts +18 -0
- package/dist/types/node/uploadCacheStore.d.ts +15 -0
- package/dist/types/node/utils.d.ts +6 -0
- package/dist/types/node/wrapper.d.ts +2 -0
- package/dist/types/wechat.d.ts +25 -3
- package/dist/wechat.js +16 -8
- package/dist/wrapper.js +7 -91
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
function safeReadJson(file, fallback) {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(fs.readFileSync(file, "utf-8"));
|
|
8
|
+
} catch {
|
|
9
|
+
return fallback;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function safeWriteJson(file, data) {
|
|
13
|
+
const tmp = file + ".tmp";
|
|
14
|
+
fs.writeFileSync(tmp, JSON.stringify(data ?? {}, null, 2), "utf-8");
|
|
15
|
+
fs.renameSync(tmp, file);
|
|
16
|
+
}
|
|
17
|
+
function ensureDir(dir) {
|
|
18
|
+
if (!fs.existsSync(dir)) {
|
|
19
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function md5FromBuffer(buf) {
|
|
23
|
+
return crypto.createHash("md5").update(buf).digest("hex");
|
|
24
|
+
}
|
|
25
|
+
function md5FromFile(filePath) {
|
|
26
|
+
const buf = fs.readFileSync(filePath);
|
|
27
|
+
return md5FromBuffer(buf);
|
|
28
|
+
}
|
|
29
|
+
const defaultConfig = {};
|
|
30
|
+
const configDir = process.env.APPDATA ? path.join(process.env.APPDATA, "wenyan-md") : path.join(os.homedir(), ".config", "wenyan-md");
|
|
31
|
+
const configPath = path.join(configDir, "config.json");
|
|
32
|
+
class ConfigStore {
|
|
33
|
+
config = { ...defaultConfig };
|
|
34
|
+
constructor() {
|
|
35
|
+
this.load();
|
|
36
|
+
}
|
|
37
|
+
load() {
|
|
38
|
+
ensureDir(configDir);
|
|
39
|
+
if (fs.existsSync(configPath)) {
|
|
40
|
+
this.config = {
|
|
41
|
+
...defaultConfig,
|
|
42
|
+
...safeReadJson(configPath, defaultConfig)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
save() {
|
|
47
|
+
try {
|
|
48
|
+
ensureDir(configDir);
|
|
49
|
+
safeWriteJson(configPath, this.config);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error("❌ 无法保存配置文件:", error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
getConfig() {
|
|
55
|
+
return this.config;
|
|
56
|
+
}
|
|
57
|
+
getThemes() {
|
|
58
|
+
return Object.values(this.config.themes ?? {});
|
|
59
|
+
}
|
|
60
|
+
getThemeById(themeId) {
|
|
61
|
+
const themeOption = this.config.themes?.[themeId];
|
|
62
|
+
if (!themeOption) return;
|
|
63
|
+
const absoluteFilePath = path.join(configDir, themeOption.path);
|
|
64
|
+
try {
|
|
65
|
+
return fs.readFileSync(absoluteFilePath, "utf-8");
|
|
66
|
+
} catch {
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
addThemeToConfig(name, content) {
|
|
71
|
+
const savedPath = this.addThemeFile(name, content);
|
|
72
|
+
this.config.themes ??= {};
|
|
73
|
+
this.config.themes[name] = {
|
|
74
|
+
id: name,
|
|
75
|
+
name,
|
|
76
|
+
path: savedPath
|
|
77
|
+
};
|
|
78
|
+
this.save();
|
|
79
|
+
}
|
|
80
|
+
addThemeFile(themeId, themeContent) {
|
|
81
|
+
const filePath = `themes/${themeId}.css`;
|
|
82
|
+
const absoluteFilePath = path.join(configDir, filePath);
|
|
83
|
+
ensureDir(path.dirname(absoluteFilePath));
|
|
84
|
+
fs.writeFileSync(absoluteFilePath, themeContent, "utf-8");
|
|
85
|
+
return filePath;
|
|
86
|
+
}
|
|
87
|
+
deleteThemeFromConfig(themeId) {
|
|
88
|
+
const theme = this.config.themes?.[themeId];
|
|
89
|
+
if (!theme) return;
|
|
90
|
+
this.deleteThemeFile(theme.path);
|
|
91
|
+
delete this.config.themes[themeId];
|
|
92
|
+
this.save();
|
|
93
|
+
}
|
|
94
|
+
deleteThemeFile(filePath) {
|
|
95
|
+
try {
|
|
96
|
+
fs.unlinkSync(path.join(configDir, filePath));
|
|
97
|
+
} catch {
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const configStore = new ConfigStore();
|
|
102
|
+
export {
|
|
103
|
+
configPath as a,
|
|
104
|
+
configStore as b,
|
|
105
|
+
configDir as c,
|
|
106
|
+
safeWriteJson as d,
|
|
107
|
+
ensureDir as e,
|
|
108
|
+
md5FromFile as f,
|
|
109
|
+
md5FromBuffer as m,
|
|
110
|
+
safeReadJson as s
|
|
111
|
+
};
|
package/dist/core.js
CHANGED
|
@@ -196,7 +196,7 @@ async function handleFrontMatter(markdown) {
|
|
|
196
196
|
const { attributes, body } = fm(markdown);
|
|
197
197
|
const result = { body: body || "" };
|
|
198
198
|
let head = "";
|
|
199
|
-
const { title, description, cover } = attributes;
|
|
199
|
+
const { title, description, cover, author, source_url } = attributes;
|
|
200
200
|
if (title) {
|
|
201
201
|
result.title = title;
|
|
202
202
|
}
|
|
@@ -210,6 +210,12 @@ async function handleFrontMatter(markdown) {
|
|
|
210
210
|
if (head) {
|
|
211
211
|
result.body = head + result.body;
|
|
212
212
|
}
|
|
213
|
+
if (author) {
|
|
214
|
+
result.author = author;
|
|
215
|
+
}
|
|
216
|
+
if (source_url) {
|
|
217
|
+
result.source_url = source_url;
|
|
218
|
+
}
|
|
213
219
|
return result;
|
|
214
220
|
}
|
|
215
221
|
const parseOptions = {
|
|
@@ -587,12 +593,12 @@ function renderTheme(wenyanElement, themeCss) {
|
|
|
587
593
|
const modifiedCss = themeModifier(themeCss);
|
|
588
594
|
createCssApplier(modifiedCss)(wenyanElement);
|
|
589
595
|
}
|
|
590
|
-
const __vite_glob_0_0 = "/**\n * 欢迎使用自定义主题功能,使用教程:\n * https://babyno.top/posts/2024/11/wenyan-supports-customized-themes/\n */\n/* 全局属性 */\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n/* 全局子元素属性 */\n/* 支持分组 */\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n/* 段落 */\n#wenyan p {\n}\n/* 加粗 */\n#wenyan p strong {\n}\n/* 斜体 */\n#wenyan p em {\n}\n/* 一级标题 */\n#wenyan h1 {\n text-align: center;\n text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n font-size: 1.5em;\n}\n/* 标题文字 */\n#wenyan h1 span {\n}\n/* 标题前缀,h1-h6都支持前缀 */\n#wenyan h1::before {\n}\n/* 标题后缀,h1-h6都支持后缀 */\n#wenyan h1::after {\n}\n/* 二级标题 */\n#wenyan h2 {\n text-align: center;\n font-size: 1.2em;\n border-bottom: 1px solid #f7f7f7;\n font-weight: bold;\n}\n/* 三-六级标题 */\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n font-size: 1em;\n font-weight: bold;\n}\n/* 列表 */\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n/* 列表元素 */\n#wenyan li {\n margin-left: 1.2em;\n}\n/* 图片 */\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n/* 表格 */\n#wenyan table {\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n/* 表格单元格 */\n#wenyan table td,\n#wenyan table th {\n font-size: 0.75em;\n padding: 9px 12px;\n line-height: 22px;\n color: #222;\n border: 1px solid #d8d8d8;\n vertical-align: top;\n}\n/* 表格表头 */\n#wenyan table th {\n font-weight: bold;\n background-color: #f0f0f0;\n}\n/* 表格斑马条纹效果 */\n#wenyan table tr:nth-child(
|
|
591
|
-
const __vite_glob_0_1 = "#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n line-height: 1.5;\n margin-top: 35px;\n margin-bottom: 10px;\n padding-bottom: 5px;\n}\n#wenyan h1 {\n font-size: 24px;\n line-height: 38px;\n margin-bottom: 5px;\n}\n#wenyan h2 {\n font-size: 22px;\n line-height: 34px;\n padding-bottom: 12px;\n border-bottom: 1px solid #ececec;\n}\n#wenyan h3 {\n font-size: 20px;\n line-height: 28px;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n display: inline-block !important;\n font-size: 12px;\n width: auto;\n max-width: 100%;\n overflow: auto;\n border: 1px solid #f6f6f6;\n}\n#wenyan thead {\n background: #f6f6f6;\n color: #000;\n text-align: left;\n}\n#wenyan table td,\n#wenyan table th {\n padding: 12px 7px;\n line-height: 24px;\n}\n#wenyan blockquote {\n color: #666;\n padding: 1px 23px;\n margin: 22px 0;\n border-left: 4px solid #cbcbcb;\n background-color: #f8f8f8;\n font-size: 0.95em;\n}\n#wenyan p code {\n background: #fff5f5;\n color: #ff502c;\n padding: 4px 6px;\n font-size: 0.78em;\n}\n#wenyan pre {\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n color: #333;\n background: #f8f8f8;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n background: #f8f8f8;\n}\n#wenyan hr {\n border: none;\n border-top: 1px solid #ddd;\n margin-top: 32px;\n margin-bottom: 32px;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n color: #0069c2;\n}\n/* 脚注 */\n#wenyan #footnotes
|
|
592
|
-
const __vite_glob_0_2 = "/*\n * Typora Theme - Lapis / Author - YiNN\n * https://github.com/YiNNx/typora-theme-lapis\n */\n\n:root {\n --text-color: #40464f;\n --primary-color: #4870ac;\n --bg-color: #ffffff;\n --marker-color: #a2b6d4;\n --source-color: #a8a8a9;\n --header-span-color: var(--primary-color);\n --block-bg-color: #f6f8fa;\n}\n#wenyan {\n
|
|
593
|
-
const __vite_glob_0_3 = '/*\n * Typora Theme - Maize / Author - BEATREE\n * https://github.com/BEATREE/typora-maize-theme\n */\n\n:root {\n --bg-color: #fafafa;\n --
|
|
594
|
-
const __vite_glob_0_4 = "#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1em 0;\n}\n#wenyan h1 {\n font-size: 2em;\n font-weight: 700;\n}\n#wenyan h2,\n#wenyan h3 {\n font-size: 1.3em;\n font-weight: 700;\n}\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n font-size: 1.2em;\n font-weight: 700;\n}\n#wenyan p {\n letter-spacing: -0.003em;\n margin: 1em 0;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n border-collapse: collapse;\n font-size: 15px;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n width: 100%;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table th {\n background: #ebeced;\n color: #191b1f;\n font-weight: 500;\n}\n#wenyan table td,\n#wenyan table th {\n border: 1px solid #c4c7ce;\n height: 24px;\n line-height: 24px;\n padding: 3px 12px;\n}\n#wenyan blockquote {\n letter-spacing: -0.003em;\n border-left: 3px solid rgba(0, 0, 0, 0.84);\n padding-left: 20px;\n margin: 0 0 20px 0;\n}\n#wenyan p code {\n padding: 4px 6px;\n font-size: 0.78em;\n border-radius: 3px;\n background-color: #f2f2f2;\n}\n#wenyan pre {\n line-height: 2;\n margin: 1em 0.5em;\n padding: 1em;\n background: #f9f9f9;\n border-radius: 4px;\n border: 1px solid #e5e5e5;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n background: #f9f9f9;\n}\n#wenyan hr {\n border: none;\n border-top: 1px solid #c4c7ce;\n margin: 2em auto;\n max-width: 100%;\n width: 240px;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n
|
|
595
|
-
const __vite_glob_0_5 = '/*\n * Typora Theme - Orange Heart / Author - evgo2017\n * https://github.com/evgo2017/typora-theme-orange-heart\n */\n\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1.2em 0 1em;\n padding: 0px;\n font-weight: bold;\n}\n#wenyan h1 {\n font-size: 1.5em;\n}\n#wenyan h2 {\n font-size: 1.3em;\n border-bottom: 2px solid rgb(239, 112, 96);\n display: flex;\n}\n#wenyan h2 span {\n display: inline-block;\n font-weight: bold;\n background: rgb(239, 112, 96);\n color: #ffffff;\n padding: 3px 10px 1px;\n border-top-right-radius: 3px;\n border-top-left-radius: 3px;\n margin-right: 3px;\n}\n#wenyan h2::after {\n content: "";\n border-bottom: 36px solid #efebe9;\n border-right: 20px solid transparent;\n align-self: flex-end;\n height: 0;\n}\n#wenyan h3 {\n font-size: 1.3em;\n}\n#wenyan h4 {\n font-size: 1.2em;\n}\n#wenyan h5 {\n font-size: 1.1em;\n}\n#wenyan h6 {\n font-size: 1em;\n}\n#wenyan ul,\n#wenyan ol {\n margin-top: 8px;\n margin-bottom: 8px;\n padding-left: 25px;\n color: black;\n}\n#wenyan ul {\n list-style-type: disc;\n}\n#wenyan ul ul {\n list-style-type: square;\n}\n#wenyan ol {\n list-style-type: decimal;\n}\n#wenyan blockquote {\n margin: 0;\n display: block;\n font-size: 0.9em;\n overflow: auto;\n border-left: 3px solid rgb(239, 112, 96);\n color: #6a737d;\n padding: 10px 10px 10px 20px;\n margin-bottom: 20px;\n margin-top: 20px;\n background: #fff9f9;\n}\n#wenyan a {\n text-decoration: none;\n word-wrap: break-word;\n font-weight: bold;\n color: rgb(239, 112, 96);\n border-bottom: 1px solid rgb(239, 112, 96);\n}\n#wenyan p code,\n#wenyan li code {\n font-size: 0.9em;\n word-wrap: break-word;\n padding: 2px 4px;\n border-radius: 4px;\n margin: 0 2px;\n color: rgb(239, 112, 96);\n background-color: rgba(27, 31, 35, 0.05);\n word-break: break-all;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan span img {\n max-width: 100%;\n display: inline-block;\n border-right: 0px;\n border-left: 0px;\n}\n#wenyan table {\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table td,\n#wenyan table th {\n font-size: 0.75em;\n padding: 9px 12px;\n line-height: 22px;\n
|
|
596
|
+
const __vite_glob_0_0 = "/**\n * 欢迎使用自定义主题功能,使用教程:\n * https://babyno.top/posts/2024/11/wenyan-supports-customized-themes/\n */\n/* 全局属性 */\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n/* 全局子元素属性 */\n/* 支持分组 */\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n/* 段落 */\n#wenyan p {\n}\n/* 加粗 */\n#wenyan p strong {\n}\n/* 斜体 */\n#wenyan p em {\n}\n/* 一级标题 */\n#wenyan h1 {\n text-align: center;\n text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n font-size: 1.5em;\n}\n/* 标题文字 */\n#wenyan h1 span {\n}\n/* 标题前缀,h1-h6都支持前缀 */\n#wenyan h1::before {\n}\n/* 标题后缀,h1-h6都支持后缀 */\n#wenyan h1::after {\n}\n/* 二级标题 */\n#wenyan h2 {\n text-align: center;\n font-size: 1.2em;\n border-bottom: 1px solid #f7f7f7;\n font-weight: bold;\n}\n/* 三-六级标题 */\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n font-size: 1em;\n font-weight: bold;\n}\n/* 列表 */\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n/* 列表元素 */\n#wenyan li {\n margin-left: 1.2em;\n}\n/* 图片 */\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n/* 表格 */\n#wenyan table {\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n/* 表格单元格 */\n#wenyan table td,\n#wenyan table th {\n font-size: 0.75em;\n padding: 9px 12px;\n line-height: 22px;\n color: #222;\n border: 1px solid #d8d8d8;\n vertical-align: top;\n}\n/* 表格表头 */\n#wenyan table th {\n font-weight: bold;\n background-color: #f0f0f0;\n}\n/* 表格斑马条纹效果 */\n#wenyan table tr:nth-child(even) {\n background-color: #f8f8f8;\n}\n#wenyan table tr:nth-child(odd) {\n background-color: #fff;\n}\n/* 引用块 */\n#wenyan blockquote {\n background: #afb8c133;\n border-left: 0.5em solid #ccc;\n margin: 1.5em 0;\n padding: 0.5em 10px;\n font-style: italic;\n font-size: 0.9em;\n}\n/* 引用块前缀 */\n#wenyan blockquote::before {\n}\n/* 引用块后缀 */\n#wenyan blockquote::after {\n}\n/* 行内代码 */\n#wenyan p code {\n color: #ff502c;\n padding: 4px 6px;\n font-size: 0.78em;\n}\n/* 代码块外围 */\n#wenyan pre {\n border-radius: 5px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;\n font-size: 12px;\n}\n/* 代码块 */\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n/* 分割线 */\n#wenyan hr {\n border: none;\n border-top: 1px solid #ddd;\n margin-top: 2em;\n margin-bottom: 2em;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n color: #0069c2;\n}\n/* 原始链接旁脚注上标 */\n#wenyan .footnote {\n color: #0069c2;\n}\n/* 脚注行 */\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n/* 脚注行内编号 */\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n/* 脚注行内文字 */\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n";
|
|
597
|
+
const __vite_glob_0_1 = "#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n line-height: 1.5;\n margin-top: 35px;\n margin-bottom: 10px;\n padding-bottom: 5px;\n}\n#wenyan h1 {\n font-size: 24px;\n line-height: 38px;\n margin-bottom: 5px;\n}\n#wenyan h2 {\n font-size: 22px;\n line-height: 34px;\n padding-bottom: 12px;\n border-bottom: 1px solid #ececec;\n}\n#wenyan h3 {\n font-size: 20px;\n line-height: 28px;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n display: inline-block !important;\n font-size: 12px;\n width: auto;\n max-width: 100%;\n overflow: auto;\n border: 1px solid #f6f6f6;\n}\n#wenyan thead {\n background: #f6f6f6;\n color: #000;\n text-align: left;\n}\n#wenyan table td,\n#wenyan table th {\n padding: 12px 7px;\n line-height: 24px;\n}\n#wenyan blockquote {\n color: #666;\n padding: 1px 23px;\n margin: 22px 0;\n border-left: 4px solid #cbcbcb;\n background-color: #f8f8f8;\n font-size: 0.95em;\n}\n#wenyan p code {\n background: #fff5f5;\n color: #ff502c;\n padding: 4px 6px;\n font-size: 0.78em;\n}\n#wenyan pre {\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n color: #333;\n background: #f8f8f8;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n background: #f8f8f8;\n}\n#wenyan hr {\n border: none;\n border-top: 1px solid #ddd;\n margin-top: 32px;\n margin-bottom: 32px;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n color: #0069c2;\n}\n/* 脚注 */\n#wenyan .footnote {\n color: #0069c2;\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n";
|
|
598
|
+
const __vite_glob_0_2 = "/*\n * Typora Theme - Lapis / Author - YiNN\n * https://github.com/YiNNx/typora-theme-lapis\n */\n\n:root {\n --text-color: #40464f;\n --primary-color: #4870ac;\n --bg-color: #ffffff;\n --marker-color: #a2b6d4;\n --source-color: #a8a8a9;\n --header-span-color: var(--primary-color);\n --block-bg-color: #f6f8fa;\n}\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan strong {\n color: var(--primary-color);\n}\n#wenyan a {\n word-wrap: break-word;\n color: var(--primary-color);\n}\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n font-weight: normal;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n padding: 0px;\n color: var(--primary-color);\n margin: 1.2em 0 1em;\n}\n#wenyan h1 {\n text-align: center;\n}\n#wenyan h2 {\n padding: 1px 12.5px;\n border-radius: 4px;\n display: inline-block;\n}\n#wenyan h2,\n#wenyan h2 code {\n background-color: var(--header-span-color);\n}\n#wenyan h2,\n#wenyan h2 a,\n#wenyan h2 code,\n#wenyan h2 strong {\n color: var(--bg-color);\n}\n#wenyan h1 {\n font-size: 1.5em;\n}\n#wenyan h2 {\n font-size: 1.3em;\n}\n#wenyan h3 {\n font-size: 1.3em;\n}\n#wenyan h4 {\n font-size: 1.2em;\n}\n#wenyan h5 {\n font-size: 1.2em;\n}\n#wenyan h6 {\n font-size: 1.2em;\n}\n#wenyan ul {\n list-style-type: disc;\n}\n#wenyan em {\n padding: 0 3px 0 0;\n}\n#wenyan ul ul {\n list-style-type: square;\n}\n#wenyan ol {\n list-style-type: decimal;\n}\n#wenyan blockquote {\n display: block;\n font-size: 0.9em;\n border-left: 3px solid var(--primary-color);\n padding: 0.5em 1em;\n margin: 0;\n background: var(--block-bg-color);\n color: var(--text-color);\n}\n#wenyan p code {\n color: var(--primary-color);\n font-size: 0.9em;\n font-weight: normal;\n word-wrap: break-word;\n padding: 2px 4px 2px;\n border-radius: 3px;\n margin: 2px;\n background-color: var(--block-bg-color);\n word-break: break-all;\n}\n#wenyan img {\n max-width: 100%;\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n display: table;\n text-align: justify;\n overflow-x: auto;\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table th,\n#wenyan table td {\n border: 1px solid #d9dfe4;\n padding: 9px 12px;\n font-size: 0.75em;\n line-height: 22px;\n vertical-align: top;\n}\n#wenyan table th {\n text-align: center;\n font-weight: bold;\n color: var(--primary-color);\n background: #f7f7f7;\n}\n#wenyan hr {\n margin-top: 20px;\n margin-bottom: 20px;\n border: 0;\n border-top: 2px solid #eef2f5;\n border-radius: 2px;\n}\n#wenyan pre {\n border-radius: 5px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n#wenyan .footnote {\n color: var(--primary-color);\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n";
|
|
599
|
+
const __vite_glob_0_3 = '/*\n * Typora Theme - Maize / Author - BEATREE\n * https://github.com/BEATREE/typora-maize-theme\n */\n\n:root {\n --bg-color: #fafafa;\n --primary-color: #428bca;\n}\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1.2em 0 1em;\n padding: 0px;\n font-weight: bold;\n}\n#wenyan h1 {\n font-size: 1.5em;\n}\n#wenyan h2::before {\n content: "";\n width: 20px;\n height: 30px;\n background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIj4KICAgIDxnPgogICAgICAgIDxwYXRoIGQ9Im0zMy40NTIgNjIuMTQyUzY2LjA2MyAxNC45MzcgOTAuNDU2IDEwLjI4M2wxLjQyOSAxLjcxNFM3Mi41MzIgMjkuNTgyIDU4LjEzMyA0OC41ODNDNDMuMDg0IDY4LjQ0MiAzNi4wNTggODkuOTQ3IDMxLjg4IDg5LjcxNWMtNS42ODEtLjQxLTEyLjQyOS0zNy43MTYtMjMuMjg3LTMzLjI4Ny0yLjI4Ni0uNTcxIDMuOTEyLTkuNjE0IDEyLjU3Mi03LjU3MiA1LjQzIDEuMjgxIDEyLjI4NyAxMy4yODYgMTIuMjg3IDEzLjI4NnoiIGZpbGw9IiNmZmIxMWIiIC8+CiAgICA8L2c+Cjwvc3ZnPg==);\n background-repeat: no-repeat;\n background-size: 20px 20px;\n margin-right: 4px;\n background-position-y: 10px;\n}\n#wenyan h2 {\n font-size: 1.3em;\n display: flex;\n align-items: top;\n}\n#wenyan h2 span {\n font-weight: bold;\n padding: 3px 10px 1px;\n}\n#wenyan h3 {\n font-size: 1.3em;\n}\n#wenyan h4 {\n font-size: 1.2em;\n}\n#wenyan h5 {\n font-size: 1.2em;\n}\n#wenyan h6 {\n font-size: 1.2em;\n}\n#wenyan ul,\n#wenyan ol {\n margin-top: 8px;\n margin-bottom: 8px;\n padding-left: 40px;\n}\n#wenyan ul {\n list-style-type: disc;\n}\n#wenyan ul ul {\n list-style-type: square;\n}\n#wenyan ol {\n list-style-type: decimal;\n}\n#wenyan strong {\n color: #e49123;\n font-weight: bold;\n}\n#wenyan blockquote {\n margin: 0;\n padding: 10px 10px 10px 20px;\n font-size: 0.9em;\n background: #fff9f9;\n border-left: 3px solid #ffb11b;\n color: #6a737d;\n overflow: auto;\n}\n#wenyan a {\n word-wrap: break-word;\n text-decoration: none;\n font-weight: bold;\n color: #e49123;\n border-bottom: 1px solid #e49123;\n}\n#wenyan hr {\n height: 1px;\n padding: 0;\n border: none;\n text-align: center;\n background-image: linear-gradient(\n to right,\n rgba(231, 93, 109, 0.3),\n rgba(255, 159, 150, 0.75),\n rgba(255, 216, 181, 0.3)\n );\n}\n#wenyan p code,\n#wenyan span code,\n#wenyan li code {\n word-wrap: break-word;\n padding: 2px 4px;\n border-radius: 4px;\n margin: 0 2px;\n word-break: break-all;\n color: rgb(235, 76, 55);\n background-color: #f0f0f0;\n font-size: 0.8em;\n}\n#wenyan img {\n max-width: 100%;\n display: block;\n margin: 0 auto;\n border-radius: 5px;\n box-shadow: 0px 4px 12px #84a1a8;\n border: 0px;\n}\n#wenyan table {\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table td,\n#wenyan table th {\n font-size: 0.75em;\n padding: 9px 12px;\n line-height: 22px;\n border: 1px solid rgb(255, 216, 181);\n vertical-align: top;\n}\n#wenyan table th {\n font-weight: bold;\n color: #ffb11b;\n background: #fff9f9;\n}\n#wenyan table td {\n color: #222;\n}\n#wenyan table tr:nth-child(even) {\n background: #fff9f9;\n}\n#wenyan table tr:nth-child(odd) {\n background-color: #fff;\n}\n#wenyan pre {\n border-radius: 5px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: 0.5em;\n box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: 0.5em;\n padding: 0;\n}\n#wenyan .footnote {\n font-weight: bold;\n color: #e49123;\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n';
|
|
600
|
+
const __vite_glob_0_4 = "#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1em 0;\n}\n#wenyan h1 {\n font-size: 2em;\n font-weight: 700;\n}\n#wenyan h2,\n#wenyan h3 {\n font-size: 1.3em;\n font-weight: 700;\n}\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n font-size: 1.2em;\n font-weight: 700;\n}\n#wenyan p {\n letter-spacing: -0.003em;\n margin: 1em 0;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n border-collapse: collapse;\n font-size: 15px;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n width: 100%;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table th {\n background: #ebeced;\n color: #191b1f;\n font-weight: 500;\n}\n#wenyan table td,\n#wenyan table th {\n border: 1px solid #c4c7ce;\n height: 24px;\n line-height: 24px;\n padding: 3px 12px;\n}\n#wenyan blockquote {\n letter-spacing: -0.003em;\n border-left: 3px solid rgba(0, 0, 0, 0.84);\n padding-left: 20px;\n margin: 0 0 20px 0;\n}\n#wenyan p code {\n padding: 4px 6px;\n font-size: 0.78em;\n border-radius: 3px;\n background-color: #f2f2f2;\n color: #222;\n}\n#wenyan pre {\n line-height: 2;\n margin: 1em 0.5em;\n padding: 1em;\n background: #f9f9f9;\n border-radius: 4px;\n border: 1px solid #e5e5e5;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n background: #f9f9f9;\n}\n#wenyan hr {\n border: none;\n border-top: 1px solid #c4c7ce;\n margin: 2em auto;\n max-width: 100%;\n width: 240px;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n word-break: break-all;\n}\n/* 脚注 */\n#wenyan .footnote {\n color: #000000;\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n";
|
|
601
|
+
const __vite_glob_0_5 = '/*\n * Typora Theme - Orange Heart / Author - evgo2017\n * https://github.com/evgo2017/typora-theme-orange-heart\n */\n\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1.2em 0 1em;\n padding: 0px;\n font-weight: bold;\n}\n#wenyan h1 {\n font-size: 1.5em;\n}\n#wenyan h2 {\n font-size: 1.3em;\n border-bottom: 2px solid rgb(239, 112, 96);\n display: flex;\n}\n#wenyan h2 span {\n display: inline-block;\n font-weight: bold;\n background: rgb(239, 112, 96);\n color: #ffffff;\n padding: 3px 10px 1px;\n border-top-right-radius: 3px;\n border-top-left-radius: 3px;\n margin-right: 3px;\n}\n#wenyan h2::after {\n content: "";\n border-bottom: 36px solid #efebe9;\n border-right: 20px solid transparent;\n align-self: flex-end;\n height: 0;\n}\n#wenyan h3 {\n font-size: 1.3em;\n}\n#wenyan h4 {\n font-size: 1.2em;\n}\n#wenyan h5 {\n font-size: 1.1em;\n}\n#wenyan h6 {\n font-size: 1em;\n}\n#wenyan ul,\n#wenyan ol {\n margin-top: 8px;\n margin-bottom: 8px;\n padding-left: 25px;\n color: black;\n}\n#wenyan ul {\n list-style-type: disc;\n}\n#wenyan ul ul {\n list-style-type: square;\n}\n#wenyan ol {\n list-style-type: decimal;\n}\n#wenyan blockquote {\n margin: 0;\n display: block;\n font-size: 0.9em;\n overflow: auto;\n border-left: 3px solid rgb(239, 112, 96);\n color: #6a737d;\n padding: 10px 10px 10px 20px;\n margin-bottom: 20px;\n margin-top: 20px;\n background: #fff9f9;\n}\n#wenyan a {\n text-decoration: none;\n word-wrap: break-word;\n font-weight: bold;\n color: rgb(239, 112, 96);\n border-bottom: 1px solid rgb(239, 112, 96);\n}\n#wenyan p code,\n#wenyan li code {\n font-size: 0.9em;\n word-wrap: break-word;\n padding: 2px 4px;\n border-radius: 4px;\n margin: 0 2px;\n color: rgb(239, 112, 96);\n background-color: rgba(27, 31, 35, 0.05);\n word-break: break-all;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan span img {\n max-width: 100%;\n display: inline-block;\n border-right: 0px;\n border-left: 0px;\n}\n#wenyan table {\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table td,\n#wenyan table th {\n font-size: 0.75em;\n padding: 9px 12px;\n line-height: 22px;\n border: 1px solid rgb(239, 112, 96);\n vertical-align: top;\n}\n#wenyan table th {\n font-weight: bold;\n background-color: #fff9f9;\n color: rgb(239, 112, 96);\n}\n#wenyan span code,\n#wenyan li code {\n color: rgb(239, 112, 96);\n}\n#wenyan pre {\n border-radius: 5px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n margin: .5em;\n padding: 0;\n}\n#wenyan .footnote {\n color: rgb(239, 112, 96);\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n';
|
|
596
602
|
const __vite_glob_0_6 = `/*
|
|
597
603
|
* Typora Theme - Phycat / Author - sumruler
|
|
598
604
|
* https://github.com/sumruler/typora-theme-phycat
|
|
@@ -634,17 +640,14 @@ const __vite_glob_0_6 = `/*
|
|
|
634
640
|
}
|
|
635
641
|
#wenyan {
|
|
636
642
|
font-size: 14px;
|
|
637
|
-
margin: 0 auto;
|
|
638
643
|
line-height: 1.75;
|
|
639
644
|
letter-spacing: 1.1px;
|
|
640
645
|
word-break: break-word;
|
|
641
646
|
word-wrap: break-word;
|
|
642
647
|
text-align: left;
|
|
643
|
-
background-position: center center;
|
|
644
648
|
}
|
|
645
649
|
#wenyan p {
|
|
646
650
|
text-align: justify;
|
|
647
|
-
color: #333;
|
|
648
651
|
margin: 10px 0;
|
|
649
652
|
word-spacing: 2px;
|
|
650
653
|
}
|
|
@@ -803,23 +806,17 @@ h6 {
|
|
|
803
806
|
border-radius: 4px;
|
|
804
807
|
line-height: 26px;
|
|
805
808
|
}
|
|
806
|
-
#wenyan blockquote p {
|
|
807
|
-
color: #000;
|
|
808
|
-
}
|
|
809
809
|
#wenyan a {
|
|
810
|
-
color: #000;
|
|
811
810
|
font-weight: bolder;
|
|
812
811
|
text-decoration: none;
|
|
813
812
|
border-bottom: 1px solid #3db8bf;
|
|
814
813
|
}
|
|
815
814
|
|
|
816
815
|
#wenyan strong {
|
|
817
|
-
color: #000;
|
|
818
816
|
font-weight: bold;
|
|
819
817
|
}
|
|
820
818
|
#wenyan em {
|
|
821
819
|
font-style: italic;
|
|
822
|
-
color: #000;
|
|
823
820
|
}
|
|
824
821
|
#wenyan del {
|
|
825
822
|
text-decoration-color: var(--element-color-deep);
|
|
@@ -877,7 +874,6 @@ h6 {
|
|
|
877
874
|
font-size: 10px;
|
|
878
875
|
padding: 9px 12px;
|
|
879
876
|
line-height: 22px;
|
|
880
|
-
color: #222;
|
|
881
877
|
border: 1px solid var(--element-color-deep);
|
|
882
878
|
vertical-align: top;
|
|
883
879
|
}
|
|
@@ -906,11 +902,11 @@ h6 {
|
|
|
906
902
|
word-break: break-all;
|
|
907
903
|
}
|
|
908
904
|
`;
|
|
909
|
-
const __vite_glob_0_7 = '/*\n * Typora Theme - Pie / Author - kevinzhao2233\n * https://github.com/kevinzhao2233/typora-theme-pie\n */\n\n:root {\n --mid-1: #ffffff;\n --mid-7: #8c8c8c;\n --mid-9: #434343;\n --mid-10: #262626;\n --main-1: #fff2f0;\n --main-4: #f27f79;\n --main-5: #e6514e;\n --main-6: #da282a;\n}\n#wenyan {\n line-height: 1.75;\n
|
|
910
|
-
const __vite_glob_0_8 = '/*\n * Typora Theme - Purple / Author - hliu202\n * https://github.com/hliu202/typora-purple-theme\n */\n\n:root {\n --title-color: #8064a9;\n --text-color: #444444;\n --link-color: #2aa899;\n --code-color: #745fb5;\n --shadow-color: #eee;\n --border-quote: rgba(116, 95, 181, 0.2);\n --border: #e7e7e7;\n --link-bottom: #bbb;\n --shadow: 3px 3px 10px var(--shadow-color);\n --inline-code-bg: #f4f2f9;\n --header-weight: normal;\n}\n#wenyan {\n
|
|
911
|
-
const __vite_glob_0_9 = '/*\n * Typora Theme - Rainbow / Author - thezbm\n * https://github.com/thezbm/typora-theme-rainbow\n */\n\n:root {\n --h-border-color: rgb(255, 191, 191);\n --h-bg-color: rgb(255, 232, 232);\n --table-border-color: rgb(255, 235, 211);\n --th-bg-color: rgb(255, 243, 228);\n --tr-bg-color: rgb(255, 249, 242);\n --code-bg-color: rgb(247, 247, 247);\n --block-shadow: 0.15em 0.15em 0.5em rgb(150, 150, 150);\n}\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1.2em 0 1em;\n padding: 0px;\n font-weight: bold;\n}\n#wenyan h1 {\n font-size: 1.5em;\n text-align: center;\n text-shadow: 0.15em 0.15em 0.3em rgb(187, 187, 187);\n}\n#wenyan h2 {\n font-size: 1.3em;\n background-color: var(--h-bg-color);\n padding-left: 1em;\n padding-right: 1em;\n border-left: 0.5em solid var(--h-border-color);\n border-radius: 0.4em;\n display: inline-block;\n}\n#wenyan h3 {\n font-size: 1.3em;\n text-decoration: underline double var(--h-border-color);\n -webkit-text-decoration: underline double var(--h-border-color);\n text-decoration-thickness: 0.15em;\n}\n#wenyan h4 {\n font-size: 1.2em;\n text-decoration: underline dotted var(--h-border-color);\n -webkit-text-decoration: underline dotted var(--h-border-color);\n text-decoration-thickness: 0.2em;\n}\n#wenyan table {\n border-collapse: collapse;\n border: 0.25em solid var(--table-border-color);\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table th {\n background-color: var(--th-bg-color);\n}\n#wenyan table th,\n#wenyan table td {\n font-size: 0.75em;\n text-align: center;\n border: 0.13em dashed var(--table-border-color);\n padding: 0.5em;\n padding: 9px 12px;\n line-height: 22px;\n vertical-align: top;\n}\n#wenyan table tr:nth-child(even) {\n background-color: var(--tr-bg-color);\n}\n#wenyan blockquote {\n font-size: 0.9em;\n margin: 0 1em;\n color: rgb(102, 102, 102);\n border-left: 0.25em solid rgb(169, 202, 255);\n padding: 0.5em 1em 0.6em 1em;\n}\n#wenyan blockquote::before {\n display: block;\n height: 2em;\n width: 1.5em;\n content: "🌈";\n font-size: 1.2em;\n}\n#wenyan blockquote p {\n margin: 0;\n}\n#wenyan hr {\n margin-top: 2em;\n margin-bottom: 2em;\n background-color: rgb(226, 226, 226);\n height: 0.13em;\n border: 0;\n}\n#wenyan pre {\n line-height: 2;\n padding: .5em;\n border-radius: 0.4em;\n box-shadow: var(--block-shadow);\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n#wenyan p code {\n margin-left: 0.25em;\n margin-right: 0.25em;\n padding: 0.05em 0.3em;\n
|
|
912
|
-
const __vite_glob_0_10 = '#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n font-size: 17px;\n line-height: 30px;\n margin-top: 20px;\n margin-bottom: 12px;\n position: relative;\n}\n#wenyan h1:before,\n#wenyan h2:before,\n#wenyan h3:before,\n#wenyan h4:before,\n#wenyan h5:before,\n#wenyan h6:before {\n content: "";\n display: inline-block;\n vertical-align: 1px;\n width: 10px;\n height: 26px;\n margin-right: 6px;\n background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIyNiIgdmlld0JveD0iMCAwIDEwIDI2IiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNOS41IDYuNTY2NTlMNC40OTk5NCAxOS40MzI2TDAgMTkuNDMyNkw1LjAwMDA2IDYuNTY2NTlMOS41IDYuNTY2NTlaIiBmaWxsPSIjRkY0MDNBIi8+Cjwvc3ZnPgo=);\n background-repeat: no-repeat;\n background-size: cover;\n background-position-y: 8px;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n margin-left: auto;\n margin-right: auto;\n border-collapse: collapse;\n table-layout: fixed;\n overflow: auto;\n border-spacing: 0;\n font-size: 1em;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table td,\n#wenyan table th {\n height: 40px;\n padding: 9px 12px;\n line-height: 22px;\n
|
|
913
|
-
const __vite_glob_0_11 = "#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2 {\n clear: left;\n font-size: 1.2em;\n font-weight: 600;\n line-height: 1.5;\n margin-bottom: 1.16667em;\n margin-top: 2.33333em;\n}\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n clear: left;\n font-size: 1.1em;\n font-weight: 600;\n line-height: 1.5;\n margin-bottom: 1.27273em;\n margin-top: 1.90909em;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n border-collapse: collapse;\n font-size: 15px;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n width: 100%;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table th {\n background: #ebeced;\n color: #191b1f;\n font-weight: 500;\n}\n#wenyan table td,\n#wenyan table th {\n border: 1px solid #c4c7ce;\n height: 24px;\n line-height: 24px;\n padding: 3px 12px;\n}\n#wenyan blockquote {\n border-left: 3px solid #c4c7ce;\n margin: 1.5em 0;\n padding: 0 0 1em 1em;\n color: #535861;\n}\n#wenyan code {\n margin: 0px 2px;\n padding: 3px 4px;\n border-radius: 3px;\n background-color: rgb(246, 246, 246);\n}\n#wenyan pre {\n word-wrap: normal;\n background: #f8f8fa;\n border-radius: 4px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n white-space: pre;\n word-break: normal;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n#wenyan hr {\n border: none;\n border-top: 1px solid #c4c7ce;\n margin: 2em auto;\n max-width: 100%;\n width: 240px;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n color: #0069c2;\n}\n/* 脚注 */\n#wenyan #footnotes
|
|
905
|
+
const __vite_glob_0_7 = '/*\n * Typora Theme - Pie / Author - kevinzhao2233\n * https://github.com/kevinzhao2233/typora-theme-pie\n */\n\n:root {\n --mid-1: #ffffff;\n --mid-7: #8c8c8c;\n --mid-9: #434343;\n --mid-10: #262626;\n --main-1: #fff2f0;\n --main-4: #f27f79;\n --main-5: #e6514e;\n --main-6: #da282a;\n}\n#wenyan {\n line-height: 1.75;\n letter-spacing: 0;\n font-size: 16px;\n}\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan p {\n word-spacing: 0.05rem;\n text-align: justify;\n}\n#wenyan a {\n word-wrap: break-word;\n color: var(--main-6);\n text-decoration: none;\n border-bottom: 1px solid var(--main-6);\n transition: border-bottom 0.2s;\n padding: 0 2px;\n font-weight: 500;\n text-decoration: none;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n position: relative;\n margin: 1.2em 0 1em;\n padding: 0px;\n font-weight: bold;\n cursor: text;\n}\n#wenyan h2 a,\n#wenyan h3 a {\n color: var(--mid-9);\n}\n#wenyan h1 {\n font-size: 1.5em;\n text-align: center;\n}\n#wenyan h1::after {\n display: block;\n width: 100px;\n height: 2px;\n margin: 0.2em auto 0;\n content: "";\n border-bottom: 2px dashed var(--main-6);\n}\n#wenyan h2 {\n padding-left: 6px;\n margin: 2em auto 1.4em;\n font-size: 1.3em;\n border-left: 6px solid var(--main-6);\n}\n#wenyan h3 {\n font-size: 1.2em;\n}\n#wenyan h3::before {\n display: inline-block;\n width: 6px;\n height: 6px;\n margin-right: 6px;\n margin-bottom: 0.18em;\n line-height: 1.43;\n vertical-align: middle;\n content: "";\n background-color: var(--main-5);\n border-radius: 50%;\n}\n#wenyan h4 {\n font-size: 1.2em;\n}\n#wenyan h4::before {\n display: inline-block;\n width: 6px;\n height: 2px;\n margin-right: 8px;\n margin-bottom: 0.18em;\n vertical-align: middle;\n content: "";\n background-color: var(--main-4);\n}\n#wenyan h5 {\n font-size: 1.2em;\n}\n#wenyan h6 {\n font-size: 1.2em;\n color: var(--mid-7);\n}\n#wenyan li > ol,\n#wenyan li > ul {\n margin: 0;\n}\n#wenyan hr {\n box-sizing: content-box;\n width: 100%;\n height: 1px;\n padding: 0;\n margin: 46px auto 64px;\n overflow: hidden;\n background-color: var(--main-4);\n border: 0;\n}\n#wenyan blockquote {\n position: relative;\n padding: 24px 16px 12px;\n margin: 24px 0 36px;\n font-size: 1em;\n font-style: normal;\n line-height: 1.6;\n color: var(--mid-7);\n text-indent: 0;\n border: none;\n border-left: 2px solid var(--main-6);\n}\n#wenyan blockquote blockquote {\n padding-right: 0;\n}\n#wenyan blockquote a {\n color: var(--mid-7);\n}\n#wenyan blockquote::before {\n position: absolute;\n top: 0;\n left: 12px;\n font-size: 2em;\n font-weight: 700;\n line-height: 1em;\n color: var(--main-6);\n content: "“";\n}\n#wenyan table {\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table td,\n#wenyan table th {\n font-size: 0.75em;\n padding: 9px 12px;\n line-height: 22px;\n vertical-align: top;\n border: 1px solid var(--main-4);\n}\n#wenyan table th {\n font-weight: bold;\n color: var(--main-6);\n background-color: var(--main-1);\n}\n#wenyan strong {\n padding: 0 1px;\n}\n#wenyan em {\n padding: 0 5px 0 2px;\n}\n#wenyan p code {\n padding: 2px 4px 1px;\n margin: 0 2px;\n font-size: 0.92rem;\n color: var(--main-5);\n background-color: var(--main-1);\n border-radius: 3px;\n}\n#wenyan p code {\n vertical-align: 0.5px;\n}\n#wenyan .footnote {\n color: var(--main-5);\n background-color: var(--main-1);\n}\n#wenyan img {\n max-width: 100%;\n display: block;\n margin: 0 auto;\n border-radius: 4px;\n}\n#wenyan pre {\n border-radius: 5px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n#wenyan .footnote {\n color: rgb(239, 112, 96);\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n';
|
|
906
|
+
const __vite_glob_0_8 = '/*\n * Typora Theme - Purple / Author - hliu202\n * https://github.com/hliu202/typora-purple-theme\n */\n\n:root {\n --title-color: #8064a9;\n --text-color: #444444;\n --link-color: #2aa899;\n --code-color: #745fb5;\n --shadow-color: #eee;\n --border-quote: rgba(116, 95, 181, 0.2);\n --border: #e7e7e7;\n --link-bottom: #bbb;\n --shadow: 3px 3px 10px var(--shadow-color);\n --inline-code-bg: #f4f2f9;\n --header-weight: normal;\n}\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan a {\n word-wrap: break-word;\n border-bottom: 1px solid var(--link-bottom);\n color: var(--link-color);\n text-decoration: none;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1.2em 0 1em;\n padding: 0px;\n font-weight: var(--header-weight);\n color: var(--title-color);\n}\n#wenyan h1 {\n text-align: center;\n}\n#wenyan h1::after {\n content: "";\n display: block;\n margin: 0.2em auto 0;\n width: 6em;\n height: 2px;\n border-bottom: 2px solid var(--title-color);\n}\n#wenyan h2 {\n padding-left: 0.4em;\n border-left: 0.4em solid var(--title-color);\n border-bottom: 1px solid var(--title-color);\n}\n#wenyan h1 {\n font-size: 1.5em;\n}\n#wenyan h2 {\n font-size: 1.3em;\n}\n#wenyan h3 {\n font-size: 1.2em;\n}\n#wenyan h4 {\n font-size: 1.2em;\n}\n#wenyan h5 {\n font-size: 1.2em;\n}\n#wenyan h6 {\n font-size: 1.2em;\n}\n#wenyan p,\n#wenyan ul,\n#wenyan ol {\n margin: 1em 0.8em;\n}\n#wenyan hr {\n margin: 1.5em auto;\n border-top: 1px solid var(--border);\n}\n#wenyan li > ol,\n#wenyan li > ul {\n margin: 0 0;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 2em;\n}\n#wenyan ol li,\n#wenyan ul li {\n padding-left: 0.1em;\n}\n#wenyan blockquote {\n margin: 0;\n border-left: 0.3em solid var(--border-quote);\n padding-left: 1em;\n}\n#wenyan table {\n border-collapse: collapse;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table td,\n#wenyan table th {\n font-size: 0.75em;\n padding: 9px 12px;\n line-height: 22px;\n border: 1px solid var(--border-quote);\n vertical-align: top;\n}\n#wenyan table th {\n font-weight: bold;\n color: var(--title-color);\n background-color: var(--inline-code-bg);\n}\n#wenyan strong {\n padding: 0 2px;\n font-weight: bold;\n}\n#wenyan p code {\n padding: 2px 4px;\n border-radius: 0.3em;\n font-size: 0.9em;\n color: var(--code-color);\n background-color: var(--inline-code-bg);\n margin: 0 2px;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan pre {\n border-radius: 5px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: 0.5em;\n box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: 0.5em;\n padding: 0;\n}\n#wenyan .footnote {\n color: var(--code-color);\n background-color: var(--inline-code-bg);\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n';
|
|
907
|
+
const __vite_glob_0_9 = '/*\n * Typora Theme - Rainbow / Author - thezbm\n * https://github.com/thezbm/typora-theme-rainbow\n */\n\n:root {\n --h-border-color: rgb(255, 191, 191);\n --h-bg-color: rgb(255, 232, 232);\n --table-border-color: rgb(255, 235, 211);\n --th-bg-color: rgb(255, 243, 228);\n --tr-bg-color: rgb(255, 249, 242);\n --code-bg-color: rgb(247, 247, 247);\n --block-shadow: 0.15em 0.15em 0.5em rgb(150, 150, 150);\n}\n#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n margin: 1.2em 0 1em;\n padding: 0px;\n font-weight: bold;\n}\n#wenyan h1 {\n font-size: 1.5em;\n text-align: center;\n text-shadow: 0.15em 0.15em 0.3em rgb(187, 187, 187);\n}\n#wenyan h2 {\n font-size: 1.3em;\n background-color: var(--h-bg-color);\n color: rgb(102, 102, 102);\n padding-left: 1em;\n padding-right: 1em;\n border-left: 0.5em solid var(--h-border-color);\n border-radius: 0.4em;\n display: inline-block;\n}\n#wenyan h3 {\n font-size: 1.3em;\n text-decoration: underline double var(--h-border-color);\n -webkit-text-decoration: underline double var(--h-border-color);\n text-decoration-thickness: 0.15em;\n}\n#wenyan h4 {\n font-size: 1.2em;\n text-decoration: underline dotted var(--h-border-color);\n -webkit-text-decoration: underline dotted var(--h-border-color);\n text-decoration-thickness: 0.2em;\n}\n#wenyan table {\n border-collapse: collapse;\n border: 0.25em solid var(--table-border-color);\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n overflow: auto;\n display: table;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table th {\n background-color: var(--th-bg-color);\n}\n#wenyan table th,\n#wenyan table td {\n font-size: 0.75em;\n text-align: center;\n border: 0.13em dashed var(--table-border-color);\n padding: 0.5em;\n padding: 9px 12px;\n line-height: 22px;\n vertical-align: top;\n color: #222;\n}\n#wenyan table tr:nth-child(even) {\n background-color: var(--tr-bg-color);\n}\n#wenyan table tr:nth-child(odd) {\n background-color: #fff;\n}\n#wenyan blockquote {\n font-size: 0.9em;\n margin: 0 1em;\n color: rgb(102, 102, 102);\n border-left: 0.25em solid rgb(169, 202, 255);\n padding: 0.5em 1em 0.6em 1em;\n}\n#wenyan blockquote::before {\n display: block;\n height: 2em;\n width: 1.5em;\n content: "🌈";\n font-size: 1.2em;\n}\n#wenyan blockquote p {\n margin: 0;\n}\n#wenyan hr {\n margin-top: 2em;\n margin-bottom: 2em;\n background-color: rgb(226, 226, 226);\n height: 0.13em;\n border: 0;\n}\n#wenyan pre {\n line-height: 2;\n padding: .5em;\n border-radius: 0.4em;\n box-shadow: var(--block-shadow);\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n#wenyan p code {\n margin-left: 0.25em;\n margin-right: 0.25em;\n padding: 0.05em 0.3em;\n border-radius: 0.4em;\n box-shadow: 0.13em 0.13em 0.26em rgb(197, 197, 197);\n font-size: 0.9em;\n}\n#wenyan a {\n word-wrap: break-word;\n color: rgb(31, 117, 255);\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n border-radius: 5px;\n box-shadow: var(--block-shadow);\n}\n#wenyan .footnote {\n color: rgb(31, 117, 255);\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n';
|
|
908
|
+
const __vite_glob_0_10 = '#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n font-size: 17px;\n line-height: 30px;\n margin-top: 20px;\n margin-bottom: 12px;\n position: relative;\n}\n#wenyan h1:before,\n#wenyan h2:before,\n#wenyan h3:before,\n#wenyan h4:before,\n#wenyan h5:before,\n#wenyan h6:before {\n content: "";\n display: inline-block;\n vertical-align: 1px;\n width: 10px;\n height: 26px;\n margin-right: 6px;\n background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIyNiIgdmlld0JveD0iMCAwIDEwIDI2IiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNOS41IDYuNTY2NTlMNC40OTk5NCAxOS40MzI2TDAgMTkuNDMyNkw1LjAwMDA2IDYuNTY2NTlMOS41IDYuNTY2NTlaIiBmaWxsPSIjRkY0MDNBIi8+Cjwvc3ZnPgo=);\n background-repeat: no-repeat;\n background-size: cover;\n background-position-y: 8px;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n margin-left: auto;\n margin-right: auto;\n border-collapse: collapse;\n table-layout: fixed;\n overflow: auto;\n border-spacing: 0;\n font-size: 1em;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table td,\n#wenyan table th {\n height: 40px;\n padding: 9px 12px;\n line-height: 22px;\n min-width: 88px;\n border: 1px solid #d8d8d8;\n vertical-align: top;\n}\n#wenyan blockquote {\n margin: 0;\n margin-bottom: 20px;\n padding: 0 16px;\n position: relative;\n color: #999;\n text-align: justify;\n}\n#wenyan blockquote:before {\n content: " ";\n left: 0;\n position: absolute;\n width: 2px;\n height: 100%;\n background: #f2f2f2;\n}\n#wenyan p code {\n color: #1e6bb8;\n}\n/* 代码块 */\n#wenyan pre {\n border-radius: 3px;\n border: 1px solid #e8e8e8;\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n#wenyan hr {\n width: 100%;\n height: 1px;\n background-color: #e8e8e8;\n border: none;\n margin: 20px 0;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n color: #0069c2;\n}\n/* 脚注 */\n#wenyan .footnote {\n color: #0069c2;\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n';
|
|
909
|
+
const __vite_glob_0_11 = "#wenyan {\n line-height: 1.75;\n font-size: 16px;\n}\n#wenyan * {\n box-sizing: border-box;\n}\n#wenyan h1,\n#wenyan h2,\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6,\n#wenyan p {\n margin: 1em 0;\n}\n#wenyan h1,\n#wenyan h2 {\n clear: left;\n font-size: 1.2em;\n font-weight: 600;\n line-height: 1.5;\n margin-bottom: 1.16667em;\n margin-top: 2.33333em;\n}\n#wenyan h3,\n#wenyan h4,\n#wenyan h5,\n#wenyan h6 {\n clear: left;\n font-size: 1.1em;\n font-weight: 600;\n line-height: 1.5;\n margin-bottom: 1.27273em;\n margin-top: 1.90909em;\n}\n#wenyan ul,\n#wenyan ol {\n padding-left: 1.2em;\n}\n#wenyan li {\n margin-left: 1.2em;\n}\n#wenyan img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n}\n#wenyan table {\n border-collapse: collapse;\n font-size: 15px;\n margin: 1.4em auto;\n max-width: 100%;\n table-layout: fixed;\n text-align: left;\n width: 100%;\n word-wrap: break-word;\n word-break: break-all;\n}\n#wenyan table th {\n background: #ebeced;\n color: #191b1f;\n font-weight: 500;\n}\n#wenyan table td,\n#wenyan table th {\n border: 1px solid #c4c7ce;\n height: 24px;\n line-height: 24px;\n padding: 3px 12px;\n}\n#wenyan table td {\n background-color: #fff;\n color: #222;\n}\n#wenyan blockquote {\n border-left: 3px solid #c4c7ce;\n margin: 1.5em 0;\n padding: 0 0 1em 1em;\n color: #535861;\n}\n#wenyan p code {\n margin: 0px 2px;\n padding: 3px 4px;\n border-radius: 3px;\n background-color: rgb(246, 246, 246);\n color: #222;\n}\n#wenyan pre {\n word-wrap: normal;\n background: #f8f8fa;\n border-radius: 4px;\n line-height: 2;\n margin: 1em 0.5em;\n padding: .5em;\n white-space: pre;\n word-break: normal;\n font-size: 12px;\n}\n#wenyan pre code {\n display: block;\n overflow-x: auto;\n margin: .5em;\n padding: 0;\n}\n#wenyan hr {\n border: none;\n border-top: 1px solid #c4c7ce;\n margin: 2em auto;\n max-width: 100%;\n width: 240px;\n}\n/* 链接 */\n#wenyan a {\n word-wrap: break-word;\n color: #0069c2;\n}\n/* 脚注 */\n#wenyan .footnote {\n color: #0069c2;\n}\n#wenyan #footnotes p {\n display: flex;\n margin: 0;\n font-size: 0.9em;\n}\n#wenyan .footnote-num {\n display: inline;\n width: 10%;\n}\n#wenyan .footnote-txt {\n display: inline;\n width: 90%;\n word-wrap: break-word;\n word-break: break-all;\n}\n";
|
|
914
910
|
const registry = /* @__PURE__ */ new Map();
|
|
915
911
|
function registerTheme(theme) {
|
|
916
912
|
registry.set(theme.meta.id, theme);
|
package/dist/publish.js
CHANGED
|
@@ -6,6 +6,8 @@ import { createWechatClient } from "./wechat.js";
|
|
|
6
6
|
import { FormDataEncoder } from "form-data-encoder";
|
|
7
7
|
import { FormData } from "formdata-node";
|
|
8
8
|
import { Readable } from "node:stream";
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import { c as configDir, e as ensureDir, s as safeReadJson, d as safeWriteJson, m as md5FromBuffer, f as md5FromFile } from "./configStore-lZ5bhrcC.js";
|
|
9
11
|
function normalizePath(p) {
|
|
10
12
|
return p.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
11
13
|
}
|
|
@@ -71,22 +73,114 @@ const nodeHttpAdapter = {
|
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
75
|
};
|
|
76
|
+
const tokenPath = path.join(configDir, "token.json");
|
|
77
|
+
const defaultCache = {
|
|
78
|
+
appid: "",
|
|
79
|
+
accessToken: "",
|
|
80
|
+
expireAt: 0
|
|
81
|
+
};
|
|
82
|
+
class TokenStore {
|
|
83
|
+
cache = defaultCache;
|
|
84
|
+
constructor() {
|
|
85
|
+
this.load();
|
|
86
|
+
}
|
|
87
|
+
load() {
|
|
88
|
+
ensureDir(configDir);
|
|
89
|
+
if (fs.existsSync(tokenPath)) {
|
|
90
|
+
this.cache = safeReadJson(tokenPath, defaultCache);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
save() {
|
|
94
|
+
try {
|
|
95
|
+
ensureDir(configDir);
|
|
96
|
+
safeWriteJson(tokenPath, this.cache);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error("❌ 无法保存 token:", error);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
isValid(appid) {
|
|
102
|
+
if (!this.cache) return false;
|
|
103
|
+
return this.cache.appid === appid && this.cache.expireAt > Date.now() / 1e3 + 600;
|
|
104
|
+
}
|
|
105
|
+
getToken(appid) {
|
|
106
|
+
return this.isValid(appid) ? this.cache.accessToken : null;
|
|
107
|
+
}
|
|
108
|
+
setToken(appid, accessToken, expiresIn) {
|
|
109
|
+
this.cache = {
|
|
110
|
+
appid,
|
|
111
|
+
accessToken,
|
|
112
|
+
expireAt: Math.floor(Date.now() / 1e3) + expiresIn
|
|
113
|
+
};
|
|
114
|
+
this.save();
|
|
115
|
+
}
|
|
116
|
+
clear() {
|
|
117
|
+
this.cache = defaultCache;
|
|
118
|
+
try {
|
|
119
|
+
if (fs.existsSync(tokenPath)) {
|
|
120
|
+
fs.unlinkSync(tokenPath);
|
|
121
|
+
}
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const tokenStore = new TokenStore();
|
|
127
|
+
const cachePath = path.join(configDir, "upload-cache.json");
|
|
128
|
+
class UploadCacheStore {
|
|
129
|
+
cache = {};
|
|
130
|
+
constructor() {
|
|
131
|
+
this.load();
|
|
132
|
+
}
|
|
133
|
+
load() {
|
|
134
|
+
ensureDir(configDir);
|
|
135
|
+
if (fs.existsSync(cachePath)) {
|
|
136
|
+
this.cache = safeReadJson(cachePath, {});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
save() {
|
|
140
|
+
try {
|
|
141
|
+
ensureDir(configDir);
|
|
142
|
+
safeWriteJson(cachePath, this.cache);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error("❌ 无法保存上传缓存:", error);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
get(md5) {
|
|
148
|
+
return this.cache[md5];
|
|
149
|
+
}
|
|
150
|
+
set(md5, mediaId, url) {
|
|
151
|
+
this.cache[md5] = { media_id: mediaId, url, updated_at: Date.now() };
|
|
152
|
+
this.save();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const uploadCacheStore = new UploadCacheStore();
|
|
74
156
|
const { uploadMaterial, publishArticle, fetchAccessToken } = createWechatClient(nodeHttpAdapter);
|
|
157
|
+
const mediaIdMapping = /* @__PURE__ */ new Map();
|
|
75
158
|
async function uploadImage(imageUrl, accessToken, fileName, relativePath) {
|
|
76
159
|
let fileData;
|
|
77
160
|
let finalName;
|
|
161
|
+
let md5;
|
|
78
162
|
if (imageUrl.startsWith("http")) {
|
|
79
163
|
const response = await fetch(imageUrl);
|
|
80
164
|
if (!response.ok || !response.body) {
|
|
81
165
|
throw new Error(`Failed to download image from URL: ${imageUrl}`);
|
|
82
166
|
}
|
|
167
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
168
|
+
if (arrayBuffer.byteLength === 0) {
|
|
169
|
+
throw new Error(`远程图片大小为0,无法上传: ${imageUrl}`);
|
|
170
|
+
}
|
|
171
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
172
|
+
md5 = md5FromBuffer(buffer);
|
|
173
|
+
const cached = uploadCacheStore.get(md5);
|
|
174
|
+
if (cached) {
|
|
175
|
+
mediaIdMapping.set(cached.url, cached.media_id);
|
|
176
|
+
return {
|
|
177
|
+
media_id: cached.media_id,
|
|
178
|
+
url: cached.url
|
|
179
|
+
};
|
|
180
|
+
}
|
|
83
181
|
const fileNameFromUrl = path.basename(imageUrl.split("?")[0]);
|
|
84
182
|
const ext = path.extname(fileNameFromUrl);
|
|
85
183
|
finalName = fileName ?? (ext === "" ? `${fileNameFromUrl}.jpg` : fileNameFromUrl);
|
|
86
|
-
const buffer = await response.arrayBuffer();
|
|
87
|
-
if (buffer.byteLength === 0) {
|
|
88
|
-
throw new Error(`远程图片大小为0,无法上传: ${imageUrl}`);
|
|
89
|
-
}
|
|
90
184
|
const contentType = response.headers.get("content-type") || "image/jpeg";
|
|
91
185
|
fileData = new Blob([buffer], { type: contentType });
|
|
92
186
|
} else {
|
|
@@ -95,6 +189,15 @@ async function uploadImage(imageUrl, accessToken, fileName, relativePath) {
|
|
|
95
189
|
if (stats.size === 0) {
|
|
96
190
|
throw new Error(`本地图片大小为0,无法上传: ${resolvedPath}`);
|
|
97
191
|
}
|
|
192
|
+
md5 = md5FromFile(resolvedPath);
|
|
193
|
+
const cached = uploadCacheStore.get(md5);
|
|
194
|
+
if (cached) {
|
|
195
|
+
mediaIdMapping.set(cached.url, cached.media_id);
|
|
196
|
+
return {
|
|
197
|
+
media_id: cached.media_id,
|
|
198
|
+
url: cached.url
|
|
199
|
+
};
|
|
200
|
+
}
|
|
98
201
|
const fileNameFromLocal = path.basename(resolvedPath);
|
|
99
202
|
const ext = path.extname(fileNameFromLocal);
|
|
100
203
|
finalName = fileName ?? (ext === "" ? `${fileNameFromLocal}.jpg` : fileNameFromLocal);
|
|
@@ -102,9 +205,8 @@ async function uploadImage(imageUrl, accessToken, fileName, relativePath) {
|
|
|
102
205
|
fileData = new Blob([await fileFromPathResult.arrayBuffer()], { type: fileFromPathResult.type });
|
|
103
206
|
}
|
|
104
207
|
const data = await uploadMaterial("image", fileData, finalName, accessToken);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
208
|
+
uploadCacheStore.set(md5, data.media_id, data.url);
|
|
209
|
+
mediaIdMapping.set(data.url, data.media_id);
|
|
108
210
|
return data;
|
|
109
211
|
}
|
|
110
212
|
async function uploadImages(content, accessToken, relativePath) {
|
|
@@ -132,27 +234,36 @@ async function uploadImages(content, accessToken, relativePath) {
|
|
|
132
234
|
const updatedHtml = dom.serialize();
|
|
133
235
|
return { html: updatedHtml, firstImageId };
|
|
134
236
|
}
|
|
135
|
-
async function
|
|
136
|
-
const {
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
if (!
|
|
141
|
-
|
|
142
|
-
throw new Error(`获取 Access Token 失败,错误码:${accessToken.errcode},${accessToken.errmsg}`);
|
|
143
|
-
} else {
|
|
144
|
-
throw new Error(`获取 Access Token 失败: ${accessToken}`);
|
|
145
|
-
}
|
|
237
|
+
async function publishToWechatDraft(articleOptions, publishOptions = {}) {
|
|
238
|
+
const { title, content, cover, author, source_url } = articleOptions;
|
|
239
|
+
const { appId, appSecret, relativePath } = publishOptions;
|
|
240
|
+
const appIdFinal = appId ?? process.env.WECHAT_APP_ID;
|
|
241
|
+
const appSecretFinal = appSecret ?? process.env.WECHAT_APP_SECRET;
|
|
242
|
+
if (!appIdFinal || !appSecretFinal) {
|
|
243
|
+
throw new Error("请通过参数或环境变量 WECHAT_APP_ID / WECHAT_APP_SECRET 提供公众号凭据");
|
|
146
244
|
}
|
|
147
|
-
const
|
|
245
|
+
const accessToken = await getAccessTokenWithCache(appIdFinal, appSecretFinal);
|
|
246
|
+
const { html, firstImageId } = await uploadImages(content, accessToken, relativePath);
|
|
148
247
|
let thumbMediaId = "";
|
|
149
248
|
if (cover) {
|
|
150
|
-
const
|
|
151
|
-
|
|
249
|
+
const cachedThumbMediaId = mediaIdMapping.get(cover);
|
|
250
|
+
if (cachedThumbMediaId) {
|
|
251
|
+
thumbMediaId = cachedThumbMediaId;
|
|
252
|
+
} else {
|
|
253
|
+
const resp = await uploadImage(cover, accessToken, "cover.jpg", relativePath);
|
|
254
|
+
thumbMediaId = resp.media_id;
|
|
255
|
+
mediaIdMapping.set(resp.url, resp.media_id);
|
|
256
|
+
}
|
|
152
257
|
} else {
|
|
153
258
|
if (firstImageId.startsWith("https://mmbiz.qpic.cn")) {
|
|
154
|
-
const
|
|
155
|
-
|
|
259
|
+
const cachedThumbMediaId = mediaIdMapping.get(firstImageId);
|
|
260
|
+
if (cachedThumbMediaId) {
|
|
261
|
+
thumbMediaId = cachedThumbMediaId;
|
|
262
|
+
} else {
|
|
263
|
+
const resp = await uploadImage(firstImageId, accessToken, "cover.jpg", relativePath);
|
|
264
|
+
thumbMediaId = resp.media_id;
|
|
265
|
+
mediaIdMapping.set(resp.url, resp.media_id);
|
|
266
|
+
}
|
|
156
267
|
} else {
|
|
157
268
|
thumbMediaId = firstImageId;
|
|
158
269
|
}
|
|
@@ -160,15 +271,31 @@ async function publishToDraft(title, content, cover = "", options = {}) {
|
|
|
160
271
|
if (!thumbMediaId) {
|
|
161
272
|
throw new Error("你必须指定一张封面图或者在正文中至少出现一张图片。");
|
|
162
273
|
}
|
|
163
|
-
const data = await publishArticle(
|
|
274
|
+
const data = await publishArticle(accessToken, {
|
|
275
|
+
title,
|
|
276
|
+
content: html,
|
|
277
|
+
thumb_media_id: thumbMediaId,
|
|
278
|
+
author,
|
|
279
|
+
content_source_url: source_url
|
|
280
|
+
});
|
|
164
281
|
if (data.media_id) {
|
|
165
282
|
return data;
|
|
166
|
-
} else if (data.errcode) {
|
|
167
|
-
throw new Error(`上传到公众号草稿失败,错误码:${data.errcode},${data.errmsg}`);
|
|
168
|
-
} else {
|
|
169
|
-
throw new Error(`上传到公众号草稿失败: ${data}`);
|
|
170
283
|
}
|
|
284
|
+
throw new Error(`上传到公众号草稿失败: ${JSON.stringify(data)}`);
|
|
285
|
+
}
|
|
286
|
+
async function publishToDraft(title, content, cover = "", options = {}) {
|
|
287
|
+
return publishToWechatDraft({ title, content, cover }, options);
|
|
288
|
+
}
|
|
289
|
+
async function getAccessTokenWithCache(appId, appSecret) {
|
|
290
|
+
const cached = tokenStore.getToken(appId);
|
|
291
|
+
if (cached) {
|
|
292
|
+
return cached;
|
|
293
|
+
}
|
|
294
|
+
const result = await fetchAccessToken(appId, appSecret);
|
|
295
|
+
tokenStore.setToken(appId, result.access_token, result.expires_in);
|
|
296
|
+
return result.access_token;
|
|
171
297
|
}
|
|
172
298
|
export {
|
|
173
|
-
publishToDraft
|
|
299
|
+
publishToDraft,
|
|
300
|
+
publishToWechatDraft
|
|
174
301
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export interface FrontMatterResult {
|
|
2
2
|
body: string;
|
|
3
3
|
title?: string;
|
|
4
|
-
description?: string;
|
|
5
4
|
cover?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
author?: string;
|
|
7
|
+
source_url?: string;
|
|
6
8
|
}
|
|
7
9
|
export declare function handleFrontMatter(markdown: string): Promise<FrontMatterResult>;
|
package/dist/types/http.d.ts
CHANGED
|
@@ -14,11 +14,10 @@ declare class ConfigStore {
|
|
|
14
14
|
constructor();
|
|
15
15
|
private load;
|
|
16
16
|
private save;
|
|
17
|
-
private mkdirIfNotExists;
|
|
18
17
|
getConfig(): WenyanConfig;
|
|
19
|
-
addThemeToConfig(name: string, content: string): void;
|
|
20
18
|
getThemes(): ThemeConfigOptions[];
|
|
21
19
|
getThemeById(themeId: string): string | undefined;
|
|
20
|
+
addThemeToConfig(name: string, content: string): void;
|
|
22
21
|
addThemeFile(themeId: string, themeContent: string): string;
|
|
23
22
|
deleteThemeFromConfig(themeId: string): void;
|
|
24
23
|
deleteThemeFile(filePath: string): void;
|
|
@@ -3,4 +3,12 @@ export interface PublishOptions {
|
|
|
3
3
|
appSecret?: string;
|
|
4
4
|
relativePath?: string;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface ArticleOptions {
|
|
7
|
+
title: string;
|
|
8
|
+
content: string;
|
|
9
|
+
cover?: string;
|
|
10
|
+
author?: string;
|
|
11
|
+
source_url?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function publishToWechatDraft(articleOptions: ArticleOptions, publishOptions?: PublishOptions): Promise<import("../wechat.js").WechatPublishResponse>;
|
|
14
|
+
export declare function publishToDraft(title: string, content: string, cover?: string, options?: PublishOptions): Promise<import("../wechat.js").WechatPublishResponse>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const tokenPath: string;
|
|
2
|
+
export interface TokenCache {
|
|
3
|
+
appid: string;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
expireAt: number;
|
|
6
|
+
}
|
|
7
|
+
declare class TokenStore {
|
|
8
|
+
private cache;
|
|
9
|
+
constructor();
|
|
10
|
+
private load;
|
|
11
|
+
private save;
|
|
12
|
+
isValid(appid: string): boolean;
|
|
13
|
+
getToken(appid: string): string | null;
|
|
14
|
+
setToken(appid: string, accessToken: string, expiresIn: number): void;
|
|
15
|
+
clear(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const tokenStore: TokenStore;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface MediaInfo {
|
|
2
|
+
media_id: string;
|
|
3
|
+
url: string;
|
|
4
|
+
updated_at?: number;
|
|
5
|
+
}
|
|
6
|
+
declare class UploadCacheStore {
|
|
7
|
+
private cache;
|
|
8
|
+
constructor();
|
|
9
|
+
private load;
|
|
10
|
+
private save;
|
|
11
|
+
get(md5: string): MediaInfo;
|
|
12
|
+
set(md5: string, mediaId: string, url: string): void;
|
|
13
|
+
}
|
|
14
|
+
export declare const uploadCacheStore: UploadCacheStore;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
export declare function safeReadJson<T>(file: string, fallback: T): T;
|
|
3
|
+
export declare function safeWriteJson(file: string, data: unknown): void;
|
|
4
|
+
export declare function ensureDir(dir: string): void;
|
|
5
|
+
export declare function md5FromBuffer(buf: crypto.BinaryLike): string;
|
|
6
|
+
export declare function md5FromFile(filePath: string): string;
|
|
@@ -4,6 +4,8 @@ export interface StyledContent {
|
|
|
4
4
|
title?: string;
|
|
5
5
|
cover?: string;
|
|
6
6
|
description?: string;
|
|
7
|
+
author?: string;
|
|
8
|
+
source_url?: string;
|
|
7
9
|
}
|
|
8
10
|
export declare function renderStyledContent(content: string, options?: ApplyStylesOptions): Promise<StyledContent>;
|
|
9
11
|
export declare function getGzhContent(content: string, themeId: string, hlThemeId: string, isMacStyle?: boolean, isAddFootnote?: boolean): Promise<StyledContent>;
|
package/dist/types/wechat.d.ts
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import type { HttpAdapter } from "./http.js";
|
|
2
|
+
export interface WechatPublishOptions {
|
|
3
|
+
title: string;
|
|
4
|
+
author?: string;
|
|
5
|
+
content: string;
|
|
6
|
+
thumb_media_id: string;
|
|
7
|
+
content_source_url?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface WechatErrorResponse {
|
|
10
|
+
errcode: number;
|
|
11
|
+
errmsg: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WechatUploadResponse {
|
|
14
|
+
media_id: string;
|
|
15
|
+
url: string;
|
|
16
|
+
}
|
|
17
|
+
export interface WechatTokenResponse {
|
|
18
|
+
access_token: string;
|
|
19
|
+
expires_in: number;
|
|
20
|
+
}
|
|
21
|
+
export interface WechatPublishResponse {
|
|
22
|
+
media_id: string;
|
|
23
|
+
}
|
|
2
24
|
export declare function createWechatClient(adapter: HttpAdapter): {
|
|
3
|
-
fetchAccessToken(appId: string, appSecret: string): Promise<
|
|
4
|
-
uploadMaterial(type: string, file: Blob, filename: string, accessToken: string): Promise<
|
|
5
|
-
publishArticle(
|
|
25
|
+
fetchAccessToken(appId: string, appSecret: string): Promise<WechatTokenResponse>;
|
|
26
|
+
uploadMaterial(type: string, file: Blob, filename: string, accessToken: string): Promise<WechatUploadResponse>;
|
|
27
|
+
publishArticle(accessToken: string, options: WechatPublishOptions): Promise<WechatPublishResponse>;
|
|
6
28
|
};
|
|
7
29
|
export type WechatClient = ReturnType<typeof createWechatClient>;
|
package/dist/wechat.js
CHANGED
|
@@ -8,7 +8,9 @@ function createWechatClient(adapter) {
|
|
|
8
8
|
`${tokenUrl}?grant_type=client_credential&appid=${appId}&secret=${appSecret}`
|
|
9
9
|
);
|
|
10
10
|
if (!res.ok) throw new Error(await res.text());
|
|
11
|
-
|
|
11
|
+
const data = await res.json();
|
|
12
|
+
assertWechatSuccess(data);
|
|
13
|
+
return data;
|
|
12
14
|
},
|
|
13
15
|
async uploadMaterial(type, file, filename, accessToken) {
|
|
14
16
|
const multipart = adapter.createMultipart("media", file, filename);
|
|
@@ -16,27 +18,33 @@ function createWechatClient(adapter) {
|
|
|
16
18
|
...multipart,
|
|
17
19
|
method: "POST"
|
|
18
20
|
});
|
|
21
|
+
if (!res.ok) throw new Error(await res.text());
|
|
19
22
|
const data = await res.json();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
if (data.url?.startsWith("http://")) {
|
|
23
|
+
assertWechatSuccess(data);
|
|
24
|
+
if (data.url.startsWith("http://")) {
|
|
24
25
|
data.url = data.url.replace(/^http:\/\//i, "https://");
|
|
25
26
|
}
|
|
26
27
|
return data;
|
|
27
28
|
},
|
|
28
|
-
async publishArticle(
|
|
29
|
+
async publishArticle(accessToken, options) {
|
|
29
30
|
const res = await adapter.fetch(`${publishUrl}?access_token=${accessToken}`, {
|
|
30
31
|
method: "POST",
|
|
31
32
|
body: JSON.stringify({
|
|
32
|
-
articles: [
|
|
33
|
+
articles: [options]
|
|
33
34
|
})
|
|
34
35
|
});
|
|
35
36
|
if (!res.ok) throw new Error(await res.text());
|
|
36
|
-
|
|
37
|
+
const data = await res.json();
|
|
38
|
+
assertWechatSuccess(data);
|
|
39
|
+
return data;
|
|
37
40
|
}
|
|
38
41
|
};
|
|
39
42
|
}
|
|
43
|
+
function assertWechatSuccess(data) {
|
|
44
|
+
if ("errcode" in data) {
|
|
45
|
+
throw new Error(`${data.errcode}: ${data.errmsg}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
40
48
|
export {
|
|
41
49
|
createWechatClient
|
|
42
50
|
};
|
package/dist/wrapper.js
CHANGED
|
@@ -1,92 +1,6 @@
|
|
|
1
1
|
import { JSDOM } from "jsdom";
|
|
2
2
|
import { createWenyanCore } from "./core.js";
|
|
3
|
-
import
|
|
4
|
-
import os from "node:os";
|
|
5
|
-
import fs from "node:fs";
|
|
6
|
-
const defaultConfig = {};
|
|
7
|
-
const configDir = process.env.APPDATA ? path.join(process.env.APPDATA, "wenyan-md") : path.join(os.homedir(), ".config", "wenyan-md");
|
|
8
|
-
const configPath = path.join(configDir, "config.json");
|
|
9
|
-
class ConfigStore {
|
|
10
|
-
config = { ...defaultConfig };
|
|
11
|
-
constructor() {
|
|
12
|
-
this.load();
|
|
13
|
-
}
|
|
14
|
-
load() {
|
|
15
|
-
if (fs.existsSync(configPath)) {
|
|
16
|
-
try {
|
|
17
|
-
const fileContent = fs.readFileSync(configPath, "utf-8");
|
|
18
|
-
this.config = { ...defaultConfig, ...JSON.parse(fileContent) };
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.warn("⚠️ 配置文件解析失败,将使用默认配置");
|
|
21
|
-
this.config = { ...defaultConfig };
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
save() {
|
|
26
|
-
this.mkdirIfNotExists();
|
|
27
|
-
try {
|
|
28
|
-
fs.writeFileSync(configPath, JSON.stringify(this.config, null, 2), "utf-8");
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error("❌ 无法保存配置文件:", error);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
mkdirIfNotExists(dir = configDir) {
|
|
34
|
-
try {
|
|
35
|
-
if (!fs.existsSync(dir)) {
|
|
36
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
37
|
-
}
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error("❌ 无法创建配置目录:", error);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
getConfig() {
|
|
43
|
-
return this.config;
|
|
44
|
-
}
|
|
45
|
-
addThemeToConfig(name, content) {
|
|
46
|
-
const savedPath = this.addThemeFile(name, content);
|
|
47
|
-
this.config.themes = this.config.themes || {};
|
|
48
|
-
this.config.themes[name] = {
|
|
49
|
-
id: name,
|
|
50
|
-
name,
|
|
51
|
-
path: savedPath
|
|
52
|
-
};
|
|
53
|
-
this.save();
|
|
54
|
-
}
|
|
55
|
-
getThemes() {
|
|
56
|
-
return this.config.themes ? Object.values(this.config.themes) : [];
|
|
57
|
-
}
|
|
58
|
-
getThemeById(themeId) {
|
|
59
|
-
const themeOption = this.config.themes ? this.config.themes[themeId] : void 0;
|
|
60
|
-
if (themeOption) {
|
|
61
|
-
const absoluteFilePath = path.join(configDir, themeOption.path);
|
|
62
|
-
if (fs.existsSync(absoluteFilePath)) {
|
|
63
|
-
return fs.readFileSync(absoluteFilePath, "utf-8");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return void 0;
|
|
67
|
-
}
|
|
68
|
-
addThemeFile(themeId, themeContent) {
|
|
69
|
-
const filePath = `themes/${themeId}.css`;
|
|
70
|
-
const absoluteFilePath = path.join(configDir, filePath);
|
|
71
|
-
this.mkdirIfNotExists(path.dirname(absoluteFilePath));
|
|
72
|
-
fs.writeFileSync(absoluteFilePath, themeContent, "utf-8");
|
|
73
|
-
return filePath;
|
|
74
|
-
}
|
|
75
|
-
deleteThemeFromConfig(themeId) {
|
|
76
|
-
if (this.config.themes && this.config.themes[themeId]) {
|
|
77
|
-
this.deleteThemeFile(this.config.themes[themeId].path);
|
|
78
|
-
delete this.config.themes[themeId];
|
|
79
|
-
this.save();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
deleteThemeFile(filePath) {
|
|
83
|
-
const absoluteFilePath = path.join(configDir, filePath);
|
|
84
|
-
if (fs.existsSync(absoluteFilePath)) {
|
|
85
|
-
fs.unlinkSync(absoluteFilePath);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const configStore = new ConfigStore();
|
|
3
|
+
import { c, a, b } from "./configStore-lZ5bhrcC.js";
|
|
90
4
|
const wenyanCoreInstance = await createWenyanCore();
|
|
91
5
|
async function renderStyledContent(content, options = {}) {
|
|
92
6
|
const preHandlerContent = await wenyanCoreInstance.handleFrontMatter(content);
|
|
@@ -99,7 +13,9 @@ async function renderStyledContent(content, options = {}) {
|
|
|
99
13
|
content: result,
|
|
100
14
|
title: preHandlerContent.title,
|
|
101
15
|
cover: preHandlerContent.cover,
|
|
102
|
-
description: preHandlerContent.description
|
|
16
|
+
description: preHandlerContent.description,
|
|
17
|
+
author: preHandlerContent.author,
|
|
18
|
+
source_url: preHandlerContent.source_url
|
|
103
19
|
};
|
|
104
20
|
}
|
|
105
21
|
async function getGzhContent(content, themeId, hlThemeId, isMacStyle = true, isAddFootnote = true) {
|
|
@@ -111,9 +27,9 @@ async function getGzhContent(content, themeId, hlThemeId, isMacStyle = true, isA
|
|
|
111
27
|
});
|
|
112
28
|
}
|
|
113
29
|
export {
|
|
114
|
-
configDir,
|
|
115
|
-
configPath,
|
|
116
|
-
configStore,
|
|
30
|
+
c as configDir,
|
|
31
|
+
a as configPath,
|
|
32
|
+
b as configStore,
|
|
117
33
|
getGzhContent,
|
|
118
34
|
renderStyledContent
|
|
119
35
|
};
|
package/package.json
CHANGED