docs: document md-print usage
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: tttk-authoring
|
name: tttk-authoring
|
||||||
description: Author and edit TTRPG game design documents for the tttk (Tabletop Toolkit) CLI. Use when writing or modifying markdown content that uses tttk custom elements (:md-dice, :md-table, :md-deck, :md-pins, etc.), custom fenced code blocks (role=spark-table / declare / file / tag), companion CSV data files, or when previewing content with `tttk serve` and validating it with `tttk check`.
|
description: Author and edit TTRPG game design documents for the tttk (Tabletop Toolkit) CLI. Use when writing or modifying markdown content that uses tttk custom elements (:md-dice, :md-table, :md-deck, :md-print, :md-pins, etc.), custom fenced code blocks (role=spark-table / declare / file / tag), companion CSV data files, or when previewing content with `tttk serve` and validating it with `tttk check`.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Authoring tttk game design documents
|
# Authoring tttk game design documents
|
||||||
@@ -82,6 +82,9 @@ marker, and fence attribute keys may contain hyphens (e.g. `data-foo=bar`):
|
|||||||
- For card decks, use the `yaml role=tag` form with `tag: md-deck` (see
|
- For card decks, use the `yaml role=tag` form with `tag: md-deck` (see
|
||||||
`yaml-tag.md`). The `:md-deck[...]{...}` directive is legacy and can't express
|
`yaml-tag.md`). The `:md-deck[...]{...}` directive is legacy and can't express
|
||||||
template layers or card backs.
|
template layers or card backs.
|
||||||
|
- To print a rules document, use `:md-print[./rules.md]` (or the `yaml role=tag`
|
||||||
|
form). It paginates into A4 landscape sheets holding two A5 pages, each with
|
||||||
|
`columns` columns (default 2). See `reference.md` for the attributes.
|
||||||
- Keep CSV files clean — header row plus data. Put deck config and templates in
|
- Keep CSV files clean — header row plus data. Put deck config and templates in
|
||||||
the YAML block's `data-config`, not in CSV front matter (see `csv.md`).
|
the YAML block's `data-config`, not in CSV front matter (see `csv.md`).
|
||||||
- `{{prop}}` in a CSV `body` interpolates another column (or front-matter key)
|
- `{{prop}}` in a CSV `body` interpolates another column (or front-matter key)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ npx tttk check ./content
|
|||||||
| 🎲 骰子 | `:md-dice[2d6+d8]` | 掷骰并记录结果 |
|
| 🎲 骰子 | `:md-dice[2d6+d8]` | 掷骰并记录结果 |
|
||||||
| 📊 表格 | `:md-table[./data.csv]` | 标签页式表格 |
|
| 📊 表格 | `:md-table[./data.csv]` | 标签页式表格 |
|
||||||
| 🃏 卡牌 | `:md-deck[./cards.csv]` | 卡牌布局(推荐 `yaml role=tag` 写法) |
|
| 🃏 卡牌 | `:md-deck[./cards.csv]` | 卡牌布局(推荐 `yaml role=tag` 写法) |
|
||||||
|
| 🖨️ 打印版式 | `:md-print[./rules.md]` | A4 横版双 A5、多列排版并导出 PDF |
|
||||||
| 📍 标记 | `:md-pins[./map.png]{pins="A:25,50"}` | 图片标记 |
|
| 📍 标记 | `:md-pins[./map.png]{pins="A:25,50"}` | 图片标记 |
|
||||||
|
|
||||||
## 技术栈
|
## 技术栈
|
||||||
|
|||||||
@@ -458,6 +458,47 @@ data-config:
|
|||||||
|
|
||||||
每个图层通过 `prop`(读取 CSV 字段)或 `template`(渲染带 `{{变量}}` 替换的 markdown 模板)定义,`pos` 为网格位置 `x1,y1-x2,y2`(1-based,与紧凑 layers 字符串同格式),支持 `font`、`orientation`、`align`(水平 `l`/`c`/`r`,可加垂直前缀 `t`/`b` 组成 `tl`/`tc`/`tr`/`bl`/`bc`/`br`,如 `align: tl` 表示左上对齐)。`back_layers` 用于背面图层。
|
每个图层通过 `prop`(读取 CSV 字段)或 `template`(渲染带 `{{变量}}` 替换的 markdown 模板)定义,`pos` 为网格位置 `x1,y1-x2,y2`(1-based,与紧凑 layers 字符串同格式),支持 `font`、`orientation`、`align`(水平 `l`/`c`/`r`,可加垂直前缀 `t`/`b` 组成 `tl`/`tc`/`tr`/`bl`/`bc`/`br`,如 `align: tl` 表示左上对齐)。`back_layers` 用于背面图层。
|
||||||
|
|
||||||
|
### 🖨️ 打印版式组件 (md-print)
|
||||||
|
|
||||||
|
将 Markdown 文档排版为可打印的 A4 横版页面:每张 A4 放两个 A5 页面,每个 A5 页面再分成多列。
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
:md-print[./rules.md]
|
||||||
|
:md-print[./rules.md]{columns="2" margin="10" gap="5" font="9"}
|
||||||
|
```
|
||||||
|
|
||||||
|
**功能:**
|
||||||
|
- 自动分页:内容按块级元素流入 A5 页面,段落、列表和表格可在分页处拆分
|
||||||
|
- 每张 A4 横版放两个 A5 页面,每个 A5 页面默认两列
|
||||||
|
- 预览中可直接打印或另存为 PDF
|
||||||
|
- 支持页眉标题、页码和中缝裁切线
|
||||||
|
|
||||||
|
**属性:**
|
||||||
|
|
||||||
|
| 属性 | 类型 | 默认值 | 说明 |
|
||||||
|
|------|------|--------|------|
|
||||||
|
| `columns` | number | `2` | 每个 A5 页面的列数(1–4) |
|
||||||
|
| `margin` | number | `10` | 页面边距(毫米) |
|
||||||
|
| `gap` | number | `5` | 列间距(毫米) |
|
||||||
|
| `font` | number | `9` | 正文字号(磅) |
|
||||||
|
| `title` | string | - | 页眉标题 |
|
||||||
|
| `pageNumbers` | boolean | `true` | 是否显示页码 |
|
||||||
|
| `cutMarks` | boolean | `true` | 是否显示 A4 中缝裁切线 |
|
||||||
|
|
||||||
|
**YAML 写法:**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tag: md-print
|
||||||
|
body: ./rules.md
|
||||||
|
columns: 2
|
||||||
|
margin: 10
|
||||||
|
gap: 5
|
||||||
|
font: 9
|
||||||
|
title: 规则书
|
||||||
|
```
|
||||||
|
|
||||||
|
**打印设置:** 在浏览器打印对话框中选择 A4、横向、无边距、100% 缩放。
|
||||||
|
|
||||||
### 🧶 叙事线组件 (md-yarn-spinner)
|
### 🧶 叙事线组件 (md-yarn-spinner)
|
||||||
|
|
||||||
用于展示分支叙事结构,支持 Yarn Spinner 格式文件。
|
用于展示分支叙事结构,支持 Yarn Spinner 格式文件。
|
||||||
|
|||||||
Reference in New Issue
Block a user