feat: add CSV support for journal stat blocks

This commit is contained in:
2026-07-09 09:47:17 +08:00
parent 138c089514
commit 45cd9a01ac
2 changed files with 138 additions and 2 deletions
+39 -1
View File
@@ -40,7 +40,11 @@ props:
## 属性定义语法
在任意 `.md` 文档中插入 ` ```yaml role=stat ` 代码块:
支持两种格式:**YAML**(适合复杂属性)和 **CSV**(适合同质列表)。
### YAML 格式
`.md` 文档中插入 ` ```yaml role=stat ` 代码块:
```yaml role=stat
- key: strength
@@ -93,6 +97,40 @@ props:
- 暴风雨
```
### CSV 格式
对于同质属性列表(如多个 `number` 类型的属性),CSV 更紧凑。
插入 ` ```csv role=stat ` 代码块:
```csv role=stat
key,label,type,roll
mind,心智,number,2d10+20
heart,心灵,number,2d10+20
strength,力量,number,2d10+20
speed,速度,number,2d10+20
```
CSV 列说明:
| 列 | 必填 | 默认值 | 说明 |
|---|---|---|---|
| `key` | ✅ | — | 属性标识符 |
| `label` | — | key 的值 | 显示名称 |
| `type` | — | `number` | 属性类型 |
| `scope` | — | `player` | `player` 或 `global` |
| `default` | — | — | 默认值 |
| `roll` | — | — | 掷骰公式 |
| `target` | — | — | modifier 的目标 key |
| `formula` | — | — | derived 的计算公式 |
| `options` | — | — | enum 选项,用 `\|` 分隔 |
示例 — enum 属性:
```csv role=stat
key,label,type,options
weather,天气,enum,晴天\|阴天\|雨天\|暴风雨
```
### 关键语法说明
- **`key`**:唯一标识符。使用纯名字(如 `strength`),不用加玩家前缀