@bytechain.cn/colamd-themes 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -1
- package/dist/cli.js +44 -4
- package/dist/cli.js.map +1 -1
- package/dist/export-cli.js +16 -0
- package/dist/export-cli.js.map +1 -1
- package/dist/extractors/local-html.d.ts +43 -0
- package/dist/extractors/local-html.js +338 -0
- package/dist/extractors/local-html.js.map +1 -0
- package/dist/extractors/url-extractor.d.ts +11 -2
- package/dist/extractors/url-extractor.js +11 -0
- package/dist/extractors/url-extractor.js.map +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.js.map +1 -1
- package/dist/models.d.ts +22 -0
- package/dist/models.js.map +1 -1
- package/dist/pdf-check.d.ts +42 -0
- package/dist/pdf-check.js +206 -0
- package/dist/pdf-check.js.map +1 -0
- package/dist/slides-markdown.d.ts +10 -0
- package/dist/slides-markdown.js +38 -0
- package/dist/slides-markdown.js.map +1 -1
- package/dist/slides.d.ts +8 -0
- package/dist/slides.js +76 -0
- package/dist/slides.js.map +1 -1
- package/dist/validators.js +8 -1
- package/dist/validators.js.map +1 -1
- package/package.json +1 -1
- package/skills/build-skills.sh +13 -13
- package/skills/colamd-themes/SKILL.md +52 -8
- package/themes/broadside.css +1187 -837
package/skills/build-skills.sh
CHANGED
|
@@ -35,9 +35,9 @@ name: colamd-themes
|
|
|
35
35
|
description: >
|
|
36
36
|
Generate, validate, export, and manage ColaMD 2.7 contract CSS themes
|
|
37
37
|
(2.7.13 anchor, slide layouts stable). Extract formatting from URLs,
|
|
38
|
-
DOCX, or PDF sources
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
DOCX, or PDF sources. One-shot `ppt` command turns Markdown into a
|
|
39
|
+
slide-deck Markdown plus a validated 16:9 slide PDF; also export
|
|
40
|
+
Markdown to standalone HTML/PDF, batch export, manage themes.
|
|
41
41
|
---'
|
|
42
42
|
|
|
43
43
|
FRONT_OPENCODE='---
|
|
@@ -45,9 +45,9 @@ name: colamd-themes
|
|
|
45
45
|
version: "1.0.0"
|
|
46
46
|
description: >
|
|
47
47
|
Generate, validate, export, and manage ColaMD 2.7 contract CSS themes
|
|
48
|
-
(2.7.13 anchor, slide layouts stable). Extract from URLs/DOCX/PDF
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
(2.7.13 anchor, slide layouts stable). Extract from URLs/DOCX/PDF;
|
|
49
|
+
one-shot ppt command: Markdown → slide deck → validated 16:9 PDF;
|
|
50
|
+
document HTML/PDF export; batch export.
|
|
51
51
|
user-invocable: true
|
|
52
52
|
allowed-tools:
|
|
53
53
|
- Read
|
|
@@ -63,9 +63,9 @@ id: colamd-themes
|
|
|
63
63
|
name: ColaMD Themes
|
|
64
64
|
description: >
|
|
65
65
|
Generate, validate, export, and manage ColaMD 2.7 contract CSS themes
|
|
66
|
-
(2.7.13 anchor, slide layouts stable). Extract from URLs/DOCX/PDF
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
(2.7.13 anchor, slide layouts stable). Extract from URLs/DOCX/PDF;
|
|
67
|
+
one-shot ppt command: Markdown → slide deck → validated 16:9 PDF;
|
|
68
|
+
document HTML/PDF export; batch export.
|
|
69
69
|
version: "1.0.0"
|
|
70
70
|
icon: "\U0001F3A8"
|
|
71
71
|
author: bytechain
|
|
@@ -82,7 +82,7 @@ metadata:
|
|
|
82
82
|
|
|
83
83
|
FRONT_HERMES='---
|
|
84
84
|
name: colamd-themes
|
|
85
|
-
description: "Generate, validate, export, and manage ColaMD 2.7 contract CSS themes with PPT slide layouts;
|
|
85
|
+
description: "Generate, validate, export, and manage ColaMD 2.7 contract CSS themes with PPT slide layouts; one-shot Markdown → slide deck → 16:9 PDF; HTML/PDF export."
|
|
86
86
|
version: 1.0.0
|
|
87
87
|
author: bytechain
|
|
88
88
|
license: MIT
|
|
@@ -98,9 +98,9 @@ name: colamd-themes
|
|
|
98
98
|
version: "1.0.0"
|
|
99
99
|
description: >
|
|
100
100
|
Generate, validate, export, and manage ColaMD 2.7 contract CSS themes
|
|
101
|
-
(2.7.13 anchor, slide layouts stable). Extract from URLs/DOCX/PDF
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
(2.7.13 anchor, slide layouts stable). Extract from URLs/DOCX/PDF;
|
|
102
|
+
one-shot ppt command: Markdown → slide deck → validated 16:9 PDF;
|
|
103
|
+
document HTML/PDF export; batch export.
|
|
104
104
|
metadata:
|
|
105
105
|
dsh:
|
|
106
106
|
tags: [colamd, themes, css, markdown, export, pdf, html]
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
# ColaMD Themes — Universal AI Agent Skill
|
|
2
2
|
|
|
3
|
-
Generate, validate, export, and manage ColaMD **2.7 contract** CSS themes (2.7.13 anchor, slide layouts stable). Extract formatting from URLs, DOCX, or PDF sources (optionally with PPT `--slide-*` styling); convert Markdown into slide-deck Markdown; export Markdown to standalone HTML/PDF with themes applied; batch export; manage theme configuration.
|
|
3
|
+
Generate, validate, export, and manage ColaMD **2.7 contract** CSS themes (2.7.13 anchor, slide layouts stable). Extract formatting from URLs, DOCX, or PDF sources (optionally with PPT `--slide-*` styling); convert Markdown into slide-deck Markdown; export Markdown to standalone HTML/PDF **or a 16:9 slide PDF** with themes applied; batch export; manage theme configuration.
|
|
4
|
+
|
|
5
|
+
## Quick tasks — one command, no back-and-forth
|
|
6
|
+
|
|
7
|
+
| 任务 | 命令 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| markdown → 16:9 幻灯片 PDF(含生成、校验、导出、PDF 检查) | `colamd-themes ppt report.md` |
|
|
10
|
+
| 只要幻灯片 markdown(不要 PDF) | `colamd-themes ppt report.md --md-only` |
|
|
11
|
+
| 已有 deck markdown → 16:9 PDF | `colamd-themes export-slides deck.md` |
|
|
12
|
+
| markdown → 文档式 HTML / PDF | `colamd-themes export-html doc.md` / `export-pdf doc.md` |
|
|
13
|
+
| 从 URL / DOCX / PDF / HTML 提取主题 | `colamd-themes extract <source> -n my-theme` |
|
|
14
|
+
| 校验主题 CSS 或 deck markdown | `colamd-themes validate <file>` |
|
|
15
|
+
|
|
16
|
+
### Invocation rules (important for agents)
|
|
17
|
+
|
|
18
|
+
1. **One command per task.** `ppt` already chains to-slides → directive/content contract → 16:9 PDF → PDF-01~05. Do not call `to-slides` + `export-slides` + `check-pdf` yourself unless the user explicitly wants the intermediate deck.
|
|
19
|
+
2. **Do not re-validate.** Every producing command validates internally and only reports failures; a second `validate` call costs tokens and time without adding information.
|
|
20
|
+
3. **Do not read the artifacts back.** Use `--json` and read the one-line result (`ok`, paths, pages, `issues`). Only open the PDF/markdown when the user asks to inspect the content.
|
|
21
|
+
4. **Default output is one line.** `--json` → exactly one line of JSON; `--verbose` → detail lines; failures print only the failing items (`[RULE] message`).
|
|
22
|
+
5. **Stop on failure.** If exit code is 1, report the failing rules plus the one-line fix hint — do not loop, retry, or re-run the same command with the same input.
|
|
23
|
+
6. **Themes are optional.** Omit `-t` to use the configured default theme; pass a built-in name, a registered custom name, or a `.css` path.
|
|
24
|
+
|
|
25
|
+
Exit codes: `0` success · `1` contract/validation failure or input file not found · `2` theme resolution · `3` render failure · `4` invalid input · `99` unexpected.
|
|
4
26
|
|
|
5
27
|
## Prerequisites
|
|
6
28
|
|
|
@@ -34,9 +56,19 @@ and contrast rules (CR-02). `extract` auto-detects local `.html/.htm` too.
|
|
|
34
56
|
```bash
|
|
35
57
|
colamd-themes export-html <input.md> -t <theme> -o <output.html>
|
|
36
58
|
colamd-themes export-pdf <input.md> -t <theme> -o <output.pdf>
|
|
59
|
+
colamd-themes export-slides <deck.md> -t <theme> -o <output.pdf>
|
|
37
60
|
colamd-themes export <inputs...> --format html|pdf -t <theme> -d <dir>
|
|
38
61
|
```
|
|
39
62
|
|
|
63
|
+
> **`export-slides` vs `export-pdf`**: `export-slides` prints the live editor laid out as
|
|
64
|
+
> 16:9 sheets (deck chrome, hero centering, page breaks) and requires a deck markdown
|
|
65
|
+
> (with `<!-- deck ... -->` or `<!-- slide: ... -->`). `export-pdf` renders the semantic
|
|
66
|
+
> document DOM and produces A4/Letter/A3.
|
|
67
|
+
>
|
|
68
|
+
> Both check the produced PDF automatically. A deck export that would spill a page onto
|
|
69
|
+
> a second sheet is rewritten at a slightly smaller sheet type size so every declared page
|
|
70
|
+
> stays on exactly one sheet; `PDF-03` (pages = deck pages) must pass.
|
|
71
|
+
|
|
40
72
|
> **Token-saving by default**: exports are optimized automatically. When the source
|
|
41
73
|
> markdown contains no math (`$$`, `$...$`, `\(..\)`, `\begin{..}`), the inlined
|
|
42
74
|
> base64 KaTeX fonts are stripped from the HTML artifact, shrinking a typical
|
|
@@ -193,24 +225,34 @@ chapter: Act I · 数据
|
|
|
193
225
|
| `section` | 一个短标题 + 一句说明,大留白 |
|
|
194
226
|
| `agenda` | 有序列表 3-6 项 `**章名** 说明` |
|
|
195
227
|
| `kpi` | 无序列表 2-6 项 `**数字+单位** 说明` |
|
|
196
|
-
| `timeline` | 列表项带年份/日期 `**2019 年**
|
|
228
|
+
| `timeline` | 列表项带年份/日期 `**2019 年** 事件`,3-6 项 |
|
|
197
229
|
| `steps` | 有序列表 3-5 项 `**步骤名** 说明` |
|
|
198
230
|
| `matrix` | 无序列表 3-8 项 `**名称** 说明` |
|
|
199
231
|
| `two-col` | 两个 h2 对半(左论点/右证据) |
|
|
200
232
|
| `figure` | 图片 / Mermaid / 表格为主体的页 |
|
|
201
233
|
| `quote` | 引用块为主体的页,引用后一行可作署名 |
|
|
202
|
-
| `closing` |
|
|
234
|
+
| `closing` | 末页行动清单,2-8 项 |
|
|
203
235
|
|
|
204
236
|
未声明版式的页自动走默认文章版式;未知版式名无害降级。
|
|
205
237
|
|
|
206
|
-
### Markdown → PPT Markdown
|
|
238
|
+
### Markdown → PPT Markdown → 16:9 PDF
|
|
207
239
|
|
|
208
240
|
```bash
|
|
209
|
-
|
|
210
|
-
colamd-themes
|
|
241
|
+
# 一键:生成 deck + 校验 + 导出 16:9 PDF + PDF 内容检查
|
|
242
|
+
colamd-themes ppt report.md
|
|
243
|
+
colamd-themes ppt report.md -t elegant -d out/ --deck-brand "品牌" --deck-title "年度报告" --deck-meta "2026.11"
|
|
244
|
+
|
|
245
|
+
# 分步(需要中间产物时)
|
|
246
|
+
colamd-themes to-slides report.md -o report.slides.md
|
|
247
|
+
colamd-themes export-slides report.slides.md -t elegant
|
|
248
|
+
colamd-themes check-pdf report.slides.pdf -d report.slides.md
|
|
211
249
|
```
|
|
212
250
|
|
|
213
|
-
按内容结构自动分页并推断上述 11 种版式,生成 deck 块与页头块(kicker/chapter
|
|
251
|
+
按内容结构自动分页并推断上述 11 种版式,生成 deck 块与页头块(kicker/chapter 随章节推进)。
|
|
252
|
+
|
|
253
|
+
**内容适配(默认开启,`--no-adapt` 关闭)**:生成时按版式契约补齐 `**行标题**`、kpi 无数字 / timeline 无日期时降级为 matrix、列表超量拆续页(`label: 标题(续)`)、超长段落按句末拆页。项数沿用上游约定(agenda 3-6、kpi 2-6、timeline 3-6、steps 3-5、matrix 3-8、closing 2-8),超出才拆页。
|
|
254
|
+
|
|
255
|
+
导出时如果任一页在平台默认 24px 版式字号下超过单页高度,会自动按比例微调纸面字号(不低于 0.6),保证 `PDF-03`(页数 = deck 页数)通过。
|
|
214
256
|
|
|
215
257
|
### Slide rule validation
|
|
216
258
|
|
|
@@ -223,6 +265,8 @@ colamd-themes validate deck.md
|
|
|
223
265
|
- **SLIDES-03** (SHOULD):未知版式名(无害降级)
|
|
224
266
|
- **SLIDES-04/05** (MUST_NOT):页头块字段键 ∉ kicker/label/chapter、deck 键 ∉ logo/brand/title/meta
|
|
225
267
|
- **SLIDES-06** (MUST_NOT):slide-css 含 `position: absolute/fixed`、`z-index`、伪协议 URL
|
|
268
|
+
- **SLIDES-07** (SHOULD):版式内容不匹配——项数超出契约、缺少 `**行标题**`、kpi 无数字、timeline 无日期、figure/quote/two-col 缺少对应主体
|
|
269
|
+
- **SLIDES-08** (SHOULD):估算单页内容超容量,导出时可能把一页挤出两张纸
|
|
226
270
|
|
|
227
271
|
### Export PDF content checks (PDF-01…05, v0.6.2)
|
|
228
272
|
|
|
@@ -261,7 +305,7 @@ colamd-themes from-url <URL> -n my-brand --ppt sans # presets: serif | sans |
|
|
|
261
305
|
- **v0.6.1 全量版式令牌**:`from-html` 模板来源提供设计提示(`--sz-*` 字号阶梯 + template.json 的 mood/density/formality/scheme)时,生成 **24 个按页类型定制的令牌**——封面/章节/收页字号阶梯取自模板 display/body 比例,页标题 / KPI / 引言 / kicker / chrome / 页边距按气质(bold/quiet/tech)与密度调校;`--ppt` 不带值时信任按 display 字体自动判定的预设。无设计提示的主题保持仅品牌层输出(向后兼容)。
|
|
262
306
|
- 自定义主题 CSS 在 slides.css 之后加载,`:root` 同权重后到先赢;不要写 `body.theme-custom`(文档契约死选择器)。
|
|
263
307
|
- 手写主题里的幻灯片规则须遵守:**SLIDE-01** (SHOULD) 只用已知令牌;**SLIDE-02** (MUST_NOT) `.cm-md-page-*` / `.cm-md-slide-*` / `.slide-chrome|foot|ghost` 必须包裹在 `body.presenting` 或 `body.slides-printing` 作用域下(裸写污染编辑视图);**SLIDE-03** (SHOULD) 标题字体栈含中文字族并以 generic family 结尾。
|
|
264
|
-
- 平台需 ≥ 2.7.13 才消费这些令牌(compat
|
|
308
|
+
- 平台需 ≥ 2.7.13 才消费这些令牌(compat 行「幻灯片版式」);旧平台下令牌惰性。文档式 `export-html` / `export-pdf` 仍是文章排版;需要真正的 16:9 幻灯片 PDF 用 `export-slides` / `ppt`(compat 行「PPT 导出」,要求 lib 暴露 `enterSlidesPrintLayout` / `exitSlidesPrintLayout`,旧平台会给出可操作的升级命令)。
|
|
265
309
|
|
|
266
310
|
## 2.7 Contract Constraints
|
|
267
311
|
|