1
0

refactor: 重构文档结构,采用渐进式信息披露模式

将 README.md 拆分为多个专题文档,减少认知负荷:
- 用户文档迁移到 docs/ (用户指南、元素、模板、参考等)
- 开发文档迁移到 docs/development/ (架构、模块、规范)
- README.md 精简至 ~290 行,仅保留概览和导航
- 删除 README_DEV.md,内容已迁移
- 归档 OpenSpec 变更 refactor-docs-progressive-disclosure
This commit is contained in:
2026-03-06 15:11:36 +08:00
parent 98098dc911
commit 124ef0e5ce
41 changed files with 5238 additions and 2228 deletions

147
docs/elements/table.md Normal file
View File

@@ -0,0 +1,147 @@
# 表格元素
表格元素用于在幻灯片中创建表格。
## 基本语法
```yaml
- type: table
position: [x, y]
col_widths: [2, 2, 2] # 每列宽度(英寸)
data:
- ["表头1", "表头2", "表头3"]
- ["数据1", "数据2", "数据3"]
- ["数据4", "数据5", "数据6"]
font:
family: "Arial"
size: 14
color: "#333333"
header_font:
bold: true
color: "#ffffff"
style:
header_bg: "#4a90e2"
```
## 属性
| 属性 | 类型 | 必需 | 说明 |
|------|------|------|------|
| `type` | 字符串 | 是 | 必须为 "table" |
| `position` | 数组 | 是 | 表格位置 [x, y](英寸) |
| `col_widths` | 数组 | 是 | 每列宽度(英寸) |
| `data` | 数组 | 是 | 表格数据(二维数组) |
| `font` | 对象 | 否 | 数据单元格字体样式 |
| `header_font` | 对象 | 否 | 表头单元格字体样式 |
| `style` | 对象 | 否 | 表格样式 |
## 字体配置
### font数据单元格
数据单元格的字体样式:
```yaml
font:
family: "Arial"
size: 14
color: "#333333"
bold: false
```
### header_font表头单元格
表头单元格的字体样式。如果未定义,继承 `font` 的配置:
```yaml
header_font:
bold: true
color: "#ffffff"
# 其他属性继承自 font
```
### style表格样式
```yaml
style:
header_bg: "#4a90e2" # 表头背景色
```
## 示例
### 基本表格
```yaml
slides:
- elements:
- type: table
position: [1, 1]
col_widths: [2, 2, 2]
data:
- ["姓名", "年龄", "城市"]
- ["张三", "25", "北京"]
- ["李四", "30", "上海"]
```
### 样式化表格
```yaml
slides:
- elements:
- type: table
position: [1, 1]
col_widths: [2.5, 2.5, 2.5]
data:
- ["产品", "价格", "库存"]
- ["产品A", "100元", "50"]
- ["产品B", "200元", "30"]
font:
family: "sans"
size: 14
color: "#333333"
header_font:
bold: true
color: "#ffffff"
style:
header_bg: "#3498db"
```
### 使用字体主题
```yaml
metadata:
fonts:
table-font:
family: "sans"
size: 14
color: "#333333"
slides:
- elements:
- type: table
position: [1, 1]
col_widths: [2, 2, 2]
data:
- ["列1", "列2"]
- ["数据1", "数据2"]
font: "@table-font"
header_font:
parent: "@table-font"
bold: true
color: "#ffffff"
style:
header_bg: "#4a90e2"
```
## 注意事项
- `col_widths` 数组长度必须与每行的列数一致
- 所有行的列数必须相同
- 第一行默认为表头
## 相关文档
- [字体主题系统](../fonts.md) - 字体配置和主题管理
- [坐标系统](../reference/coordinates.md) - 位置和尺寸单位
[返回文档索引](../README.md)