style(docs): standardize heading formats and numbering

- Enforce Level 1-3 structural numbering based on SUMMARY.md hierarchy
- Remove structural numbering from Level 4+ headings
- Eliminate single child headings by converting to bold text
- Auto-inject summary text for headings with multiple children missing intro text
- Exclude Appendix chapters from structural numbering
- Avoid modifying code block contents
- Add script to detect non-standard English usage in headers
This commit is contained in:
Baohua Yang
2026-02-21 22:40:33 -08:00
parent 33af380be1
commit 175aaae48a
136 changed files with 1015 additions and 766 deletions

View File

@@ -4,7 +4,7 @@
本节使用 Docker Compose 配置并运行一个 **Rails + PostgreSQL** 应用
### 架构概览
### 10.7.1 架构概览
如图 10-2 所示Rails PostgreSQL 在同一 Compose 网络中协同工作
@@ -33,7 +33,7 @@ flowchart TD
10-2 Rails + PostgreSQL Compose 架构
### 准备工作
### 10.7.2 准备工作
创建项目目录
@@ -43,7 +43,7 @@ $ mkdir rails-docker && cd rails-docker
需要创建三个文件`Dockerfile``Gemfile` `compose.yaml`
### 步骤 1创建 Dockerfile
### 10.7.3 步骤 1创建 Dockerfile
如下代码块所示展示了相关示例
@@ -80,7 +80,7 @@ COPY . /myapp
| `nodejs` | Rails Asset Pipeline 需要 |
| 先复制 Gemfile | 只有依赖变化时才重新 `bundle install` |
### 步骤 2创建 Gemfile
### 10.7.4 步骤 2创建 Gemfile
创建一个初始的 `Gemfile`稍后会被 `rails new` 覆盖
@@ -95,7 +95,7 @@ gem 'rails', '~> 7.1'
$ touch Gemfile.lock
```
### 步骤 3创建 compose.yaml
### 10.7.5 步骤 3创建 compose.yaml
配置如下
@@ -133,7 +133,7 @@ volumes:
| `depends_on: db` | 确保数据库先启动 |
| `DATABASE_URL` | Rails 12-factor 风格的数据库配置 |
### 步骤 4生成 Rails 项目
### 10.7.6 步骤 4生成 Rails 项目
使用 `docker compose run` 生成项目骨架
@@ -160,7 +160,7 @@ compose.yaml bin db public
> **Linux 用户**如遇权限问题执行 `sudo chown -R $USER:$USER .`
### 步骤 5重新构建镜像
### 10.7.7 步骤 5重新构建镜像
由于生成了新的 Gemfile需要重新构建镜像以安装完整依赖
@@ -168,7 +168,7 @@ compose.yaml bin db public
$ docker compose build
```
### 步骤 6配置数据库连接
### 10.7.8 步骤 6配置数据库连接
修改 `config/database.yml`
@@ -192,7 +192,7 @@ production:
> 💡 使用 `DATABASE_URL` 环境变量配置数据库符合 12-factor 应用原则便于在不同环境间切换
### 步骤 7启动应用
### 10.7.9 步骤 7启动应用
运行以下命令
@@ -212,7 +212,7 @@ web-1 | Puma starting in single mode...
web-1 | * Listening on http://0.0.0.0:3000
```
### 步骤 8创建数据库
### 10.7.10 步骤 8创建数据库
在另一个终端执行
@@ -224,7 +224,7 @@ Created database 'myapp_test'
访问 http://localhost:3000 查看 Rails 欢迎页面。
### 常用开发命令
### 10.7.11 常用开发命令
运行以下命令
@@ -250,7 +250,7 @@ $ docker compose exec web rails generate scaffold Post title:string body:text
$ docker compose exec web bash
```
### 常见问题
### 10.7.12 常见问题
本节涵盖了相关内容与详细描述主要探讨以下几个方面
@@ -281,7 +281,7 @@ $ docker compose exec web rm -f tmp/pids/server.pid
$ docker compose run --rm web bundle update
```
### 开发 vs 生产
### 10.7.13 开发 vs 生产
相关信息如下表
@@ -292,7 +292,7 @@ $ docker compose run --rm web bundle update
| 静态资源 | 动态编译 | 预编译 (`rails assets:precompile`) |
| 数据库密码 | 明文配置 | 使用 Secrets 管理 |
### 延伸阅读
### 10.7.14 延伸阅读
- [使用 Django](10.6_django.md)Python Web 框架实战
- [Compose 模板文件](10.5_compose_file.md)配置详解