mirror of
https://github.com/openmlsys/openmlsys-zh.git
synced 2026-11-29 23:44:39 +08:00
Add bilingual issue and PR templates (#497)
* feat: add bilingual issue and PR templates * feat: add bilingual contributing guides for v2 * docs: migrate style guide to v2/info, trim contributing guides * docs: move terminology to v2/info * docs: update README links to v2 contributing and style guides * refactor: remove content about Writing Guidelines from contribution guidence, replace it with link to style.md * misc: update contribution guide and PR template
This commit is contained in:
62
.github/ISSUE_TEMPLATE/bug_report_en.yml
vendored
Normal file
62
.github/ISSUE_TEMPLATE/bug_report_en.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Content Error Report (English)
|
||||
description: Report a typo, factual error, formula error, or build issue in the book
|
||||
title: "[Bug] "
|
||||
labels: ["bug", "v2"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to report an issue! Please fill in all fields below to help us locate and fix it quickly.
|
||||
|
||||
> **Note:** v1 is archived. Only v2-related issues are accepted.
|
||||
|
||||
- type: dropdown
|
||||
id: error-type
|
||||
attributes:
|
||||
label: Error Type
|
||||
options:
|
||||
- Typo / Wording error
|
||||
- Formula error
|
||||
- Missing or incorrect figure
|
||||
- Code error
|
||||
- Reference error
|
||||
- Build / Rendering issue
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: location
|
||||
attributes:
|
||||
label: Location
|
||||
description: Specify the chapter and file path, e.g. `v2/en_chapters/chapter_introduction/index.md`
|
||||
placeholder: v2/en_chapters/chapter_xxx/yyy.md
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Describe the error. Quote the original text if possible.
|
||||
placeholder: |
|
||||
Original: ...
|
||||
Problem: ...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: suggestion
|
||||
attributes:
|
||||
label: Suggested Fix (optional)
|
||||
description: If you know the correct content, please provide it here.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Pre-submission Checklist
|
||||
options:
|
||||
- label: I confirm this issue is in v2, not the archived v1
|
||||
required: true
|
||||
- label: I have searched existing issues and this has not been reported before
|
||||
required: true
|
||||
62
.github/ISSUE_TEMPLATE/bug_report_zh.yml
vendored
Normal file
62
.github/ISSUE_TEMPLATE/bug_report_zh.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: 内容错误报告(中文)
|
||||
description: 报告教材中的笔误、事实错误、公式错误或构建问题
|
||||
title: "[错误] "
|
||||
labels: ["bug", "v2"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
感谢你花时间报告问题!请尽量填写下方所有字段,以帮助我们快速定位和修复。
|
||||
|
||||
> **注意:** v1 已归档,仅接受 v2 相关的问题报告。
|
||||
|
||||
- type: dropdown
|
||||
id: error-type
|
||||
attributes:
|
||||
label: 错误类型
|
||||
options:
|
||||
- 笔误 / 表述错误
|
||||
- 公式错误
|
||||
- 图片错误或缺失
|
||||
- 代码错误
|
||||
- 参考文献错误
|
||||
- 构建 / 渲染问题
|
||||
- 其他
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: location
|
||||
attributes:
|
||||
label: 错误位置
|
||||
description: 请指明章节名称和文件路径,例如 `v2/zh_chapters/chapter_introduction/index.md`
|
||||
placeholder: v2/zh_chapters/chapter_xxx/yyy.md
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 错误描述
|
||||
description: 描述错误内容,如可能请引用原文
|
||||
placeholder: |
|
||||
原文:...
|
||||
问题:...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: suggestion
|
||||
attributes:
|
||||
label: 建议修改(可选)
|
||||
description: 如果你知道正确内容,请在此提供建议
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: 提交前确认
|
||||
options:
|
||||
- label: 我已确认此问题属于 v2,而非已归档的 v1
|
||||
required: true
|
||||
- label: 我已搜索现有 Issues,确认此问题未被报告过
|
||||
required: true
|
||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 在线阅读 / Read Online
|
||||
url: https://openmlsys.github.io/
|
||||
about: 访问在线版教材 / Visit the online book
|
||||
64
.github/ISSUE_TEMPLATE/content_request_en.yml
vendored
Normal file
64
.github/ISSUE_TEMPLATE/content_request_en.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Content Suggestion / New Chapter Request
|
||||
description: Suggest new content, a new chapter, or improvements to existing sections
|
||||
title: "[Content] "
|
||||
labels: ["enhancement", "v2"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for contributing ideas to improve this book!
|
||||
|
||||
- type: dropdown
|
||||
id: request-type
|
||||
attributes:
|
||||
label: Request Type
|
||||
options:
|
||||
- New chapter
|
||||
- New section / paragraph
|
||||
- Improve existing content
|
||||
- Add code example
|
||||
- Add figure / diagram
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: location
|
||||
attributes:
|
||||
label: Related Chapter (if applicable)
|
||||
description: If the suggestion targets an existing chapter, provide its path
|
||||
placeholder: v2/en_chapters/chapter_xxx/
|
||||
|
||||
- type: textarea
|
||||
id: motivation
|
||||
attributes:
|
||||
label: Background & Motivation
|
||||
description: Why is this content needed? What problem does it solve for readers?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: Proposed Content
|
||||
description: Describe what you'd like to add or change
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: references
|
||||
attributes:
|
||||
label: References (optional)
|
||||
description: Relevant papers, documentation, or code links
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Pre-submission Checklist
|
||||
options:
|
||||
- label: I confirm this suggestion is for v2, not the archived v1
|
||||
required: true
|
||||
- label: I have searched existing issues and this has not been suggested before
|
||||
required: true
|
||||
- label: I am willing to contribute this content myself (optional)
|
||||
required: false
|
||||
64
.github/ISSUE_TEMPLATE/content_request_zh.yml
vendored
Normal file
64
.github/ISSUE_TEMPLATE/content_request_zh.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: 内容建议 / 新章节请求
|
||||
description: 建议补充新内容、新章节,或对现有章节提出改进意见
|
||||
title: "[内容] "
|
||||
labels: ["enhancement", "v2"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
感谢你为本教材提供内容建议!
|
||||
|
||||
- type: dropdown
|
||||
id: request-type
|
||||
attributes:
|
||||
label: 建议类型
|
||||
options:
|
||||
- 新增章节
|
||||
- 新增小节 / 段落
|
||||
- 改进现有内容
|
||||
- 补充代码示例
|
||||
- 补充图片 / 示意图
|
||||
- 其他
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: location
|
||||
attributes:
|
||||
label: 相关章节(如有)
|
||||
description: 若建议针对某个已有章节,请填写路径
|
||||
placeholder: v2/zh_chapters/chapter_xxx/
|
||||
|
||||
- type: textarea
|
||||
id: motivation
|
||||
attributes:
|
||||
label: 背景与动机
|
||||
description: 为什么需要这部分内容?它能帮助读者解决什么问题?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: 具体建议
|
||||
description: 描述你希望添加或修改的内容
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: references
|
||||
attributes:
|
||||
label: 参考资料(可选)
|
||||
description: 相关论文、文档或代码链接
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: 提交前确认
|
||||
options:
|
||||
- label: 我已确认此建议针对 v2,而非已归档的 v1
|
||||
required: true
|
||||
- label: 我已搜索现有 Issues,确认此建议未被提出过
|
||||
required: true
|
||||
- label: 我有意愿参与撰写此内容(可选,非必填)
|
||||
required: false
|
||||
25
.github/PULL_REQUEST_TEMPLATE/en.md
vendored
Normal file
25
.github/PULL_REQUEST_TEMPLATE/en.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
## Summary
|
||||
|
||||
<!-- Briefly describe what this PR does -->
|
||||
|
||||
**Change Type:**
|
||||
- [ ] Content fix (typo, factual error, wording improvement)
|
||||
- [ ] New content (new chapter, section, or example)
|
||||
- [ ] Translation sync (Chinese ↔ English)
|
||||
- [ ] Figure / code update
|
||||
- [ ] Build tooling / script change
|
||||
- [ ] Other:
|
||||
|
||||
**Affected Chapters / Files:**
|
||||
|
||||
```
|
||||
v2/en_chapters/chapter_xxx/...
|
||||
```
|
||||
|
||||
## Changes
|
||||
|
||||
<!-- List the main changes; link any related issues here if applicable -->
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
25
.github/PULL_REQUEST_TEMPLATE/zh.md
vendored
Normal file
25
.github/PULL_REQUEST_TEMPLATE/zh.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
## 变更说明
|
||||
|
||||
<!-- 简要描述本次 PR 做了什么 -->
|
||||
|
||||
**变更类型:**
|
||||
- [ ] 内容修订(笔误、事实错误、表述改进)
|
||||
- [ ] 新增内容(新章节、新小节、新示例)
|
||||
- [ ] 译文同步(中文 ↔ 英文)
|
||||
- [ ] 图片 / 代码更新
|
||||
- [ ] 构建工具 / 脚本改动
|
||||
- [ ] 其他:
|
||||
|
||||
**涉及章节 / 文件:**
|
||||
|
||||
```
|
||||
v2/zh_chapters/chapter_xxx/...
|
||||
```
|
||||
|
||||
## 变更详情
|
||||
|
||||
<!-- 列出主要改动点,便于归档,若有相关issue,在此关联 -->
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
10
README.md
10
README.md
@@ -117,15 +117,11 @@ sh build_mdbook_zh.sh
|
||||
|
||||
## 贡献指南
|
||||
|
||||
我们欢迎任何形式的贡献,包括:
|
||||
|
||||
- **勘误**:发现文字或图片错误,请创建 Issue 并 @ [章节编辑](info/editors.md),或直接提交 PR。
|
||||
- **内容更新**:提交 PR 更新或添加 Markdown 文件。
|
||||
- **新章节**:欢迎社区对元学习系统、自动并行、集群调度、绿色 AI、图学习等主题贡献章节。
|
||||
我们欢迎任何形式的贡献,详细流程请参阅 **[贡献指南](v2/info/CONTRIBUTING_zh.md)**。
|
||||
|
||||
提交前请阅读:
|
||||
- [写作风格指南](info/style.md)
|
||||
- [中英文术语对照](info/terminology.md)
|
||||
- [写作样式规范](v2/info/style_zh.md)
|
||||
- [中英文术语对照](v2/info/terminology.md)
|
||||
|
||||
## 社区
|
||||
|
||||
|
||||
10
README_EN.md
10
README_EN.md
@@ -119,15 +119,11 @@ For more details, see the [Build Guide](info/info.md).
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome all forms of contributions, including:
|
||||
|
||||
- **Errata**: If you find text or figure errors, please open an Issue and @ the [chapter editors](info/editors.md), or submit a PR directly.
|
||||
- **Content updates**: Submit PRs to update or add Markdown files.
|
||||
- **New chapters**: We welcome community contributions on topics such as meta-learning systems, automatic parallelism, cluster scheduling, green AI, and graph learning.
|
||||
We welcome all forms of contributions. For the full workflow, see the **[Contributing Guide](v2/info/CONTRIBUTING.md)**.
|
||||
|
||||
Before contributing, please read:
|
||||
- [Writing Style Guide](info/style.md)
|
||||
- [Terminology Guide](info/terminology.md)
|
||||
- [Writing Style Guide](v2/info/style.md)
|
||||
- [Terminology Guide](v2/info/terminology.md)
|
||||
|
||||
## Community
|
||||
|
||||
|
||||
134
info/style.md
134
info/style.md
@@ -1,134 +0,0 @@
|
||||
# 样式规范
|
||||
从LaTeX迁移到Markdown。工具列表:
|
||||
* [Pandoc:](https://pandoc.org/getting-started.html) LaTeX转换为Markdown。
|
||||
* [Inkscape:](https://inkscape.org/release/inkscape-1.1.1/) pdf图片文件转换成svg图片文件
|
||||
|
||||
书写内容:
|
||||
* 页面划分:每章建一个目录,以一级子章节的维度建一个md页面,[参考地址](https://github.com/openmlsys/openmlsys-zh/tree/master/chapter_programming_interface) 。
|
||||
* 图存放位置: openmlsys-zh/img/自己章节,如openmlsys-zh/img/ch01,把自己章节的图片全部放置在对应目录。
|
||||
|
||||
## 文本
|
||||
|
||||
* LaTeX文件转换Markdown文件
|
||||
* Linux下安装Pandoc命令:apt-get install pandoc
|
||||
* 使用Pandoc命令:pandoc -s example.tex -o example.md
|
||||
* 使用Pandoc转换后需要注意修改的地方
|
||||
* 表格需要手动改
|
||||
* 图片需要手动改
|
||||
* 公式部分可能会有不正确,需要注意
|
||||
* 代码部分需要手动改,样式如下:
|
||||
```markdown
|
||||
``` python
|
||||
import os
|
||||
import argparse
|
||||
```
|
||||
```
|
||||
* 转换得到的md中,如果使用了"-"语法,则不能出现以下形式的内容:
|
||||
```markdown
|
||||
- title
|
||||
|
||||
content content content content content con...
|
||||
```
|
||||
即"-"之后空了一行,且内容行首空了4格,否则d2lbook会编译失败:
|
||||
|
||||
## 图片
|
||||
|
||||
* 软件
|
||||
* 使用PPT制图,以pdf导出,再使用Inkscape转成svg。
|
||||
* Inkscape软件使用:
|
||||
* 用Inkscape打开pdf,渐变曲线精细度选择为精细。
|
||||

|
||||
* 选中图片,我们可以看到图和其白底
|
||||

|
||||
* 随意找一块能选择的图,此时会出现周边有虚框
|
||||

|
||||
* 按住ctrl拉一下白色框,此时能将图片和白框分离出来,按Delete删除白框。
|
||||

|
||||
* 选择文件-文档属性-缩放页面内容-缩放页面到绘图或选区。
|
||||

|
||||
* 最后保存图片,用Pycharm看图片效果如下:无白色底,大小刚好框住整图。
|
||||

|
||||
|
||||
* 样式
|
||||
* 格式:
|
||||
* svg:自己绘制的图片需要用svg,注意去掉白底
|
||||
* png:一些常规举例图片不需去除白底的可以使用png
|
||||
* md里插入图片,大小选择宽度800个像素(可以依据自己生成的网页效果调整大小),label自动生成,例如:
|
||||
```python
|
||||

|
||||
:width:`800px`
|
||||
:label:`img_workflow`
|
||||
```
|
||||
|
||||
* 版权
|
||||
* 不使用网络图片
|
||||
* 位置
|
||||
* 两张图不可以较邻近
|
||||
* 两张图拼一下
|
||||
* 引用
|
||||
* 图片引用如下
|
||||
```python
|
||||

|
||||
:width:`800px`
|
||||
:label:`img_workflow`
|
||||
我们给这个图片打了标签img_workflow,此时对其进行引用如下
|
||||
机器学习系统工作流如 :numref:`img_workflow` 。必须注意的是在引用时冒号前要空有一个字符距离。
|
||||
```
|
||||
* 表格引用和图片引用类似,流程依旧是打上标签,然后用 :numref:‘引用的标签’
|
||||
```python
|
||||
下面为表格引用方式:
|
||||
|
||||
| Year | Number | Comment |
|
||||
| --- | --- | --- |
|
||||
| 2018 | 100 | Good year |
|
||||
:label:`table`
|
||||
表格引用使用 :numref:`table`
|
||||
```
|
||||
* 公式引用依旧也是打上标签,然后使用 :eqref:`‘引用的标签’
|
||||
```python
|
||||
下面为公式引用方式:
|
||||
|
||||
$$\hat{\mathbf{y}}=\mathbf X \mathbf{w}+b$$
|
||||
:eqlabel:`linear`
|
||||
公式引用使用 :eqref:`linear`
|
||||
```
|
||||
* 参考文献引用方式,参考文献放在references/xxx.bib,如需新增,只需在该文件中添加即可。参考文献使用 :cite:`文献`
|
||||
需要注意的是bib里的参考文献不能有重复的。
|
||||
```python
|
||||
下面参考文献的引用:
|
||||
1. 单篇参考文献
|
||||
这篇文章参考了论文 :cite:`cnn2015`
|
||||
2. 多篇参考文献可以用逗号分开
|
||||
这篇文章参考了论文 :cite:`cnn2015,rnn2015`
|
||||
|
||||
此时在对应bib中应该有如下参考文献
|
||||
@inproceedings{cnn2015,
|
||||
title = {CNN},
|
||||
author = {xxx},
|
||||
year = {2015},
|
||||
keywords = {xxx}
|
||||
}
|
||||
@inproceedings{rnn2015,
|
||||
title = {RNN},
|
||||
author = {xxx},
|
||||
year = {2015},
|
||||
keywords = {xxx}
|
||||
}
|
||||
```
|
||||
* 章节引用方式我们可以在节标题后放置一个标签,以允许该节的标签引用它。标签格式是:label:`标签名`
|
||||
```python
|
||||
### Referencing Sections
|
||||
:label:`my_sec3`
|
||||
```
|
||||
然后,我们可以在代码块中通过:ref:`标签名`引用这一节
|
||||
```python
|
||||
:ref:`my_sec3` 显示了章节引用.
|
||||
```
|
||||
|
||||
* 其他转换方式
|
||||
* 如果图中有很多公式,使用工具导入可能会有大量公式乱码,此时可以将图保存为.png格式。
|
||||
* 使用[在线图片去底工具](https://www.aigei.com/bgremover/) 将图片中的白底去除。
|
||||
|
||||
|
||||
|
||||
|
||||
121
v2/info/CONTRIBUTING.md
Normal file
121
v2/info/CONTRIBUTING.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# Contributing Guide
|
||||
|
||||
> **Note:** The v1 version of this project has been archived (located in the `v1/` directory) and no longer accepts new contributions. Please submit all content contributions to v2 (the `v2/` directory).
|
||||
|
||||
---
|
||||
|
||||
## Repository Structure
|
||||
|
||||
```
|
||||
openmlsys/
|
||||
├── v2/ # Version 2 (active version, accepting contributions)
|
||||
│ ├── zh_chapters/ # Chinese chapter source files
|
||||
│ │ ├── chapter_xxx/ # Per-chapter directory, containing index.md and section .md files
|
||||
│ │ ├── index.md # Book homepage
|
||||
│ │ └── SUMMARY.md # Auto-generated by script — do not edit manually
|
||||
│ ├── en_chapters/ # English chapter source files (same structure as zh_chapters)
|
||||
│ ├── books/zh/ # Chinese mdBook configuration (used for build)
|
||||
│ ├── docs/ # Documentation (location of this file)
|
||||
│ └── book.toml # English mdBook configuration
|
||||
├── v1/ # Version 1 (archived)
|
||||
├── img/ # Shared image assets for the entire book
|
||||
├── references/ # Reference directory
|
||||
├── tools/ # Build and preprocessing scripts
|
||||
│ ├── prepare_mdbook.py # Core preprocessor: parses custom syntax, generates SUMMARY
|
||||
│ └── mdbook_preprocessor.py # mdBook preprocessor entry point
|
||||
└── build_mdbook_v2.sh # One-click build script for v2
|
||||
```
|
||||
|
||||
**Important**: `SUMMARY.md` is auto-generated by `tools/prepare_mdbook_zh.py` based on the `toc` block in `index.md`. **Do not edit it manually.**
|
||||
|
||||
---
|
||||
|
||||
## Environment Setup
|
||||
|
||||
```bash
|
||||
# 1. Install Rust toolchain
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
|
||||
# 2. Install mdBook
|
||||
cargo install mdbook
|
||||
|
||||
# 3. Clone the repository
|
||||
git clone https://github.com/openmlsys/openmlsys.git
|
||||
cd openmlsys
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Local Build
|
||||
|
||||
### Build both Chinese and English versions of v2
|
||||
|
||||
```bash
|
||||
bash build_mdbook_v2.sh
|
||||
```
|
||||
|
||||
Build output is placed in `.mdbook-v2/book/cn/` (Chinese) and `.mdbook-v2/book/` (English).
|
||||
|
||||
### Live Preview
|
||||
|
||||
```bash
|
||||
# Live preview — Chinese version
|
||||
cd v2/books/zh && mdbook serve --open
|
||||
# Live preview — English version
|
||||
cd v2/ && mdbook serve --open
|
||||
```
|
||||
|
||||
After modifying source files under `zh_chapters/` or `en_chapters/`, the browser will refresh automatically.
|
||||
|
||||
> **Note**: The preprocessing script regenerates `SUMMARY.md` on every build. If you encounter a build error, first check that the `toc` block format in `index.md` is correct.
|
||||
|
||||
---
|
||||
|
||||
## Writing Guidelines
|
||||
|
||||
For detailed custom syntax (math, figure labels, citations, code blocks) and figure guidelines, refer to the **[Writing Style Guide](style.md)**.
|
||||
|
||||
---
|
||||
|
||||
## Submission Workflow
|
||||
|
||||
1. **Fork** this repository and create a feature branch:
|
||||
```bash
|
||||
git checkout -b feat/chapter-xxx-section-yyy
|
||||
```
|
||||
|
||||
2. **Validate locally**: After making changes, run `bash build_mdbook_v2.sh` and confirm there are no errors.
|
||||
|
||||
3. **Commit your changes**: Follow semantic commit message conventions:
|
||||
```bash
|
||||
git commit -m "feat(zh): 新增第X章第Y节内容"
|
||||
git commit -m "feat(en): Add content for chapter X section Y"
|
||||
git commit -m "ci: update main.yml"
|
||||
```
|
||||
Common prefixes: `feat` (new content), `fix` (corrections), `refactor` (restructuring), `style` (formatting), `ci` (build pipeline updates)
|
||||
|
||||
4. **Open a Pull Request** targeting the `main` branch. Please use the provided PR templates:
|
||||
|
||||
- [Chinese PR template](.github/PULL_REQUEST_TEMPLATE/zh.md)
|
||||
- [English PR template](.github/PULL_REQUEST_TEMPLATE/en.md)
|
||||
|
||||
5. **Code review**: At least one contributor other than the author is required to review the PR. GitHub Actions will automatically verify that the new content builds successfully.
|
||||
|
||||
---
|
||||
|
||||
## FAQ
|
||||
|
||||
**Q: How do I add a new chapter?**
|
||||
|
||||
- Create a `chapter_<name>/` directory under `v2/zh_chapters/`
|
||||
- Create `index.md` and list the sections inside a `toc` block
|
||||
- Register the new chapter in the `toc` block of `v2/zh_chapters/index.md`
|
||||
- Ensure the local build passes before submitting a PR
|
||||
|
||||
**Q: How do I add a reference?**
|
||||
|
||||
Add a BibTeX entry to `mlsys.bib`, then cite it in the body text using `:cite:\`key\``.
|
||||
|
||||
**Q: The build says it cannot find an image — what should I do?**
|
||||
|
||||
Check that the image path starts with `../img/` (relative to the chapter directory) and that the image file has been committed to the `img/` directory.
|
||||
121
v2/info/CONTRIBUTING_zh.md
Normal file
121
v2/info/CONTRIBUTING_zh.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# 贡献指南
|
||||
|
||||
> **注意:** 本项目的 v1 版本已归档(位于 `v1/` 目录),不再接受新的贡献。请将所有内容贡献提交至 v2(`v2/` 目录)。
|
||||
|
||||
---
|
||||
|
||||
## 仓库结构说明
|
||||
|
||||
```
|
||||
openmlsys/
|
||||
├── v2/ # 第二版(当前活跃版本,接受贡献)
|
||||
│ ├── zh_chapters/ # 中文章节源文件
|
||||
│ │ ├── chapter_xxx/ # 各章目录,包含 index.md 及各节 .md 文件
|
||||
│ │ ├── index.md # 全书首页
|
||||
│ │ └── SUMMARY.md # 由脚本自动生成,勿手动编辑
|
||||
│ ├── en_chapters/ # 英文章节源文件(结构与中文章节一致)
|
||||
│ ├── books/zh/ # 中文 mdBook 配置(供构建使用)
|
||||
│ ├── docs/ # 文档(本文件所在位置)
|
||||
│ └── book.toml # 英文版 mdBook 配置
|
||||
├── v1/ # 第一版(已归档)
|
||||
├── img/ # 全书共享图片资源
|
||||
├── references/ # 参考文献目录
|
||||
├── tools/ # 构建与预处理脚本
|
||||
│ ├── prepare_mdbook.py # 核心预处理:解析自定义语法、生成 SUMMARY
|
||||
│ └── mdbook_preprocessor.py # mdBook 预处理器入口
|
||||
└── build_mdbook_v2.sh # v2 一键构建脚本
|
||||
```
|
||||
|
||||
**重要**:`SUMMARY.md` 由 `tools/prepare_mdbook_zh.py` 根据 `index.md` 中的 `toc` 块自动生成,**请勿手动修改**。
|
||||
|
||||
---
|
||||
|
||||
## 环境准备
|
||||
|
||||
```bash
|
||||
# 1. 安装 Rust 工具链
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
|
||||
# 2. 安装 mdBook
|
||||
cargo install mdbook
|
||||
|
||||
# 3. 克隆仓库
|
||||
git clone https://github.com/openmlsys/openmlsys.git
|
||||
cd openmlsys
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 本地构建
|
||||
|
||||
### 构建 v2 中英文双版本
|
||||
|
||||
```bash
|
||||
bash build_mdbook_v2.sh
|
||||
```
|
||||
|
||||
构建产物输出至 `.mdbook-v2/book/cn/`(中文)和 `.mdbook-v2/book/`(英文)。
|
||||
|
||||
### 实时预览
|
||||
|
||||
```bash
|
||||
# 中文版实时预览
|
||||
cd v2/books/zh && mdbook serve --open
|
||||
# 英文版实时预览
|
||||
cd v2/ && mdbook serve --open
|
||||
```
|
||||
|
||||
修改 `zh_chapters/` 或 `en_chapters/` 下的源文件后,浏览器将自动刷新。
|
||||
|
||||
> **注意**:预处理脚本会在每次构建时重新生成 `SUMMARY.md`,如遇构建报错请先检查 `index.md` 中 `toc` 块的格式是否正确。
|
||||
|
||||
---
|
||||
|
||||
## 写作规范
|
||||
|
||||
详细的自定义语法(公式、图片标签、文献引用、代码块等)及图片规范,请参阅 **[写作样式规范](style_zh.md)**。
|
||||
|
||||
---
|
||||
|
||||
## 提交流程
|
||||
|
||||
1. **Fork** 本仓库并创建功能分支:
|
||||
```bash
|
||||
git checkout -b feat/chapter-xxx-section-yyy
|
||||
```
|
||||
|
||||
2. **本地构建验证**:修改完成后运行 `bash build_mdbook_v2.sh`,确保无报错
|
||||
|
||||
3. **提交代码**:遵循语义化提交信息
|
||||
```bash
|
||||
git commit -m "feat(zh): 新增第X章第Y节内容"
|
||||
git commit -m "feat(en): Add content for chapter X section Y"
|
||||
git commit -m "ci: update main.yml"
|
||||
```
|
||||
常用前缀:`feat`(新内容)、`fix`(修正错误)、`refactor`(重组结构)、`style`(格式调整)、`ci`(构建流程更新)
|
||||
|
||||
4. **发起 Pull Request**:目标分支为 `main`,请使用 PR 模板:
|
||||
|
||||
- [中文 PR 模板](.github/PULL_REQUEST_TEMPLATE/zh.md)
|
||||
- [英文 PR 模板](.github/PULL_REQUEST_TEMPLATE/en.md)
|
||||
|
||||
5. **代码审查**:PR要求至少有一位非本人Contributor进行检查,且github action将会自动验证新增内容是否可以编译通过
|
||||
|
||||
---
|
||||
|
||||
## 常见问题
|
||||
|
||||
**Q:如何添加新章节?**
|
||||
|
||||
- 在 `v2/zh_chapters/` 下新建 `chapter_<名称>/` 目录
|
||||
- 创建 `index.md`,在其中使用 `toc` 块列出各节
|
||||
- 在全书 `v2/zh_chapters/index.md` 的 `toc` 块中注册新章节
|
||||
- 确保本地构建通过后再提交 PR
|
||||
|
||||
**Q:参考文献如何添加?**
|
||||
|
||||
在 `mlsys.bib` 中添加 BibTeX 格式的文献条目,然后在正文中使用 `:cite:\`key\`` 引用。
|
||||
|
||||
**Q:构建时提示找不到图片怎么处理?**
|
||||
|
||||
检查图片路径是否以 `../img/` 开头(相对于章节目录),以及图片文件是否已提交至 `img/` 目录。
|
||||
173
v2/info/style.md
Normal file
173
v2/info/style.md
Normal file
@@ -0,0 +1,173 @@
|
||||
# Writing Style Guide
|
||||
|
||||
This document defines the formatting and style requirements for v2 chapter content. All contributors must follow these guidelines when writing or modifying content.
|
||||
|
||||
> **Note:** The LaTeX-to-Markdown conversion workflow has been **deprecated**. All v2 content is written directly in Markdown — no Pandoc or similar tools are needed.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [File Structure](#file-structure)
|
||||
- [Custom Syntax](#custom-syntax)
|
||||
- [Figure Guidelines](#figure-guidelines)
|
||||
- [Table Guidelines](#table-guidelines)
|
||||
- [Code Block Guidelines](#code-block-guidelines)
|
||||
- [References](#references)
|
||||
|
||||
---
|
||||
|
||||
## File Structure
|
||||
|
||||
- Each chapter corresponds to a `v2/en_chapters/chapter_<name>/` directory
|
||||
- The chapter entry file is `index.md`; section content goes in separate `.md` files in the same directory
|
||||
- Declare the section structure in `index.md` using a `toc` block (used to auto-generate `SUMMARY.md`):
|
||||
|
||||
```markdown
|
||||
```toc
|
||||
:maxdepth: 2
|
||||
|
||||
section_one
|
||||
section_two
|
||||
```
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Custom Syntax
|
||||
|
||||
The project preprocessor supports the following extended Markdown syntax. **Follow it strictly** to ensure a correct build.
|
||||
|
||||
### Inline Math
|
||||
|
||||
```markdown
|
||||
The model learns the mapping $f: \mathcal{X} \rightarrow \mathcal{Y}$.
|
||||
```
|
||||
|
||||
### Display Math with Label
|
||||
|
||||
Label names should include a language suffix (e.g., `-en`) to avoid conflicts with Chinese labels:
|
||||
|
||||
```markdown
|
||||
$$
|
||||
\mathcal{L}_{CE} = -\sum_{i=1}^{N} y_i \log(\hat{y}_i)
|
||||
$$
|
||||
:eqlabel:`eq-cross-entropy-en`
|
||||
```
|
||||
|
||||
Reference an equation: `:eqref:\`eq-cross-entropy-en\``
|
||||
|
||||
### Figures with Labels
|
||||
|
||||
```markdown
|
||||

|
||||
:width:`600px`
|
||||
:label:`figure-label-en`
|
||||
```
|
||||
|
||||
Reference a figure: `:numref:\`figure-label-en\``
|
||||
|
||||
### Section References
|
||||
|
||||
Add a label after a section heading:
|
||||
|
||||
```markdown
|
||||
### Section Title
|
||||
:label:`my-section-en`
|
||||
```
|
||||
|
||||
Reference the section: `:ref:\`my-section-en\``
|
||||
|
||||
### Citations
|
||||
|
||||
```markdown
|
||||
The perceptron :cite:`rosenblatt1958perceptron` is one of the earliest neural network models.
|
||||
```
|
||||
|
||||
Multiple citations separated by commas: `:cite:\`paper1,paper2\``
|
||||
|
||||
All bibliography entries are maintained in `mlsys.bib` (see [References](#references)).
|
||||
|
||||
---
|
||||
|
||||
## Figure Guidelines
|
||||
|
||||
### Storage Location
|
||||
|
||||
Store figures under `img/ch<chapter-number>/`, e.g., `img/ch01/`. Image files must be committed together with the PR.
|
||||
|
||||
### Naming
|
||||
|
||||
Use lowercase English with hyphens, e.g., `framework-architecture.png`.
|
||||
|
||||
### Format
|
||||
|
||||
| Format | Use case |
|
||||
|--------|---------|
|
||||
| SVG | Hand-drawn diagrams and flowcharts (vector, lossless scaling); remove white background |
|
||||
| PNG | Screenshots, photos, or images with complex gradients |
|
||||
|
||||
Recommended tools: PPT, draw.io. **Do not use images from the internet** (copyright risk).
|
||||
|
||||
### Resolution and Size
|
||||
|
||||
- Recommended resolution: ≥ 150 dpi
|
||||
- Maximum width: 1200 px
|
||||
- Set display width in Markdown via `:width:` (600–800 px recommended)
|
||||
|
||||
### Layout
|
||||
|
||||
Include sufficient explanatory text between adjacent figures. Do not place figures immediately next to each other.
|
||||
|
||||
---
|
||||
|
||||
## Table Guidelines
|
||||
|
||||
Use standard Markdown table syntax. Add a label to any table that needs to be referenced:
|
||||
|
||||
```markdown
|
||||
| Column 1 | Column 2 | Column 3 |
|
||||
|----------|----------|----------|
|
||||
| Value 1 | Value 2 | Value 3 |
|
||||
:label:`table-label-en`
|
||||
```
|
||||
|
||||
Reference a table: `:numref:\`table-label-en\``
|
||||
|
||||
---
|
||||
|
||||
## Code Block Guidelines
|
||||
|
||||
Use standard Markdown fenced code blocks and always specify the language:
|
||||
|
||||
````markdown
|
||||
```python
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
```
|
||||
````
|
||||
|
||||
Common language identifiers: `python`, `bash`, `cpp`, `markdown`, `text`.
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
Add BibTeX entries to `mlsys.bib`:
|
||||
|
||||
```bibtex
|
||||
@inproceedings{key2015,
|
||||
title = {Title of the Paper},
|
||||
author = {Author, A. and Author, B.},
|
||||
year = {2015}
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** Duplicate keys in `mlsys.bib` are not allowed. Search for existing entries before adding a new one.
|
||||
|
||||
Example citations in body text:
|
||||
|
||||
```markdown
|
||||
This chapter references the paper :cite:`cnn2015`.
|
||||
Multiple citations: :cite:`cnn2015,rnn2015`.
|
||||
```
|
||||
173
v2/info/style_zh.md
Normal file
173
v2/info/style_zh.md
Normal file
@@ -0,0 +1,173 @@
|
||||
# 写作样式规范
|
||||
|
||||
本文档规定了 v2 章节内容的写作格式与样式要求。所有贡献者在撰写或修改内容时请遵循以下规范。
|
||||
|
||||
> **注意:** LaTeX 转 Markdown 的工作流已**废弃**。v2 中所有内容直接使用 Markdown 书写,无需通过 Pandoc 等工具转换。
|
||||
|
||||
---
|
||||
|
||||
## 目录
|
||||
|
||||
- [文件结构](#文件结构)
|
||||
- [自定义语法](#自定义语法)
|
||||
- [图片规范](#图片规范)
|
||||
- [表格规范](#表格规范)
|
||||
- [代码块规范](#代码块规范)
|
||||
- [参考文献](#参考文献)
|
||||
|
||||
---
|
||||
|
||||
## 文件结构
|
||||
|
||||
- 每章对应 `v2/zh_chapters/chapter_<名称>/` 目录
|
||||
- 章节入口为 `index.md`,各节内容放在同目录下的独立 `.md` 文件中
|
||||
- 在 `index.md` 中使用 `toc` 块声明本章的节结构(脚本据此自动生成 `SUMMARY.md`):
|
||||
|
||||
```markdown
|
||||
```toc
|
||||
:maxdepth: 2
|
||||
|
||||
section_one
|
||||
section_two
|
||||
```
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 自定义语法
|
||||
|
||||
本项目的预处理器支持以下扩展 Markdown 语法,**请严格遵守**以确保构建正确。
|
||||
|
||||
### 行内公式
|
||||
|
||||
```markdown
|
||||
模型学习映射 $f: \mathcal{X} \rightarrow \mathcal{Y}$。
|
||||
```
|
||||
|
||||
### 行间公式与标签
|
||||
|
||||
公式标签格式为 `:eqlabel:\`<标签名>\``,标签名建议以语言后缀结尾(如 `-zh`)以避免中英文冲突:
|
||||
|
||||
```markdown
|
||||
$$
|
||||
\mathcal{L}_{CE} = -\sum_{i=1}^{N} y_i \log(\hat{y}_i)
|
||||
$$
|
||||
:eqlabel:`eq-cross-entropy-zh`
|
||||
```
|
||||
|
||||
引用公式:`:eqref:\`eq-cross-entropy-zh\``
|
||||
|
||||
### 图片与标签
|
||||
|
||||
```markdown
|
||||

|
||||
:width:`600px`
|
||||
:label:`figure-label-zh`
|
||||
```
|
||||
|
||||
引用图片:`:numref:\`figure-label-zh\``
|
||||
|
||||
### 章节引用
|
||||
|
||||
在节标题后添加标签:
|
||||
|
||||
```markdown
|
||||
### 节标题
|
||||
:label:`my-section-zh`
|
||||
```
|
||||
|
||||
引用该节:`:ref:\`my-section-zh\``
|
||||
|
||||
### 文献引用
|
||||
|
||||
```markdown
|
||||
感知机 :cite:`rosenblatt1958perceptron` 是最早期的神经网络模型之一。
|
||||
```
|
||||
|
||||
多篇文献用逗号分隔:`:cite:\`paper1,paper2\``
|
||||
|
||||
参考文献条目统一维护在 `mlsys.bib` 中(详见[参考文献](#参考文献)一节)。
|
||||
|
||||
---
|
||||
|
||||
## 图片规范
|
||||
|
||||
### 存放位置
|
||||
|
||||
图片存放于 `img/ch<章节编号>/` 目录下,如 `img/ch01/`。图片文件须随 PR 一起提交。
|
||||
|
||||
### 文件命名
|
||||
|
||||
使用英文小写加连字符,如 `framework-architecture.png`。
|
||||
|
||||
### 格式
|
||||
|
||||
| 格式 | 适用场景 |
|
||||
|------|---------|
|
||||
| SVG | 自行绘制的流程图、示意图(矢量,缩放不失真),需去除白色背景 |
|
||||
| PNG | 截图、照片、含复杂渐变的图片 |
|
||||
|
||||
推荐使用 PPT、draw.io 等工具绘制后导出。**不得使用网络图片**(版权风险)。
|
||||
|
||||
### 分辨率与尺寸
|
||||
|
||||
- 推荐分辨率:≥ 150 dpi
|
||||
- 宽度不超过 1200 px
|
||||
- Markdown 中通过 `:width:` 指定显示宽度(建议 600–800 px)
|
||||
|
||||
### 排版
|
||||
|
||||
相邻两张图之间须有足够的文字说明,避免图片紧邻。
|
||||
|
||||
---
|
||||
|
||||
## 表格规范
|
||||
|
||||
使用标准 Markdown 表格语法,并为需要引用的表格打标签:
|
||||
|
||||
```markdown
|
||||
| 列名 1 | 列名 2 | 列名 3 |
|
||||
|--------|--------|--------|
|
||||
| 值 1 | 值 2 | 值 3 |
|
||||
:label:`table-label-zh`
|
||||
```
|
||||
|
||||
引用表格:`:numref:\`table-label-zh\``
|
||||
|
||||
---
|
||||
|
||||
## 代码块规范
|
||||
|
||||
使用标准 Markdown 围栏代码块,必须标注语言类型:
|
||||
|
||||
````markdown
|
||||
```python
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
```
|
||||
````
|
||||
|
||||
常用语言标识:`python`、`bash`、`cpp`、`markdown`、`text`。
|
||||
|
||||
---
|
||||
|
||||
## 参考文献
|
||||
|
||||
在 `mlsys.bib` 中添加 BibTeX 格式的文献条目:
|
||||
|
||||
```bibtex
|
||||
@inproceedings{key2015,
|
||||
title = {Title of the Paper},
|
||||
author = {Author, A. and Author, B.},
|
||||
year = {2015}
|
||||
}
|
||||
```
|
||||
|
||||
**注意**:`mlsys.bib` 中不可出现重复的 key,添加前请先检索是否已存在。
|
||||
|
||||
正文引用示例:
|
||||
|
||||
```markdown
|
||||
这篇文章参考了论文 :cite:`cnn2015`。
|
||||
多篇文献引用::cite:`cnn2015,rnn2015`。
|
||||
```
|
||||
Reference in New Issue
Block a user