# cdyforever/how-to-live-better architecture

> Architecture diagram of the GitHub repository cdyforever/how-to-live-better, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cdyforever/how-to-live-better
- Repository: https://github.com/cdyforever/how-to-live-better

## Overview

这是一本中文建议集的自包含网页阅读器：生成脚本从上游书籍章节构建单文件 HTML，读者在浏览器中阅读并使用页面内的搜索、筛选和导航。主要阅读功能在 index.html 中；README 记录了页面能力，但没有提供其源代码细节，因此不拆分未证实的内部调用。

Main entry points: [`index.html`](https://github.com/cdyforever/how-to-live-better/blob/main/index.html) (单文件阅读页), [`build.py`](https://github.com/cdyforever/how-to-live-better/blob/main/build.py) (章节渲染器)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["内容生成"]
  node_builder["章节渲染器<br/>[build.py]"]
end

subgraph group_reading["阅读体验"]
  node_page["单文件阅读页<br/>[index.html]"]
  node_search["搜索与筛选<br/>[index.html]"]
  node_navigation["目录与滚动导航<br/>[index.html]"]
  node_display["主题与打印<br/>[index.html]"]
end

node_maintainer(("维护者"))
node_upstream["上游书籍章节"]
node_reader(("读者"))

node_maintainer -.->|"提供章节"| node_upstream
node_maintainer -->|"运行生成"| node_builder
node_builder -->|"读取章节"| node_upstream
node_builder -->|"生成 HTML"| node_page
node_reader -->|"打开阅读"| node_page
node_reader -->|"搜索筛选"| node_search
node_reader -->|"跳转章节"| node_navigation
node_reader -->|"切换显示"| node_display
node_search -->|"筛选高亮"| node_page
node_navigation -->|"定位章节"| node_page
node_display -->|"调整呈现"| node_page

click node_builder "https://github.com/cdyforever/how-to-live-better/blob/main/build.py"
click node_page "https://github.com/cdyforever/how-to-live-better/blob/main/index.html"
click node_search "https://github.com/cdyforever/how-to-live-better/blob/main/index.html"
click node_navigation "https://github.com/cdyforever/how-to-live-better/blob/main/index.html"
click node_display "https://github.com/cdyforever/how-to-live-better/blob/main/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_builder toneBlue
class node_page,node_search,node_navigation,node_display toneAmber
class node_maintainer,node_upstream,node_reader toneIndigo
```

## Components

### 内容生成

- [章节渲染器](https://github.com/cdyforever/how-to-live-better/blob/main/build.py): `build.py`

### 阅读体验

- [单文件阅读页](https://github.com/cdyforever/how-to-live-better/blob/main/index.html): `index.html`
- [搜索与筛选](https://github.com/cdyforever/how-to-live-better/blob/main/index.html): `index.html`
- [目录与滚动导航](https://github.com/cdyforever/how-to-live-better/blob/main/index.html): `index.html`
- [主题与打印](https://github.com/cdyforever/how-to-live-better/blob/main/index.html): `index.html`

### Other components

- **维护者**
- **上游书籍章节**
- **读者**

## Connections

- 维护者 → 上游书籍章节: 提供章节
- 维护者 → 章节渲染器: 运行生成
- 章节渲染器 → 上游书籍章节: 读取章节
- 章节渲染器 → 单文件阅读页: 生成 HTML
- 读者 → 单文件阅读页: 打开阅读
- 读者 → 搜索与筛选: 搜索筛选
- 读者 → 目录与滚动导航: 跳转章节
- 读者 → 主题与打印: 切换显示
- 搜索与筛选 → 单文件阅读页: 筛选高亮
- 目录与滚动导航 → 单文件阅读页: 定位章节
- 主题与打印 → 单文件阅读页: 调整呈现
