Skip to content

Commit de051e4

Browse files
committed
【新增】优化关于页面
- 将版本号从 1.12.0 升级到 1.13.0 - 重构了关于页面的内容,增加了版本显示、特性列表等信息 - 新增 getVersion 和 getAbout 函数,用于获取版本号和生成关于页面内容
1 parent 0d2cb50 commit de051e4

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

index.html

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!doctype html>
22

33
<html>
4-
<markdown-html version="1.12.0" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
4+
<markdown-html version="1.13.0" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
55
license="CC BY-SA 4.0 International"></markdown-html>
66

77
<head>
@@ -23,16 +23,39 @@
2323
<script>
2424
// 使用 IIFE 包裹以避免全局变量污染
2525
(function () {
26-
const about = `
26+
function getVersion() {
27+
const markdownElement = document.querySelector('markdown-html');
28+
if (markdownElement) {
29+
const version = markdownElement.getAttribute('version');
30+
return version;
31+
} else {
32+
return '未知';
33+
}
34+
}
35+
36+
function getAbout() {
37+
return `
2738
# 关于
2839
2940
## MARKDOWN.HTML
3041
42+
版本:${getVersion()}
43+
3144
旨在提供低依赖、一键部署的 Markdown 网页渲染方案。
3245
46+
### 特性
47+
48+
- **依赖少**:仅需一个 HTML 文件、少量 CDN 和服务器程序,即可完成 Markdown 网页渲染。
49+
- **Markdown 支持**:将 Markdown 文件渲染为 HTML。
50+
- **Mermaid 支持**:将 Markdown 中的 Mermaid 语法渲染为图表。
51+
- **多语言支持**:支持多种语言间的机器互译。
52+
- **深色模式**:支持浅色、深色、跟随系统。
53+
- **Pjax 支持**:支持无刷新页面跳转。
54+
3355
详情请访问 [GitHub](https://github.com/PJ-568/MARKDOWN.HTML) 或 [Gitee](https://gitee.com/PJ-568/MARKDOWN.HTML) 仓库。
3456
3557
`;
58+
}
3659

3760
// 加载动画相关
3861
var loadingState = {
@@ -333,6 +356,7 @@
333356
} else if (mdPath.endsWith('about.md')) {
334357
// 特殊处理 about.md
335358
response = await fetch(mdPath);
359+
const about = getAbout();
336360
if (response.ok && response.headers.get('content-type').startsWith('text/markdown')) {
337361
var r_text = await response.text();
338362
const content = about + await r_text.replace(/^# .*/m, '');

0 commit comments

Comments
 (0)