docs: changelog 页面问题

This commit is contained in:
涵曦 2024-12-13 20:52:26 +08:00
parent 96083bee89
commit 3737c7359f
5 changed files with 13 additions and 4 deletions

View File

@ -135,6 +135,14 @@ function copyFile(source: string, destination: string) {
}
}
// 在文件开头插入内容
function prependToFile(filePath: string, text: string) {
const content = fs.readFileSync(filePath, 'utf-8');
const updatedContent = `${text}\n\n${content}`;
fs.writeFileSync(filePath, updatedContent, 'utf-8');
console.log(`Prepended text to ${filePath}`);
}
function replaceGithubAssetUrls(content: string, githubProxy: string): string {
const pattern1 = /https:\/\/github\.com\/[^\/]+\/[^\/]+\/assets\/[\w-]+/g;
const pattern2 = /https:\/\/github\.com\/user-attachments\/assets\/[\w-]+/g;
@ -182,6 +190,7 @@ export default function GitHubIssuesPlugin(options: GitHubIssuesPluginOptions):
const changelogSource = path.join(process.cwd(), '../CHANGELOG.md');
const changelogDestination = path.join(docsDir, 'changelog.md');
copyFile(changelogSource, changelogDestination);
prependToFile(changelogDestination, '# 变更日志');
for (const issue of issues) {
// 仅处理包含 "文档" 标签的 issue

View File

@ -26,7 +26,7 @@
<body class="index_page">
<div class="player">
<h1>小爱音箱播放器
<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.md" target="_blank">版本
<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.html" target="_blank">版本
1.0.0</a><span id="versionnew" class="new-badge"></span>
</h1>

View File

@ -31,7 +31,7 @@ var vConsole = new window.VConsole();
</head>
<body>
<h2>小爱音箱设置面板
(<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.md">版本未知</a>)
(<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.html">版本未知</a>)
</h2>
<hr>

View File

@ -30,7 +30,7 @@ var vConsole = new window.VConsole();
</head>
<body>
<h2>小爱音箱操控面板
(<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.md">版本未知</a>)
(<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.html">版本未知</a>)
<span id="versionnew" class="blink"></span>
</h2>
<hr>

View File

@ -30,7 +30,7 @@ var vConsole = new window.VConsole();
</head>
<body>
<h2>小爱音箱设置面板
(<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.md">版本未知</a>)
(<a id="version" href="https://xdocs.hanxi.cc/issues/changelog.html">版本未知</a>)
</h2>
<hr>