@bytechain.cn/colamd-themes 0.3.2 → 0.5.1
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/.claude/skills/colamd-themes-preview.skill.md +333 -0
- package/.claude/skills/colamd-themes.skill.md +10 -0
- package/.dsh/skills/colamd-themes/SKILL.md +14 -0
- package/.github/supported-topics.yml +17 -0
- package/.hermes/skills/tools/colamd-themes/SKILL.md +14 -0
- package/.openclaw/skills/colamd-themes/SKILL.md +1 -37
- package/.opencode/skills/colamd-themes/SKILL.md +17 -0
- package/.trae/rules/colamd-themes.md +0 -36
- package/CHANGELOG.md +331 -241
- package/DSH_SUPPORT_SUMMARY.md +87 -0
- package/README.md +414 -384
- package/README_CN.md +412 -384
- package/RELEASENOTE.md +541 -389
- package/dist/cli.js +36 -55
- package/dist/cli.js.map +1 -1
- package/dist/color-utils.d.ts +1 -0
- package/dist/color-utils.js +25 -6
- package/dist/color-utils.js.map +1 -1
- package/dist/extractors/pdf-extractor.js +6 -1
- package/dist/extractors/pdf-extractor.js.map +1 -1
- package/dist/extractors/url-extractor.d.ts +0 -4
- package/dist/extractors/url-extractor.js +13 -126
- package/dist/extractors/url-extractor.js.map +1 -1
- package/dist/generator.d.ts +1 -1
- package/dist/generator.js +32 -11
- package/dist/generator.js.map +1 -1
- package/dist/models.d.ts +5 -4
- package/dist/models.js +2 -3
- package/dist/models.js.map +1 -1
- package/dist/renderer.d.ts +6 -3
- package/dist/renderer.js +54 -93
- package/dist/renderer.js.map +1 -1
- package/dist/templates/template.css +220 -498
- package/dist/templates/theme-paradigm.md +530 -658
- package/dist/templates/theme-template.hbs +256 -370
- package/dist/theme-store.js +19 -3
- package/dist/theme-store.js.map +1 -1
- package/dist/utils/document-paradigm.d.ts +12 -0
- package/dist/utils/document-paradigm.js +109 -0
- package/dist/utils/document-paradigm.js.map +1 -0
- package/dist/validators.d.ts +4 -1
- package/dist/validators.js +115 -1
- package/dist/validators.js.map +1 -1
- package/mcp-server/dist/index.d.ts +13 -0
- package/mcp-server/dist/index.d.ts.map +1 -0
- package/mcp-server/dist/index.js +0 -0
- package/mcp-server/dist/index.js.map +1 -0
- package/mcp-server/package-lock.json +1759 -0
- package/mcp-server/package.json +24 -0
- package/mcp-server/src/index.ts +0 -0
- package/mcp-server/tsconfig.json +19 -0
- package/package.json +54 -36
- package/skills/build-skills.sh +30 -5
- package/skills/colamd-themes/SKILL.md +180 -178
- package/src/cli.ts +474 -487
- package/src/color-systems.ts +289 -289
- package/src/color-utils.ts +137 -120
- package/src/contrast.ts +66 -66
- package/src/docx-style-paradigm.ts +811 -811
- package/src/export-cli.ts +356 -356
- package/src/extractors/base.ts +8 -8
- package/src/extractors/docx-extractor.ts +417 -417
- package/src/extractors/pdf-extractor.ts +533 -527
- package/src/extractors/url-extractor.ts +846 -981
- package/src/generator.ts +197 -169
- package/src/index.ts +29 -29
- package/src/models.ts +212 -212
- package/src/renderer.ts +310 -359
- package/src/templates/template.css +220 -498
- package/src/templates/theme-paradigm.md +530 -658
- package/src/templates/theme-template.hbs +256 -370
- package/src/theme-store.ts +185 -170
- package/src/types/pdf-parse.d.ts +12 -12
- package/src/utils/cli-utils.ts +84 -84
- package/src/utils/document-paradigm.ts +118 -0
- package/src/validators.ts +298 -176
- package/themes/academic-paper-pt.css +353 -1805
- package/themes/academic-paper.css +350 -1099
- package/themes/academic-style.css +342 -2430
- package/themes/colly.css +256 -370
- package/themes/elegant.css +288 -671
- package/themes/forest-ink.css +240 -664
- package/themes/guizang.css +250 -732
- package/themes/hermes-security.css +279 -0
- package/themes/meeting-minutes.css +256 -370
- package/themes/pixso-design.css +278 -1261
- package/themes/salvator-blog.css +256 -370
- package/themes/shimo-theme.css +256 -0
- package/themes/swiss-design.css +285 -746
- package/themes/template.css +220 -498
- package/themes/trae-blue.css +280 -737
- package/themes/word-contract.css +249 -0
- package/themes-preview/demo-content.md +187 -187
- package/tsconfig.json +18 -18
- package/src/mermaid-presets.ts +0 -142
- package/themes/swiss-design copy.css +0 -746
- package/themes-preview/colly-preview.html +0 -623
- package/themes-preview/meeting-minutes-preview.html +0 -625
- package/themes-preview/salvator-blog-preview.html +0 -623
package/CHANGELOG.md
CHANGED
|
@@ -1,241 +1,331 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [0.
|
|
9
|
-
|
|
10
|
-
###
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
###
|
|
29
|
-
- **
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
**
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
**
|
|
85
|
-
- **
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- **
|
|
99
|
-
|
|
100
|
-
**
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- **
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
- **
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
- **
|
|
169
|
-
- **
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
- **
|
|
173
|
-
- **
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
- **
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
- **
|
|
193
|
-
- **
|
|
194
|
-
- **
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
-
|
|
214
|
-
- **
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.5.1] - 2026-10-25
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **导出管线切换到 2.x 库渲染器**:上游 ColaMD-extend 2.7.8-rc.1(69515aa)恢复 `dist/lib/colamd-renderer.js` 库入口(P0),`renderer.ts` 全面改用 2.x——`:root` 契约 CSS 直接消费、标题经 `buildExportHTML({ title })` 传入
|
|
12
|
+
- **移除 1.5.x 兼容层(不向下兼容)**:删除 `bridgeLegacyBodyVars()` body 变量桥接、渲染器版本探测及分支逻辑;依赖由 `^1.5.2` 固定为 `^2.7.8-rc.1`(npm 发布 2.7.8-rc.1 前 `npm install`/`npm ci` 暂不可用,发布后重新解析)
|
|
13
|
+
- 契约版本标注统一为 **2.7.8-rc.1**(`validate` 输出、生成器自检、校验器消息与各文件注释)
|
|
14
|
+
|
|
15
|
+
### Verified
|
|
16
|
+
- 2.x 真实导出冒烟测试通过:`:root` 恰好 27 个契约活变量、零死变量/`--seed-*` 泄漏、mermaid Pele SVG(`var(--pele-*)` 离线可解析)、块公式完整 KaTeX 输出(P1 验收)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## [0.5.0] - 2026-10-25
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- **ColaMD 2.7.7 兼容性核对**:以 npm 发布的 `@bytechain.cn/colamd@2.7.7` 为基准,逐项验证主题 CSS 契约 —— `.cm-md-*` 类钩子零漂移(渲染器共 49 个钩子)、`:root` 活变量(14 核心 + 4 排版 + 9 `--pele-*`)全部被 2.7.7 消费
|
|
24
|
+
- **导出管线 2.x 包守卫**:`renderer.ts` 检测到安装的 `@bytechain.cn/colamd` 为 2.x(Electron 应用分发,不含 `colamd-renderer.js` 库入口)时给出明确的降级指引,替代原先笼统的 "Cannot find renderer" 报错
|
|
25
|
+
- **导出主题解析修复**:内置主题(如 `elegant`)现优先加载本仓库的 2.7.7 契约 CSS(`themes/<name>.css`)再传给渲染器,修复导出 HTML/PDF 实际使用 1.5.x 旧内置配色的问题;注入时将 `:root` 变量镜像到 `body` 作用域,绕过 1.5.x 基础 CSS 的元素级变量声明(主题文件保持 `:root` 契约不变,桥接逻辑仅存在于导出管线)
|
|
26
|
+
- 代码与文档中的契约版本引用统一为 **2.7.7**(`validate` 输出、生成器自检、校验器注释)
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- **10 个主题的设计质量优化**(paradigm 检查 0 错误):
|
|
30
|
+
- `colly` / `salvator-blog` / `meeting-minutes`:修正 panel 层级颠倒(`--seed-panel-alt` 加深至对比 2 级)
|
|
31
|
+
- `swiss-design`:边框与 panel-alt 明度差扩大至 3 级
|
|
32
|
+
- `shimo-theme`:面板改纯中性灰,accent 提饱和至 `#2a6bf2`(S 83%)
|
|
33
|
+
- `elegant`:砖红 accent 饱和度 55% → 70%(`#b0401f`),选区等硬编码色同步
|
|
34
|
+
- `guizang`:米黄面板改中性暖灰,消除中性灰偏离(NT-02)
|
|
35
|
+
- `pixso-design`:accent 饱和度 56% → 76%(`#4f46e5`),6 处渐变/边框 rgba 迁移
|
|
36
|
+
- `trae-blue`:accent 饱和度 70% → 85%(`#2563eb`),panel 换中性灰
|
|
37
|
+
- `forest-ink`:accent 饱和度提升(`#356b44`),文字灰阶改绿灰回归墨绿主轴
|
|
38
|
+
- 保留 4 条有意的警告:academic 系列低饱和学术点缀、meeting-minutes 黑色极简点缀
|
|
39
|
+
|
|
40
|
+
### Removed
|
|
41
|
+
- 移除遗留的 pre-2.7 旧结构主题(`body.theme-custom` 根块 + 58 个死变量,文件名为 mojibake 的"我的主题.css")—— 该主题在 2.7.7 下完全无效
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- `package-lock.json` 根 manifest 依赖误标为 `^2.0.0`,恢复与 `package.json` 一致的 `^1.5.2`(npm 2.7.7 为应用分发,CLI 导出必须使用 1.5.x 库渲染器)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## [Unreleased]
|
|
49
|
+
|
|
50
|
+
*No unreleased changes for this snapshot.*
|
|
51
|
+
|
|
52
|
+
## [0.4.0] - 2026-10-23
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
- **DeepSeek Harness Agent Support** — 新增 `.dsh/skills/colamd-themes/SKILL.md`,通过 `skills/build-skills.sh dsh` 生成
|
|
56
|
+
- Agent skill 覆盖扩展至 6 个(Claude Code、OpenCode、OpenClaw、Hermes、Trae、DeepSeek Harness),frontmatter 统一加入各 Agent 的命令前置条件与能力标签
|
|
57
|
+
- `validateThemeCss()` 契约校验器:检查 `:root` 根块、死选择器、死变量、`pt` 单位、引用/代码块纵向 padding
|
|
58
|
+
- `colamd-themes validate` 现在同时输出 CSS 契约检查结果
|
|
59
|
+
- 生成后自动跑一次契约自检
|
|
60
|
+
- `DSH_SUPPORT_SUMMARY.md` 与 `test-dsh-skill.sh` 用于发布验证
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
- **主题契约升级到 ColaMD Extend 2.7**:主题根块由 `body.theme-custom` 改为 `:root`;生成器模板升为 v4.0(`src/templates/theme-template.hbs`)
|
|
64
|
+
- **选择器层重写**:`#write` / `.ProseMirror` / 语义标签规则全部替换为 `#editor .cm-content .cm-md-*`(CodeMirror 6 钩子);引用块与代码块只设左右 padding
|
|
65
|
+
- **变量体系重写**:新增 `--text-secondary` / `--highlight-bg` / `--editor-font-size` / `--editor-column-width` / `--pele-*`;删除 `--surface-color`、`--heading-color`、`--accent-*`、`--hr-color`、`--code-color`、`--code-block-color`、`--table-border`、`--scrollbar-thumb*`、`--mermaid-*`、`--radius-*`、`--content-width`、`--font-size-root`、`--font-scale-*`、`--line-height-*`、`--font-heading`、`--font-code` 等死变量
|
|
66
|
+
- **图表配色**:Mermaid 20 变量预设改为 Pele 9 变量,缺省值由 `--code-block-bg` / `--code-block-text` / `--link-color` 经 `color-mix()` 推导;CLI 移除 `mermaid-presets` 命令与 `--mermaid-preset` 选项
|
|
67
|
+
- **代码块文字色**:由代码块底色对比度自动派生(深色底拿浅字、浅色底拿正文色),不再硬编码
|
|
68
|
+
- **打印规范**:删除整份 `@media print` 镜像与变量重声明,只保留 `print-color-adjust` 保真
|
|
69
|
+
- `themes/template.css` 与 `src/templates/theme-paradigm.md` 同步至 v4.0
|
|
70
|
+
- 版本号统一为 **0.4.0**,README 多 Agent 章节补充 DeepSeek Harness 生成路径与 frontmatter 说明
|
|
71
|
+
- 构建脚本对齐新的数据通道契约
|
|
72
|
+
|
|
73
|
+
### Removed
|
|
74
|
+
- `src/mermaid-presets.ts`(Mermaid 预设链路)
|
|
75
|
+
- `ThemeStyle.mermaidPresetId`
|
|
76
|
+
- 误跟踪的 `.DS_Store` 文件
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## [0.3.3] - 2026-08-26
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
- **MCP Server**: Full MCP (Model Context Protocol) server in `mcp-server/` directory with 14 tools covering theme extraction, HTML/PDF export, validation, color systems, and theme management. Compatible with Chatbox, Cursor, Claude Desktop, Continue, and all MCP-capable clients.
|
|
84
|
+
- **Chinese Theme Name Support**: Fixed non-ASCII (Chinese/CJK) theme names being stripped during extraction. MCP server auto-detects non-ASCII names and constructs full output paths via `-o` flag.
|
|
85
|
+
- **Multi-Agent Skill Definitions**: Added AI agent skill files for 5 coding assistants — Claude Code, OpenCode, OpenClaw, Hermes, Trae — auto-generated from `skills/colamd-themes/SKILL.md`.
|
|
86
|
+
- New MCP binary entry: `colamd-themes-mcp`
|
|
87
|
+
- New scripts: `build:mcp`, `build:all`, `mcp`
|
|
88
|
+
|
|
89
|
+
### Changed
|
|
90
|
+
- Package version bumped from 0.3.2 to 0.3.3
|
|
91
|
+
- MCP server versioned independently at 0.2.0
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## [0.3.2] - 2026-05-29
|
|
96
|
+
|
|
97
|
+
### Added
|
|
98
|
+
- **CSS Pitfall Quick Reference**: Comprehensive 6-topic guide for theme authoring in AI agent skills, covering screen/print sync, body text indent, indent exclusion, list indentation, Mermaid CJK text overflow, and Mermaid classDef inheritance rules
|
|
99
|
+
- New theme: **Trae Blue** — modern blue-themed design for technical documentation
|
|
100
|
+
- New theme: **Forest Ink** — nature-inspired dark green palette with ink aesthetics
|
|
101
|
+
- Support for absolute path input in CLI commands
|
|
102
|
+
- Two new theme preview HTML files (colly-preview, salvator-blog-preview)
|
|
103
|
+
- Short CLI alias `cthemes` as alternative to `colamd-themes`
|
|
104
|
+
- Unified error handling system with structured error codes (`CLIError` + `ErrorCode`)
|
|
105
|
+
- Shared utility functions for consistent file path resolution (`cli-utils.ts`)
|
|
106
|
+
- Template cache management with LRU eviction, TTL expiration, and mtime-based invalidation
|
|
107
|
+
|
|
108
|
+
### Changed
|
|
109
|
+
- Package name migrated to scoped format: `@bytechain.cn/colamd-themes`
|
|
110
|
+
- Optimized **Swiss Design** theme with improved typography and spacing
|
|
111
|
+
- Fixed build script template file copy logic (`package.json` build command)
|
|
112
|
+
- Migrated all synchronous file I/O operations in `theme-store.ts` to async API (`fs/promises`)
|
|
113
|
+
- Standardized error handling across all export commands with unified error codes
|
|
114
|
+
|
|
115
|
+
### Security
|
|
116
|
+
- **SSRF Protection**: URL extractor now validates URLs against protocol whitelist (http/https only) and blocks private network ranges (localhost, 10.x, 172.16-31.x, 192.168.x, 169.254.x) to prevent server-side request forgery attacks
|
|
117
|
+
- **Input Validation**: CSS files are now validated for extension, size limit (1MB max), and content validity before processing to prevent OOM attacks
|
|
118
|
+
|
|
119
|
+
### Performance
|
|
120
|
+
- **Async I/O**: Theme store operations now use non-blocking async file I/O, preventing event loop blocking during configuration read/write operations
|
|
121
|
+
- **Template Caching**: Handlebars template compilation now uses a managed cache system:
|
|
122
|
+
- Maximum 10 cached templates (LRU-style eviction)
|
|
123
|
+
- 30-minute TTL for automatic expiration
|
|
124
|
+
- File modification time (mtime) detection for auto-invalidation when templates change on disk
|
|
125
|
+
|
|
126
|
+
### Bug Fixes
|
|
127
|
+
- **Puppeteer Page Resource Leak**: Fixed zombie process issue where Puppeteer Page objects were not properly closed during browser shutdown. The renderer now explicitly closes page instances before browser termination.
|
|
128
|
+
- **PDF Export Styling**: Resolved issue where custom themes were not applied to PDF output by removing `emulateMediaType("screen")` that prevented `@media print` rules from executing
|
|
129
|
+
- **Hardcoded Version Number**: CLI version command now dynamically reads from package.json instead of using hardcoded value, ensuring correct version display after package updates
|
|
130
|
+
- **Code Duplication**: Extracted common file path resolution logic into shared utility functions (`resolveInputPath`, `resolveOutputPath`, `getDocumentTitle`) used across all export commands
|
|
131
|
+
|
|
132
|
+
### Removed
|
|
133
|
+
- `.DS_Store` files from project directory
|
|
134
|
+
- Local HTTP server security code (token validation, request timeouts) per user request — reverted to simpler implementation
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## [0.3.1] - 2026-06-01
|
|
139
|
+
|
|
140
|
+
### 🔒 Security Fixes (Critical)
|
|
141
|
+
|
|
142
|
+
**URL Extractor SSRF Vulnerability**
|
|
143
|
+
- Added comprehensive URL validation to prevent Server-Side Request Forgery attacks
|
|
144
|
+
- Protocol whitelist enforcement (only `http:` and `https:` allowed)
|
|
145
|
+
- Private network address blocking (localhost, 10.x, 172.16-31.x, 192.168.x, 169.254.x)
|
|
146
|
+
- Clear error messages for blocked access attempts
|
|
147
|
+
- File: [`url-extractor.ts`](src/extractors/url-extractor.ts)
|
|
148
|
+
|
|
149
|
+
**Input Validation Enhancement**
|
|
150
|
+
- CSS file extension validation (must be `.css`)
|
|
151
|
+
- Maximum file size limit enforced (1MB) to prevent memory exhaustion attacks
|
|
152
|
+
- Content validity check (minimum 10 characters)
|
|
153
|
+
- Sanitized theme name extraction from file paths (removes special characters, limits length)
|
|
154
|
+
- Files: [`theme-store.ts`](src/theme-store.ts), [`generator.ts`](src/generator.ts)
|
|
155
|
+
|
|
156
|
+
### 🐛 Bug Fixes (Major & Medium)
|
|
157
|
+
|
|
158
|
+
**Puppeteer Page Resource Leak (#1)**
|
|
159
|
+
- **Severity**: Critical
|
|
160
|
+
- **Issue**: Browser instances could leave zombie processes if page objects weren't closed before browser termination
|
|
161
|
+
- **Fix**: Explicitly close page instances in [`renderer.ts`](src/renderer.ts#L150-L155) close() method before shutting down the browser
|
|
162
|
+
- **Impact**: Prevents resource leaks and ensures clean process cleanup
|
|
163
|
+
|
|
164
|
+
**PDF Export Styling Not Applied (#4)**
|
|
165
|
+
- **Severity**: Major
|
|
166
|
+
- **Issue**: Custom themes were not rendering correctly in PDF output
|
|
167
|
+
- **Root Cause**: `emulateMediaType("screen")` forced browser into screen mode, causing CSS `@media print { ... }` rules to be ignored
|
|
168
|
+
- **Fix**: Removed screen media type emulation in [`renderer.ts`](src/renderer.ts) to allow default print mode
|
|
169
|
+
- **Impact**: All PDF exports now render with full theme styling fidelity (colors, fonts, backgrounds, spacing)
|
|
170
|
+
|
|
171
|
+
**Hardcoded Version Number (#5)**
|
|
172
|
+
- **Severity**: Medium
|
|
173
|
+
- **Issue**: CLI `--version` flag displayed hardcoded "0.2.0" regardless of actual package version
|
|
174
|
+
- **Fix**: Implemented dynamic version reading from [`cli.ts`](src/cli.ts) using `getPackageVersion()` function that reads `package.json` at runtime
|
|
175
|
+
- **Impact**: Version display always matches published package version
|
|
176
|
+
|
|
177
|
+
### ⚡ Performance Improvements
|
|
178
|
+
|
|
179
|
+
**Synchronous I/O Blocking (#4)**
|
|
180
|
+
- **Before**: All theme store operations used blocking `readFileSync()`, `writeFileSync()`, `existsSync()` calls
|
|
181
|
+
- **After**: Migrated to async API in [`theme-store.ts`](src/theme-store.ts):
|
|
182
|
+
- `readFile()`, `writeFile()`, `access()` from `node:fs/promises`
|
|
183
|
+
- All public functions now return Promises
|
|
184
|
+
- Non-blocking event loop during configuration operations
|
|
185
|
+
- **Impact**: Improved responsiveness, especially during batch export operations
|
|
186
|
+
|
|
187
|
+
**Template Cache Management (#7)**
|
|
188
|
+
- **Before**: Single global template variable with no size limits or invalidation
|
|
189
|
+
- **After**: Sophisticated cache system in [`generator.ts`](src/generator.ts):
|
|
190
|
+
- **LRU Eviction**: Max 10 compiled templates (evicts oldest when full)
|
|
191
|
+
- **TTL Expiration**: 30-minute automatic expiry of cached entries
|
|
192
|
+
- **mtime Detection**: Auto-invalidates when source template file is modified
|
|
193
|
+
- **Manual Clear**: `clearTemplateCache()` function for testing/memory management
|
|
194
|
+
- **Impact**: Prevents unbounded memory growth in long-running processes; ensures fresh templates after updates
|
|
195
|
+
|
|
196
|
+
### 🛠️ Code Quality Improvements
|
|
197
|
+
|
|
198
|
+
**Unified Error Handling System (#5)**
|
|
199
|
+
- Created [`cli-utils.ts`](src/utils/cli-utils.ts) utility module with:
|
|
200
|
+
- `CLIError` class: Structured error with code, message, and cause chain
|
|
201
|
+
- `ErrorCode` enum: Standardized error categories (FILE_NOT_FOUND, THEME_ERROR, RENDER_ERROR, INVALID_INPUT, UNKNOWN)
|
|
202
|
+
- Consistent error propagation across all export commands
|
|
203
|
+
- Updated [`export-cli.ts`](src/export-cli.ts) to use unified error handling:
|
|
204
|
+
- Try-catch blocks wrap all command actions
|
|
205
|
+
- Process exits with appropriate error codes
|
|
206
|
+
- Error messages include context and suggestions
|
|
207
|
+
- **Impact**: Better debugging experience; consistent user-facing errors; easier error tracking
|
|
208
|
+
|
|
209
|
+
**Code Deduplication (#6)**
|
|
210
|
+
- Extracted common patterns into reusable utilities:
|
|
211
|
+
- `resolveInputPath(input)`: Validates file existence, converts relative→absolute paths
|
|
212
|
+
- `resolveOutputPath(input, output?, ext?)`: Derives output path with smart defaults
|
|
213
|
+
- `getDocumentTitle(filePath)`: Extracts filename without extension for document title
|
|
214
|
+
- **Impact**: Reduced code duplication; single source of truth for path logic; easier maintenance
|
|
215
|
+
|
|
216
|
+
### 📝 Technical Details
|
|
217
|
+
|
|
218
|
+
**Security Architecture**
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
User Input → Validation Layer → Processing Layer
|
|
222
|
+
│ │
|
|
223
|
+
├── Protocol Check ├── Async Operations
|
|
224
|
+
├── Network Check ├── Cache Management
|
|
225
|
+
├── Size Limits └── Resource Cleanup
|
|
226
|
+
└── Format Validation
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Performance Metrics**
|
|
230
|
+
|
|
231
|
+
| Operation | Before | After | Improvement |
|
|
232
|
+
|-----------|--------|-------|-------------|
|
|
233
|
+
| Theme config read | Blocking sync | Non-blocking async | Event loop freed |
|
|
234
|
+
| Batch export (100 files) | Sequential blocking | Concurrent-ready | ~40% faster* |
|
|
235
|
+
| Template compilation | Uncached/recompile | Cached (max 10) | ~90% fewer compiles |
|
|
236
|
+
| Memory usage (long run) | Unbounded growth | Limited (10 templates) | Stable |
|
|
237
|
+
|
|
238
|
+
*\*Estimated improvement based on reduced I/O blocking*
|
|
239
|
+
|
|
240
|
+
**Error Code Reference**
|
|
241
|
+
|
|
242
|
+
| Code | Name | When Used |
|
|
243
|
+
|------|------|-----------|
|
|
244
|
+
| 1 | FILE_NOT_FOUND | Input file does not exist |
|
|
245
|
+
| 2 | THEME_ERROR | Theme resolution or registration fails |
|
|
246
|
+
| 3 | RENDER_ERROR | HTML/PDF rendering pipeline failure |
|
|
247
|
+
| 4 | INVALID_INPUT | Invalid arguments or options |
|
|
248
|
+
| 99 | UNKNOWN | Unexpected/unclassified error |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## [0.3.0] - 2026-06-01
|
|
253
|
+
|
|
254
|
+
### Added
|
|
255
|
+
- **Trae Blue Theme**: Modern blue color scheme optimized for developer documentation and technical writing
|
|
256
|
+
- **Forest Ink Theme**: Dark forest-inspired theme with elegant ink-style aesthetics
|
|
257
|
+
- **Absolute Path Support**: CLI now accepts absolute file paths for all input commands
|
|
258
|
+
- **Theme Previews**: Added interactive HTML previews for colly and salvator-blog themes
|
|
259
|
+
- **CSS Reference**: Included common CSS pitfalls and best practices documentation
|
|
260
|
+
- **Short CLI Alias**: `cthemes` command added as shorthand for `colamd-themes`
|
|
261
|
+
|
|
262
|
+
### Changed
|
|
263
|
+
- **Package Name**: Migrated from `colamd-themes` to `@bytechain.cn/colamd-themes` (scoped package)
|
|
264
|
+
- **Swiss Design Enhancement**: Refined Swiss Design theme with better contrast ratios and improved readability
|
|
265
|
+
- **Build Process Fix**: Corrected template file copying logic in build script to ensure proper distribution
|
|
266
|
+
|
|
267
|
+
### Removed
|
|
268
|
+
- System files (`.DS_Store`) cleaned from repository
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## [0.2.0] - 2026-05-25
|
|
273
|
+
|
|
274
|
+
### Added
|
|
275
|
+
- **v3.0 Seed Palette Paradigm**: Complete implementation of ColaMD's new design token system
|
|
276
|
+
- 15 predefined seed palettes across 5 families (Morandi, Macaron, Nordic, Vintage, Mint)
|
|
277
|
+
- Auto-derived semantic mapping from seed tokens via CSS custom properties
|
|
278
|
+
- Mermaid diagram presets (light/dark/elegant) with 20 core variables
|
|
279
|
+
- **Academic Style Theme**: Specialized theme for academic paper formatting
|
|
280
|
+
- **Three Base Themes**: Initial set of core themes (elegant, newsprint, light/dark)
|
|
281
|
+
- **Theme Validation Engine**: WCAG 2.1 compliance checking with 15+ design constraint rules
|
|
282
|
+
- **Color System Library**: Comprehensive color palette management utilities
|
|
283
|
+
|
|
284
|
+
### Changed
|
|
285
|
+
- **Extractor Refactoring**: Complete rewrite of URL, DOCX, and PDF extractors
|
|
286
|
+
- Improved CSS rule parsing via `css-tree`
|
|
287
|
+
- Enhanced specificity calculation for inline style resolution
|
|
288
|
+
- Multi-layer heuristic analysis for PDF metadata extraction
|
|
289
|
+
- **Academic Paper Theme**: Restructured to follow v3.0 paradigm specifications
|
|
290
|
+
- **Template Engine**: Handlebars-powered CSS generation with 6-section output structure
|
|
291
|
+
|
|
292
|
+
### Fixed
|
|
293
|
+
- Merge conflict resolution for `academic-paper.css` (adopted remote version)
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## [0.1.0] - 2026-05-22
|
|
298
|
+
|
|
299
|
+
### Added
|
|
300
|
+
- **Initial Release**: Core ColaMD theme development toolkit
|
|
301
|
+
- **CLI Interface**: Command-line tool for theme management and export operations
|
|
302
|
+
- **Theme Extraction**:
|
|
303
|
+
- URL-based extractor with CSS parsing
|
|
304
|
+
- DOCX extractor using mammoth for Word document styles
|
|
305
|
+
- PDF extractor with typography metadata analysis
|
|
306
|
+
- Auto-detection of source type
|
|
307
|
+
- **Export Functionality**:
|
|
308
|
+
- Markdown to HTML export with embedded theme CSS
|
|
309
|
+
- Markdown to PDF export via Puppeteer rendering
|
|
310
|
+
- Batch export support for multiple files/directories
|
|
311
|
+
- **Theme Management**:
|
|
312
|
+
- Built-in theme registration system
|
|
313
|
+
- Custom theme import from CSS files
|
|
314
|
+
- Default theme configuration
|
|
315
|
+
- **Core Utilities**:
|
|
316
|
+
- Color system with contrast ratio calculations
|
|
317
|
+
- Typography management
|
|
318
|
+
- Mermaid diagram integration
|
|
319
|
+
- KaTeX math rendering support
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
[Unreleased]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.5.1...HEAD
|
|
324
|
+
[0.5.1]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.5.0...v0.5.1
|
|
325
|
+
[0.5.0]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.4.0...v0.5.0
|
|
326
|
+
[0.4.0]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.3.2...v0.4.0
|
|
327
|
+
[0.3.2]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.3.1...v0.3.2
|
|
328
|
+
[0.3.1]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.3.0...v0.3.1
|
|
329
|
+
[0.3.0]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.2.0...v0.3.0
|
|
330
|
+
[0.2.0]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.1.0...v0.2.0
|
|
331
|
+
[0.1.0]: https://github.com/byteuser1977/ColaMD-themes/releases/tag/v0.1.0
|