refactor: simplify DocDialog and move documentation to markdown body
Simplify the `DocDialog` component by removing hardcoded property tables and syntax blocks. Instead, rely on the raw markdown body provided in the `DocEntry` to render documentation content. This shifts the responsibility of formatting (syntax, props, etc.) from the component to the individual markdown files, allowing for more flexible and detailed documentation.
This commit is contained in:
+37
-10
@@ -2,17 +2,12 @@
|
||||
tag: md-table
|
||||
icon: 📊
|
||||
title: 表格组件
|
||||
description: 将 CSV 数据转换为可切换标签页的表格,支持随机抽取和变量引用。
|
||||
syntax: ':md-table[./data.csv]{roll=true remix=true}'
|
||||
props:
|
||||
- name: roll
|
||||
type: boolean
|
||||
desc: 显示随机切换按钮
|
||||
- name: remix
|
||||
type: boolean
|
||||
desc: 支持 {{prop}} 引用同行其他列
|
||||
---
|
||||
|
||||
将 CSV 数据转换为可切换标签页的表格,支持内联 CSV、随机抽取、加权随机和变量引用。
|
||||
|
||||
**语法:** `:md-table[./data.csv]{选项}`
|
||||
|
||||
**基础表格:**
|
||||
```markdown
|
||||
:md-table[./npcs.csv]
|
||||
@@ -28,7 +23,39 @@ props:
|
||||
:md-table[./quests.csv]{roll=true remix=true}
|
||||
```
|
||||
|
||||
CSV 要求包含 label, body 列,可选 group 列分组。支持 YAML front matter 继承行属性。
|
||||
**内联 CSV(直接写入内容):**
|
||||
```markdown
|
||||
:md-table[label,body,group
|
||||
A,这是一段描述,第一章
|
||||
B,另一段描述,第二章]{}
|
||||
```
|
||||
|
||||
支持通过文件路径加载 CSV,也可以直接将 CSV 数据内联写在指令中。CSV 要求包含 `label`、`body` 列,可选 `group` 列分组。
|
||||
|
||||
## 分组
|
||||
|
||||
当 CSV 包含 `group` 列时,表格顶部会显示分组标签页,可切换查看不同分组的数据。
|
||||
|
||||
## 随机抽取
|
||||
|
||||
当 `roll=true` 时,表格顶部显示 🎲 随机按钮:
|
||||
- 普通随机:从所有行中均匀随机选取
|
||||
- **加权随机**:当 `label` 列全部为整数或整数范围格式(如 `1-3`)时,以 label 值为权重进行加权随机抽取
|
||||
|
||||
## 变量引用
|
||||
|
||||
当 `remix=true` 时,`body` 列中可使用 `{{prop}}` 语法引用同行其他列或 YAML front matter 中的数据。开启 `remix` 后每次随机抽取会从所有行中随机选取一行来解析变量。
|
||||
|
||||
## YAML Front Matter
|
||||
|
||||
CSV 文件可包含 YAML front matter(文件开头的 `---` 块),其中定义的属性可通过 `{{prop}}` 在 `body` 中引用。
|
||||
|
||||
## 属性
|
||||
|
||||
| 属性 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `roll` | boolean | 显示随机切换按钮 |
|
||||
| `remix` | boolean | 支持 `{{prop}}` 引用同行其他列 |
|
||||
|
||||
## 使用场景
|
||||
|
||||
|
||||
Reference in New Issue
Block a user