czon 0.1.5 → 0.1.7
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/.prettierignore +4 -1
- package/dist/ai/extractMetadataFromMarkdown.js +22 -7
- package/dist/ai/extractMetadataFromMarkdown.js.map +1 -1
- package/dist/build/pipeline.d.ts.map +1 -1
- package/dist/build/pipeline.js +8 -85
- package/dist/build/pipeline.js.map +1 -1
- package/dist/process/enhanceMarkdownSource.d.ts +5 -0
- package/dist/process/enhanceMarkdownSource.d.ts.map +1 -0
- package/dist/process/enhanceMarkdownSource.js +64 -0
- package/dist/process/enhanceMarkdownSource.js.map +1 -0
- package/dist/process/extractMetadataByAI.js +1 -1
- package/dist/process/extractMetadataByAI.js.map +1 -1
- package/dist/process/processTranslations.d.ts +5 -0
- package/dist/process/processTranslations.d.ts.map +1 -0
- package/dist/process/processTranslations.js +58 -0
- package/dist/process/processTranslations.js.map +1 -0
- package/dist/process/template.d.ts +2 -2
- package/dist/process/template.d.ts.map +1 -1
- package/dist/process/template.js +63 -155
- package/dist/process/template.js.map +1 -1
- package/dist/ssg/ContentPage.d.ts +9 -0
- package/dist/ssg/ContentPage.d.ts.map +1 -0
- package/{assets/templates/default/layout.html → dist/ssg/ContentPage.js} +73 -61
- package/dist/ssg/ContentPage.js.map +1 -0
- package/dist/ssg/RedirectPage.d.ts +6 -0
- package/dist/ssg/RedirectPage.d.ts.map +1 -0
- package/dist/ssg/RedirectPage.js +24 -0
- package/dist/ssg/RedirectPage.js.map +1 -0
- package/dist/ssg/app.d.ts +4 -0
- package/dist/ssg/app.d.ts.map +1 -0
- package/dist/ssg/app.js +44 -0
- package/dist/ssg/app.js.map +1 -0
- package/dist/ssg/components/LanguageSwitcher.d.ts +8 -0
- package/dist/ssg/components/LanguageSwitcher.d.ts.map +1 -0
- package/dist/ssg/components/LanguageSwitcher.js +21 -0
- package/dist/ssg/components/LanguageSwitcher.js.map +1 -0
- package/dist/ssg/components/Navigator.d.ts +7 -0
- package/dist/ssg/components/Navigator.d.ts.map +1 -0
- package/dist/ssg/components/Navigator.js +17 -0
- package/dist/ssg/components/Navigator.js.map +1 -0
- package/dist/ssg/components/TagList.d.ts +5 -0
- package/dist/ssg/components/TagList.d.ts.map +1 -0
- package/dist/ssg/components/TagList.js +12 -0
- package/dist/ssg/components/TagList.js.map +1 -0
- package/dist/ssg/index.d.ts +3 -0
- package/dist/ssg/index.d.ts.map +1 -0
- package/dist/ssg/index.js +14 -0
- package/dist/ssg/index.js.map +1 -0
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/writeFile.d.ts +5 -0
- package/dist/utils/writeFile.d.ts.map +1 -1
- package/dist/utils/writeFile.js +5 -0
- package/dist/utils/writeFile.js.map +1 -1
- package/package.json +5 -1
- package/tsconfig.json +1 -0
- package/.github/workflows/bump-version.yml +0 -112
- package/.github/workflows/ci.yml +0 -64
- package/.github/workflows/pages.yml +0 -61
- package/.github/workflows/publish.yml +0 -81
- package/.husky/pre-commit +0 -1
package/dist/process/template.js
CHANGED
|
@@ -33,175 +33,83 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.spiderStaticSiteGenerator = void 0;
|
|
37
37
|
const fs = __importStar(require("fs/promises"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
|
-
const languages_1 = require("../languages");
|
|
40
39
|
const metadata_1 = require("../metadata");
|
|
41
40
|
const paths_1 = require("../paths");
|
|
41
|
+
const ssg_1 = require("../ssg");
|
|
42
42
|
const convertMarkdownToHtml_1 = require("../utils/convertMarkdownToHtml");
|
|
43
43
|
const frontmatter_1 = require("../utils/frontmatter");
|
|
44
44
|
const writeFile_1 = require("../utils/writeFile");
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param currentLang 当前语言
|
|
48
|
-
* @param availableLangs 可用语言列表
|
|
49
|
-
* @returns 语言切换器 HTML 字符串
|
|
46
|
+
* 使用简单的爬虫抓取生成的站点页面
|
|
50
47
|
*/
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const isCurrent = lang === templateData.lang;
|
|
57
|
-
const activeClass = isCurrent ? 'active' : '';
|
|
58
|
-
const link = path.join('..', lang, templateData.file.metadata.slug + '.html');
|
|
59
|
-
return `<li class="lang-item ${activeClass}">
|
|
60
|
-
<a href="${link}" class="lang-link">${langName}</a>
|
|
61
|
-
</li>`;
|
|
62
|
-
})
|
|
63
|
-
.join('');
|
|
64
|
-
return `<div class="language-switcher">
|
|
65
|
-
<ul class="lang-list">${items}</ul>
|
|
66
|
-
</div>`;
|
|
67
|
-
}
|
|
68
|
-
const generateTagsHtml = (tags) => {
|
|
69
|
-
return `<ul class="tags-list">${tags
|
|
70
|
-
.map(tag => `<li class="tag-item">${tag}</li>`)
|
|
71
|
-
.join('')}</ul>`;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* 生成导航 HTML
|
|
75
|
-
* @param navigation 导航树
|
|
76
|
-
* @param currentPath 当前路径(可选,用于高亮当前页面)
|
|
77
|
-
* @returns 导航 HTML 字符串
|
|
78
|
-
*/
|
|
79
|
-
async function generateNavigationHtml(data) {
|
|
80
|
-
const { files } = metadata_1.MetaData;
|
|
81
|
-
const navigation = await Promise.all(files.map(async (file) => {
|
|
82
|
-
const content = await fs.readFile(path.join(paths_1.CZON_SRC_DIR, data.lang, file.hash + '.md'), 'utf-8');
|
|
83
|
-
const { frontmatter } = (0, frontmatter_1.parseFrontmatter)(content);
|
|
84
|
-
const title = frontmatter.title || file.metadata?.title || file.path; // 优先使用提取的标题
|
|
85
|
-
// 使用相对链接
|
|
86
|
-
const link = file.metadata.slug + '.html';
|
|
87
|
-
return {
|
|
88
|
-
title,
|
|
89
|
-
link,
|
|
90
|
-
isActive: data.file.hash === file.hash,
|
|
91
|
-
};
|
|
92
|
-
}));
|
|
93
|
-
return `<ul class="nav-list">${navigation
|
|
94
|
-
.map(item => {
|
|
95
|
-
const activeClass = item.isActive ? 'active' : '';
|
|
96
|
-
let html = `<li class="nav-item">`;
|
|
97
|
-
html += `<a href="${item.link}" class="nav-link ${activeClass}">${item.title}</a>`;
|
|
98
|
-
html += `</li>`;
|
|
99
|
-
return html;
|
|
100
|
-
})
|
|
101
|
-
.join('')}</ul>`;
|
|
102
|
-
}
|
|
103
|
-
const replaceInnerLinks = (data, markdownContent) => {
|
|
104
|
-
let content = markdownContent;
|
|
105
|
-
for (const link of data.file.links) {
|
|
106
|
-
if (URL.canParse(link))
|
|
107
|
-
continue; // 跳过绝对 URL
|
|
108
|
-
const targetPath = path.resolve('/', path.dirname(data.file.path), link).slice(1);
|
|
109
|
-
const targetFile = metadata_1.MetaData.files.find(f => f.path === targetPath);
|
|
110
|
-
if (!targetFile) {
|
|
111
|
-
console.warn(`⚠️ Link target not found for ${link} in file ${data.file.path}`);
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
// 替换链接 (使用相对链接)
|
|
115
|
-
const targetLink = path.join(targetFile.hash + '.html');
|
|
116
|
-
// 全局替换链接
|
|
117
|
-
const linksRegex = new RegExp(`\\]\\(${link.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\)`, 'g');
|
|
118
|
-
content = content.replace(linksRegex, `](${targetLink})`);
|
|
48
|
+
const spiderStaticSiteGenerator = async () => {
|
|
49
|
+
const queue = ['/index.html', '/404.html'];
|
|
50
|
+
// 将每个语言的首页加入队列
|
|
51
|
+
for (const lang of metadata_1.MetaData.options.langs || []) {
|
|
52
|
+
queue.push(`/${lang}/index.html`);
|
|
119
53
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const navigationHtml = await generateNavigationHtml(data);
|
|
136
|
-
result = result.replace(/{{navigation}}/g, navigationHtml);
|
|
137
|
-
// 替换其他变量 - 使用全局替换
|
|
138
|
-
result = result.replace(/{{title}}/g, frontmatter.title || 'Untitled');
|
|
139
|
-
result = result.replace(/{{content}}/g, htmlContent);
|
|
140
|
-
// 替换元数据变量
|
|
141
|
-
if (frontmatter) {
|
|
142
|
-
result = result.replace(/{{summary}}/g, frontmatter.summary || '');
|
|
143
|
-
result = result.replace(/{{tags}}/g, generateTagsHtml(frontmatter.tags || []));
|
|
144
|
-
result = result.replace(/{{date}}/g, frontmatter.date || '--');
|
|
145
|
-
}
|
|
146
|
-
// 替换语言相关变量
|
|
147
|
-
result = result.replace(/{{lang}}/g, data.lang || '');
|
|
148
|
-
if (langs && langs.length > 1 && data.lang) {
|
|
149
|
-
const langSwitcher = generateLanguageSwitcher(data);
|
|
150
|
-
result = result.replace(/{{language_switcher}}/g, langSwitcher);
|
|
54
|
+
const isVisited = new Set();
|
|
55
|
+
const contents = [];
|
|
56
|
+
// 预加载所有 Markdown 内容
|
|
57
|
+
for (const file of metadata_1.MetaData.files) {
|
|
58
|
+
for (const lang of metadata_1.MetaData.options.langs || []) {
|
|
59
|
+
const markdown = await fs.readFile(path.join(paths_1.CZON_SRC_DIR, lang, file.hash + '.md'), 'utf-8');
|
|
60
|
+
const { frontmatter, body } = (0, frontmatter_1.parseFrontmatter)(markdown);
|
|
61
|
+
const markdownHtml = (0, convertMarkdownToHtml_1.convertMarkdownToHtml)(body);
|
|
62
|
+
contents.push({
|
|
63
|
+
lang,
|
|
64
|
+
hash: file.hash,
|
|
65
|
+
body: markdownHtml,
|
|
66
|
+
frontmatter,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
151
69
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* 渲染模板并保存文件
|
|
175
|
-
*/
|
|
176
|
-
async function renderTemplates() {
|
|
177
|
-
const { files, options: { langs, verbose }, } = metadata_1.MetaData;
|
|
178
|
-
if (verbose)
|
|
179
|
-
console.log(`⚡ Processing files...`);
|
|
180
|
-
const layoutTemplate = await fs.readFile(path.join(__dirname, '../../assets/templates/default/layout.html'), 'utf-8');
|
|
181
|
-
for (const file of files) {
|
|
182
|
-
for (const lang of langs || []) {
|
|
183
|
-
console.info(`📄 Preparing file for language: ${file.path} [${file.hash}] [${lang}]`);
|
|
184
|
-
const content = await fs.readFile(path.join(paths_1.CZON_SRC_DIR, lang, file.hash + '.md'), 'utf-8');
|
|
185
|
-
try {
|
|
186
|
-
const html = await renderTemplate(layoutTemplate, {
|
|
187
|
-
file,
|
|
188
|
-
content,
|
|
189
|
-
lang,
|
|
190
|
-
});
|
|
191
|
-
if (file.metadata?.slug) {
|
|
192
|
-
await (0, writeFile_1.writeFile)(path.join(paths_1.CZON_DIST_DIR, lang, file.metadata.slug + '.html'), html);
|
|
70
|
+
while (queue.length > 0) {
|
|
71
|
+
const currentPath = queue.shift();
|
|
72
|
+
if (isVisited.has(currentPath))
|
|
73
|
+
continue;
|
|
74
|
+
isVisited.add(currentPath);
|
|
75
|
+
let html = (0, ssg_1.renderToHTML)({
|
|
76
|
+
path: currentPath,
|
|
77
|
+
site: metadata_1.MetaData,
|
|
78
|
+
contents,
|
|
79
|
+
});
|
|
80
|
+
// 内部链接: czon://hash 格式的链接替换为 /{lang}/{slug}.html
|
|
81
|
+
html = html.replace(/href="([^"]+)"/g, (match, link) => {
|
|
82
|
+
console.info(`🕷️ Processing link: ${link} in path: ${currentPath}`);
|
|
83
|
+
if (link.startsWith('czon://')) {
|
|
84
|
+
const hash = link.replace('czon://', '');
|
|
85
|
+
console.info(` 🔗 Replacing internal link for hash: ${hash}`);
|
|
86
|
+
const file = metadata_1.MetaData.files.find(f => f.hash === hash);
|
|
87
|
+
if (!file || !file.metadata) {
|
|
88
|
+
console.warn(`⚠️ Link target not found for hash ${hash} in path ${currentPath}`);
|
|
89
|
+
return match;
|
|
193
90
|
}
|
|
91
|
+
const slug = file.metadata.slug;
|
|
92
|
+
const targetPath = path.resolve('/', path.dirname(currentPath), `${slug}.html`);
|
|
93
|
+
const href = path.relative(path.dirname(currentPath), targetPath);
|
|
94
|
+
return `href="${href}"`;
|
|
194
95
|
}
|
|
195
|
-
|
|
196
|
-
|
|
96
|
+
return match;
|
|
97
|
+
});
|
|
98
|
+
console.info(`🕷️ Crawled ${currentPath}`);
|
|
99
|
+
await (0, writeFile_1.writeFile)(path.join(paths_1.CZON_DIST_DIR, currentPath), html);
|
|
100
|
+
// 提取生成的 HTML 中的站内链接,加入爬取队列
|
|
101
|
+
const linkRegex = /href="([^"]+)"/g;
|
|
102
|
+
for (const match of html.matchAll(linkRegex)) {
|
|
103
|
+
const link = match[1];
|
|
104
|
+
if (URL.canParse(link))
|
|
105
|
+
continue; // 跳过绝对 URL
|
|
106
|
+
const resolvedPath = path.resolve('/', path.dirname(currentPath), link);
|
|
107
|
+
console.info(` ➕ Found link: ${link} -> ${resolvedPath} (${isVisited.has(resolvedPath) ? 'visited' : 'new'})`);
|
|
108
|
+
if (!isVisited.has(resolvedPath)) {
|
|
109
|
+
queue.push(resolvedPath);
|
|
197
110
|
}
|
|
198
111
|
}
|
|
199
112
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
await renderRedirectTemplate('index.html', path.join(langs?.[0] || 'en-US', 'index.html'));
|
|
204
|
-
// 404 页面重定向到首页
|
|
205
|
-
await renderRedirectTemplate('404.html', 'index.html');
|
|
206
|
-
}
|
|
113
|
+
};
|
|
114
|
+
exports.spiderStaticSiteGenerator = spiderStaticSiteGenerator;
|
|
207
115
|
//# sourceMappingURL=template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/process/template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/process/template.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,2CAA6B;AAC7B,0CAAuC;AACvC,oCAAuD;AACvD,gCAAsC;AAEtC,0EAAuE;AACvE,sDAAwD;AACxD,kDAA+C;AAE/C;;GAEG;AACI,MAAM,yBAAyB,GAAG,KAAK,IAAI,EAAE;IAClD,MAAM,KAAK,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IAE3C,eAAe;IACf,KAAK,MAAM,IAAI,IAAI,mBAAQ,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,aAAa,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,MAAM,QAAQ,GAA+B,EAAE,CAAC;IAEhD,oBAAoB;IACpB,KAAK,MAAM,IAAI,IAAI,mBAAQ,CAAC,KAAK,EAAE,CAAC;QAClC,KAAK,MAAM,IAAI,IAAI,mBAAQ,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAY,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;YAC9F,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,IAAA,8BAAgB,EAAC,QAAQ,CAAC,CAAC;YACzD,MAAM,YAAY,GA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C,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AA5EW,QAAA,yBAAyB,6BA4EpC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IRenderContext } from '../types';
|
|
3
|
+
export declare const ContentPage: React.FC<{
|
|
4
|
+
ctx: IRenderContext;
|
|
5
|
+
file: IRenderContext['site']['files'][0];
|
|
6
|
+
lang: string;
|
|
7
|
+
content: IRenderContext['contents'][0];
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=ContentPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPage.d.ts","sourceRoot":"","sources":["../../src/ssg/ContentPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK1C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;IACjC,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;CACxC,CAkcA,CAAC"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ContentPage = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const LanguageSwitcher_1 = require("./components/LanguageSwitcher");
|
|
9
|
+
const Navigator_1 = require("./components/Navigator");
|
|
10
|
+
const TagList_1 = require("./components/TagList");
|
|
11
|
+
const ContentPage = props => {
|
|
12
|
+
const frontmatter = props.content.frontmatter || {};
|
|
13
|
+
const title = frontmatter.title;
|
|
14
|
+
const summary = frontmatter.summary;
|
|
15
|
+
const date = frontmatter.date || '--';
|
|
16
|
+
const tags = frontmatter.tags || [];
|
|
17
|
+
return (react_1.default.createElement("html", { lang: props.lang },
|
|
18
|
+
react_1.default.createElement("head", null,
|
|
19
|
+
react_1.default.createElement("meta", { charSet: "UTF-8" }),
|
|
20
|
+
react_1.default.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }),
|
|
21
|
+
react_1.default.createElement("title", null, title),
|
|
22
|
+
react_1.default.createElement("style", { dangerouslySetInnerHTML: {
|
|
23
|
+
__html: `
|
|
24
|
+
* {
|
|
9
25
|
margin: 0;
|
|
10
26
|
padding: 0;
|
|
11
27
|
box-sizing: border-box;
|
|
@@ -287,21 +303,15 @@
|
|
|
287
303
|
padding: 2rem;
|
|
288
304
|
}
|
|
289
305
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
crossorigin="anonymous"
|
|
300
|
-
/>
|
|
301
|
-
|
|
302
|
-
<!-- Mermaid.js for diagram rendering -->
|
|
303
|
-
<script src="https://cdn.jsdelivr.net/npm/mermaid@11.4.0/dist/mermaid.min.js"></script>
|
|
304
|
-
<style>
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
`,
|
|
309
|
+
} }),
|
|
310
|
+
react_1.default.createElement("link", { rel: "stylesheet", href: "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/github.min.css" }),
|
|
311
|
+
react_1.default.createElement("link", { rel: "stylesheet", href: "https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css", integrity: "sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn", crossOrigin: "anonymous" }),
|
|
312
|
+
react_1.default.createElement("script", { src: "https://cdn.jsdelivr.net/npm/mermaid@11.4.0/dist/mermaid.min.js" }),
|
|
313
|
+
react_1.default.createElement("style", { dangerouslySetInnerHTML: {
|
|
314
|
+
__html: `
|
|
305
315
|
/* Mermaid diagram styles */
|
|
306
316
|
.mermaid-diagram {
|
|
307
317
|
margin: 1.5rem 0;
|
|
@@ -348,41 +358,38 @@
|
|
|
348
358
|
display: block;
|
|
349
359
|
margin: 0 auto;
|
|
350
360
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
</script>
|
|
384
|
-
<!-- Mermaid initialization -->
|
|
385
|
-
<script>
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
`,
|
|
364
|
+
} })),
|
|
365
|
+
react_1.default.createElement("body", null,
|
|
366
|
+
react_1.default.createElement("nav", { className: "sidebar" },
|
|
367
|
+
react_1.default.createElement(Navigator_1.Navigator, { ctx: props.ctx, file: props.file }),
|
|
368
|
+
react_1.default.createElement("hr", null),
|
|
369
|
+
react_1.default.createElement("div", null,
|
|
370
|
+
react_1.default.createElement(LanguageSwitcher_1.LanguageSwitcher, { ctx: props.ctx, lang: props.lang, file: props.file }))),
|
|
371
|
+
react_1.default.createElement("main", { className: "content" },
|
|
372
|
+
react_1.default.createElement("header", { className: "content-header" },
|
|
373
|
+
react_1.default.createElement("h2", null, title),
|
|
374
|
+
react_1.default.createElement("blockquote", null, summary),
|
|
375
|
+
react_1.default.createElement("div", null,
|
|
376
|
+
"\uD83D\uDCC5 ",
|
|
377
|
+
date),
|
|
378
|
+
react_1.default.createElement("div", { className: "tags" },
|
|
379
|
+
react_1.default.createElement(TagList_1.TagList, { tags: tags }))),
|
|
380
|
+
react_1.default.createElement("hr", null),
|
|
381
|
+
react_1.default.createElement("article", { className: "content-body", dangerouslySetInnerHTML: { __html: props.content.body } }),
|
|
382
|
+
react_1.default.createElement("footer", { className: "footer" },
|
|
383
|
+
react_1.default.createElement("p", null,
|
|
384
|
+
"Generated by ",
|
|
385
|
+
react_1.default.createElement("strong", null, "CZON"),
|
|
386
|
+
" \u2022",
|
|
387
|
+
react_1.default.createElement("a", { href: "https://github.com/zccz14/CZON", target: "_blank" }, "View on GitHub")))),
|
|
388
|
+
react_1.default.createElement("script", { src: "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js" }),
|
|
389
|
+
react_1.default.createElement("script", { dangerouslySetInnerHTML: { __html: 'hljs.highlightAll();' } }),
|
|
390
|
+
react_1.default.createElement("script", { dangerouslySetInnerHTML: {
|
|
391
|
+
__html: `
|
|
392
|
+
|
|
386
393
|
(function () {
|
|
387
394
|
// Wait for page to fully load
|
|
388
395
|
window.addEventListener('load', function () {
|
|
@@ -412,6 +419,11 @@
|
|
|
412
419
|
}
|
|
413
420
|
});
|
|
414
421
|
})();
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
`,
|
|
426
|
+
} }))));
|
|
427
|
+
};
|
|
428
|
+
exports.ContentPage = ContentPage;
|
|
429
|
+
//# sourceMappingURL=ContentPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPage.js","sourceRoot":"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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedirectPage.d.ts","sourceRoot":"","sources":["../../src/ssg/RedirectPage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAmB/D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RedirectPage = void 0;
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const RedirectPage = props => {
|
|
10
|
+
const toURL = (0, node_path_1.relative)((0, node_path_1.dirname)(props.from), props.to);
|
|
11
|
+
return (react_1.default.createElement("html", { lang: "en" },
|
|
12
|
+
react_1.default.createElement("head", null,
|
|
13
|
+
react_1.default.createElement("meta", { charSet: "UTF-8" }),
|
|
14
|
+
react_1.default.createElement("meta", { httpEquiv: "X-UA-Compatible", content: "IE=edge" }),
|
|
15
|
+
react_1.default.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }),
|
|
16
|
+
react_1.default.createElement("meta", { httpEquiv: "refresh", content: `0; url=${toURL}` }),
|
|
17
|
+
react_1.default.createElement("title", null, "Redirecting...")),
|
|
18
|
+
react_1.default.createElement("body", null,
|
|
19
|
+
react_1.default.createElement("p", null,
|
|
20
|
+
"Redirecting to ",
|
|
21
|
+
react_1.default.createElement("a", { href: toURL }, toURL)))));
|
|
22
|
+
};
|
|
23
|
+
exports.RedirectPage = RedirectPage;
|
|
24
|
+
//# sourceMappingURL=RedirectPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedirectPage.js","sourceRoot":"","sources":["../../src/ssg/RedirectPage.tsx"],"names":[],"mappings":";;;;;;AAAA,yCAA8C;AAC9C,kDAA0B;AAEnB,MAAM,YAAY,GAA2C,KAAK,CAAC,EAAE;IAC1E,MAAM,KAAK,GAAG,IAAA,oBAAQ,EAAC,IAAA,mBAAO,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IACtD,OAAO,CACL,wCAAM,IAAI,EAAC,IAAI;QACb;YACE,wCAAM,OAAO,EAAC,OAAO,GAAG;YACxB,wCAAM,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAC,SAAS,GAAG;YACtD,wCAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAC,uCAAuC,GAAG;YACxE,wCAAM,SAAS,EAAC,SAAS,EAAC,OAAO,EAAE,UAAU,KAAK,EAAE,GAAI;YACxD,8DAA6B,CACxB;QAEP;YACE;;gBACiB,qCAAG,IAAI,EAAE,KAAK,IAAG,KAAK,CAAK,CACxC,CACC,CACF,CACR,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,YAAY,gBAmBvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/ssg/app.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C,eAAO,MAAM,GAAG,GAAI,OAAO,cAAc,sBAsCxC,CAAC"}
|
package/dist/ssg/app.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.App = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ContentPage_1 = require("./ContentPage");
|
|
9
|
+
const RedirectPage_1 = require("./RedirectPage");
|
|
10
|
+
const App = (props) => {
|
|
11
|
+
if (props.path === '/index.html') {
|
|
12
|
+
return react_1.default.createElement(RedirectPage_1.RedirectPage, { from: props.path, to: `/${props.site.options.langs[0]}/index.html` });
|
|
13
|
+
}
|
|
14
|
+
// 每个语言的首页
|
|
15
|
+
for (const lang of props.site.options.langs || []) {
|
|
16
|
+
if (props.path === `/${lang}/index.html`) {
|
|
17
|
+
return (react_1.default.createElement(RedirectPage_1.RedirectPage, { from: props.path, to: `/${lang}/${props.site.files[0].metadata.slug}.html` }));
|
|
18
|
+
// TODO: 渲染多语言首页列表
|
|
19
|
+
// return (
|
|
20
|
+
// <div>
|
|
21
|
+
// {props.site.files.map(file => (
|
|
22
|
+
// <div key={file.metadata?.slug}>
|
|
23
|
+
// <h2>{file.metadata?.title}</h2>
|
|
24
|
+
// <p>{file.metadata?.short_summary}</p>
|
|
25
|
+
// <a href={`${file.metadata?.slug}.html`}>阅读更多</a>
|
|
26
|
+
// </div>
|
|
27
|
+
// ))}
|
|
28
|
+
// </div>
|
|
29
|
+
// );
|
|
30
|
+
}
|
|
31
|
+
// 渲染文章页面
|
|
32
|
+
for (const file of props.site.files) {
|
|
33
|
+
if (props.path === `/${lang}/${file.metadata?.slug}.html`) {
|
|
34
|
+
const theContent = props.contents.find(c => c.lang === lang && c.hash === file.hash);
|
|
35
|
+
if (!theContent)
|
|
36
|
+
return react_1.default.createElement(RedirectPage_1.RedirectPage, { from: props.path, to: `/index.html` });
|
|
37
|
+
return react_1.default.createElement(ContentPage_1.ContentPage, { ctx: props, file: file, lang: lang, content: theContent });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return react_1.default.createElement(RedirectPage_1.RedirectPage, { from: props.path, to: `/index.html` });
|
|
42
|
+
};
|
|
43
|
+
exports.App = App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Q,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;gBACrF,IAAI,CAAC,UAAU;oBAAE,OAAO,8BAAC,2BAAY,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,GAAI,CAAC;gBAC9E,OAAO,8BAAC,yBAAW,IAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,UAAW,GAAI,CAAC;YACnF,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,8BAAC,2BAAY,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,GAAI,CAAC;AAC/D,CAAC,CAAC;AAtCW,QAAA,GAAG,OAsCd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageSwitcher.d.ts","sourceRoot":"","sources":["../../../src/ssg/components/LanguageSwitcher.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1C,CAmBA,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LanguageSwitcher = void 0;
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const languages_1 = require("../../languages");
|
|
10
|
+
const LanguageSwitcher = props => {
|
|
11
|
+
return (react_1.default.createElement("div", { className: "language-switcher" },
|
|
12
|
+
react_1.default.createElement("ul", { className: "lang-list" }, props.ctx.site.options.langs?.map(lang => {
|
|
13
|
+
const isActive = lang === props.lang;
|
|
14
|
+
const langName = languages_1.LANGUAGE_NAMES[lang] || lang;
|
|
15
|
+
const link = (0, node_path_1.join)('..', lang, `${props.file.metadata.slug}.html`);
|
|
16
|
+
return (react_1.default.createElement("li", { className: `lang-item ${isActive ? 'active' : ''}`, key: lang },
|
|
17
|
+
react_1.default.createElement("a", { href: link, className: "lang-link" }, langName)));
|
|
18
|
+
}))));
|
|
19
|
+
};
|
|
20
|
+
exports.LanguageSwitcher = LanguageSwitcher;
|
|
21
|
+
//# sourceMappingURL=LanguageSwitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageSwitcher.js","sourceRoot":"","sources":["../../../src/ssg/components/LanguageSwitcher.tsx"],"names":[],"mappings":";;;;;;AAAA,yCAAiC;AACjC,kDAA0B;AAC1B,+CAAiD;AAG1C,MAAM,gBAAgB,GAIxB,KAAK,CAAC,EAAE;IACX,OAAO,CACL,uCAAK,SAAS,EAAC,mBAAmB;QAChC,sCAAI,SAAS,EAAC,WAAW,IACtB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;YACxC,MAAM,QAAQ,GAAG,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC;YACrC,MAAM,QAAQ,GAAG,0BAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;YAC9C,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,QAAS,CAAC,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