这是一个整合了 Swift Craft Launcher 所有相关资源的统一仓库。
本仓库整合了以下子项目:
Swift-Craft-Launcher-Help - macOS 应用帮助文档
- 包含多语言帮助文档(英文、简体中文、繁体中文)
- macOS Help Book 格式的帮助文档资源
- 目录结构:
SwiftCraftLauncher.help/Contents/Resources/
帮助文档遵循 macOS Help Book 格式,使用特定的 HTML 结构和 CSS 类来确保在 macOS 帮助查看器中正确显示。
每个帮助文档页面必须遵循以下基本结构:
<html lang="en">
<head>
<meta charset="UTF-8">
<title>页面标题</title>
<meta name="description" content="页面描述">
<meta name="keywords" content="关键词1, 关键词2">
<meta content="light dark" name="color-scheme">
<link media="all" href="../css/app.css" type="text/css" rel="stylesheet">
</head>
<body dir="ltr" id="页面id" class="AppleTopic apd-topic dark-mode-enabled" data-istaskopen="true" data-designversion="2">
<a name="页面id"></a>
<!-- 页面内容 -->
</body>
</html>关键属性说明:
lang: 语言代码(en、zh-Hans、zh-Hant等)dir: 文本方向(ltr从左到右,rtl从右到左)id: 页面唯一标识符,与<a name>保持一致class: 必须包含AppleTopic apd-topic dark-mode-enableddata-istaskopen: 任务折叠状态(true展开,false折叠)data-designversion: 设计版本(1或2,推荐使用2)
在页面顶部显示应用图标:
<figure class="topicIcon">
<img src="图标URL" alt="" height="30" width="30">
</figure><h1>主标题</h1>带样式的副标题:
<h1 class="Name" style="margin-top: 0.8em;">副标题</h1>普通段落:
<p>段落内容</p>带底部边框的段落(常用于章节介绍):
<p style="border-bottom: 1px solid var(--border-color); padding-bottom: 1em;">介绍性文字</p>用于展示操作步骤,支持折叠/展开:
<div id="step-id" class="Task">
<h2 aria-controls="aria-step-id" class="Name">步骤标题</h2>
<div class="TaskBody" role="region" aria-hidden="false" id="aria-step-id">
<p>步骤说明文字</p>
<figure>
<img src="图片URL" alt="图片描述">
</figure>
</div>
</div>关键属性:
id: 任务唯一标识符aria-controls: 指向对应的TaskBody的id(格式:aria-{step-id})aria-hidden:false表示可见,true表示隐藏role="region": 语义化标记
多个任务连续显示时,会自动合并边框,无需额外处理。
<figure>
<img src="图片URL" alt="图片描述">
</figure>图片应使用完整的 URL 地址(推荐使用 GitHub raw 链接)。
用于显示重要提示、注意事项等:
<div class="Alert">
<p class="Important"><em>Important:</em> 重要提示内容</p>
</div>提示类型:
Important: 重要提示(红色强调)Note: 注意事项(蓝色)Warning: 警告信息Caution: 谨慎提示
示例:
<!-- 重要提示 -->
<div class="Alert">
<p class="Important"><em>Important:</em> 这是重要提示</p>
</div>
<!-- 注意事项 -->
<div class="Alert">
<p class="Note"><em>Note:</em> 这是注意事项</p>
</div>无序列表:
<ul>
<li><p>列表项 1</p></li>
<li><p>列表项 2</p></li>
</ul>有序列表:
<ol>
<li><p>步骤 1</p></li>
<li><p>步骤 2</p></li>
</ol>带强调的列表项:
<ul>
<li><p><strong>关键词</strong>: 说明文字</p></li>
</ul>行内代码:
<code>代码内容</code>代码块:
<code class="CodeLine">单行代码</code>返回索引页:
<div class="LinkUniversal">
<a href="index.html#index" class="xRef AppleTopic">← Back to Index</a>
</div>.AppleTopic: 主题容器类.apd-topic: 帮助文档主题类.dark-mode-enabled: 启用深色模式支持.Task: 任务/步骤容器.TaskBody: 任务内容区域.Alert: 警告/提示框容器.Name: 标题样式类.LinkUniversal: 导航链接容器.topicIcon: 主题图标容器
margin-top: 0.8em: 用于副标题的顶部间距border-bottom: 1px solid var(--border-color): 底部边框padding-bottom: 1em: 底部内边距
-
文件命名
- 使用小写字母和连字符:
add-game.html、edit-skins.html - 保持简洁且具有描述性
- 使用小写字母和连字符:
-
ID 命名
- 使用连字符分隔:
step-1、mod-step1、skin-step2 - 保持唯一性和一致性
- 使用连字符分隔:
-
图片使用
- 使用完整的 URL(推荐 GitHub raw 链接)
- 提供有意义的
alt属性 - 图片应存储在
imagebed/目录下,按功能分类
-
多语言支持
- 每个语言版本放在对应的
.lproj目录下 - 保持文件结构和命名一致
- 翻译时保持 HTML 结构不变
- 每个语言版本放在对应的
-
可访问性
- 正确使用
aria-controls和aria-hidden - 为图片提供
alt文本 - 使用语义化的 HTML 标签
- 正确使用
-
内容组织
- 使用
h1作为主标题 - 使用
h1.Name作为章节标题 - 使用
Task组织操作步骤 - 在适当位置使用
Alert显示重要信息
- 使用
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Add Game</title>
<meta name="description" content="Learn how to add and install Minecraft games">
<meta name="keywords" content="add game, install minecraft">
<meta content="light dark" name="color-scheme">
<link media="all" href="../css/app.css" type="text/css" rel="stylesheet">
</head>
<body dir="ltr" id="addgame" class="AppleTopic apd-topic dark-mode-enabled" data-istaskopen="true" data-designversion="2">
<a name="addgame"></a>
<figure class="topicIcon">
<img src="图标URL" alt="" height="30" width="30">
</figure>
<h1>Add Game</h1>
<p style="border-bottom: 1px solid var(--border-color); padding-bottom: 1em;">
介绍性文字
</p>
<h1 class="Name" style="margin-top: 0.8em;">Install Game</h1>
<div id="step1" class="Task">
<h2 aria-controls="aria-step1" class="Name">Step 1: Title</h2>
<div class="TaskBody" role="region" aria-hidden="false" id="aria-step1">
<p>步骤说明</p>
<figure>
<img src="图片URL" alt="图片描述">
</figure>
</div>
</div>
<div class="Alert">
<p class="Note"><em>Note:</em> 注意事项</p>
</div>
<div class="LinkUniversal">
<a href="index.html#index" class="xRef AppleTopic">← Back to Index</a>
</div>
</body>
</html>help/SwiftCraftLauncher.help/Contents/Resources/
├── css/
│ └── app.css # 样式文件
├── en.lproj/ # 英文版本
│ ├── index.html
│ ├── addgame.html
│ └── ...
├── zh-Hans.lproj/ # 简体中文版本
│ ├── index.html
│ ├── addgame.html
│ └── ...
└── zh-Hant.lproj/ # 繁体中文版本
├── index.html
├── addgame.html
└── ...
查看现有帮助文档作为参考:
help/SwiftCraftLauncher.help/Contents/Resources/en.lproj/addgame.html- 简单页面示例help/SwiftCraftLauncher.help/Contents/Resources/en.lproj/addresources.html- 复杂页面示例help/SwiftCraftLauncher.help/Contents/Resources/en.lproj/settings.html- 设置页面示例
Swift-Craft-Launcher-News - 版本公告
基于 GitHub Pages + GitHub Actions 的静态公告 API。
添加公告
在 news/ 目录下创建 JSON 文件,文件名使用版本号格式:[version].json
例如:0.3.1-beta.json、1.0.0.json
JSON 格式(支持22种语言):
{
"en": {
"title": "Important Notice",
"content": "Content",
"author": "Swift Craft Launcher Team"
},
"zh-Hans": {
"title": "重要通知",
"content": "内容",
"author": "Swift Craft Launcher 团队"
},
"es": {
"title": "Aviso importante",
"content": "Contenido",
"author": "Equipo Swift Craft Launcher"
}
}API 端点
/api/announcements/[version]/[lang].json
示例:
/api/announcements/0.3.1-beta/en.json/api/announcements/0.3.1-beta/zh-Hans.json
使用函数
const { getAnnouncement } = require('./scripts/generate-api.js');
const result = getAnnouncement('0.3.1-beta', 'en');生成静态文件
node scripts/generate-api.jsar, da, de, en, es, fi, fr, hi, it, ja, ko, nb, nl, pl, pt, ru, sv, th, tr, vi, zh-Hans, zh-Hant
Swift-Craft-Launcher-Contributors - 贡献者信息
- 包含贡献者列表和致谢信息
- JSON 格式的数据文件
Swift-Craft-Launcher-ImageBed - 图床
- 用于存储 macOS 应用帮助文档的图片资源
- 按功能模块分类存储(注册、添加游戏、添加资源、设置、编辑皮肤等)
Swift-Craft-Launcher-Web - 前端代码
- 项目官网前端代码
- 包含多语言支持(英文、简体中文、繁体中文)
- 静态网站资源
- Swift-Craft-Launcher-Help
- Swift-Craft-Launcher-News
- Swift-Craft-Launcher-Contributors
- Swift-Craft-Launcher-HelpBook
- swift-craft-launcher-web.github.io
各个子目录保持原有的结构和功能,可以独立使用。整合后的仓库便于统一管理和维护所有相关资源。