@bytechain.cn/colamd-themes 0.5.1 → 0.5.3
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 +30 -12
- package/cordis.patch.yml +9 -0
- package/dist/cli.js +18 -4
- package/dist/cli.js.map +1 -1
- package/dist/compat.d.ts +54 -0
- package/dist/compat.js +126 -0
- package/dist/compat.js.map +1 -0
- package/dist/dsh-plugin.d.ts +44 -0
- package/dist/dsh-plugin.js +82 -0
- package/dist/dsh-plugin.js.map +1 -0
- package/dist/generator.d.ts +1 -1
- package/dist/generator.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +1 -1
- package/dist/models.js +1 -1
- package/dist/renderer.d.ts +2 -2
- package/dist/renderer.js +31 -5
- package/dist/renderer.js.map +1 -1
- package/package.json +22 -2
- package/skills/build-skills.sh +14 -7
- package/skills/colamd-themes/SKILL.md +13 -10
- package/.claude/skills/colamd-themes-preview.skill.md +0 -333
- package/.claude/skills/colamd-themes.skill.md +0 -10
- package/.dsh/skills/colamd-themes/SKILL.md +0 -14
- package/.github/supported-topics.yml +0 -17
- package/.hermes/skills/tools/colamd-themes/SKILL.md +0 -14
- package/.openclaw/skills/colamd-themes/SKILL.md +0 -21
- package/.opencode/skills/colamd-themes/SKILL.md +0 -17
- package/.trae/rules/colamd-themes.md +0 -5
- package/CHANGELOG.md +0 -331
- package/DSH_SUPPORT_SUMMARY.md +0 -87
- package/README_CN.md +0 -412
- package/RELEASENOTE.md +0 -541
- package/mcp-server/dist/index.d.ts +0 -13
- package/mcp-server/dist/index.d.ts.map +0 -1
- package/mcp-server/dist/index.js.map +0 -1
- package/mcp-server/package-lock.json +0 -1759
- package/mcp-server/package.json +0 -24
- package/mcp-server/src/index.ts +0 -0
- package/mcp-server/tsconfig.json +0 -19
- package/src/cli.ts +0 -474
- package/src/color-systems.ts +0 -289
- package/src/color-utils.ts +0 -137
- package/src/contrast.ts +0 -66
- package/src/docx-style-paradigm.ts +0 -811
- package/src/export-cli.ts +0 -356
- package/src/extractors/base.ts +0 -8
- package/src/extractors/docx-extractor.ts +0 -417
- package/src/extractors/pdf-extractor.ts +0 -533
- package/src/extractors/url-extractor.ts +0 -846
- package/src/generator.ts +0 -197
- package/src/index.ts +0 -29
- package/src/models.ts +0 -212
- package/src/renderer.ts +0 -310
- package/src/templates/template.css +0 -220
- package/src/templates/theme-paradigm.md +0 -530
- package/src/templates/theme-template.hbs +0 -256
- package/src/theme-store.ts +0 -185
- package/src/types/pdf-parse.d.ts +0 -12
- package/src/utils/cli-utils.ts +0 -84
- package/src/utils/document-paradigm.ts +0 -118
- package/src/validators.ts +0 -298
- package/themes-preview/demo-content.md +0 -187
- package/tsconfig.json +0 -18
package/dist/index.d.ts
CHANGED
|
@@ -8,3 +8,6 @@ export { PdfExtractor } from "./extractors/pdf-extractor.js";
|
|
|
8
8
|
export type { Extractor } from "./extractors/base.js";
|
|
9
9
|
export { ACADEMIC_PAPER_DEFAULTS, BUSINESS_REPORT_DEFAULTS, TECHNICAL_DOC_DEFAULTS, generatePrintFriendlyGrayscale, generateMorandiPrintPalette, validateDocumentStyle, normalizeForPrinting, getRecommendedPreset, DOCUMENT_STYLE_PRESETS, } from "./docx-style-paradigm.js";
|
|
10
10
|
export type { DocumentStyleParadigm, FontStyleDefinition, TableCellStyle, PrintOptimization, StyleValidationIssue, } from "./docx-style-paradigm.js";
|
|
11
|
+
export { SUPPORTED_CONTRACT, MIN_RENDERER_VERSION, REQUIRED_RENDERER_API, getColamdCompat, formatColamdCompat, } from "./compat.js";
|
|
12
|
+
export type { ColamdCompat, ColamdContract, CompatStatus } from "./compat.js";
|
|
13
|
+
export { apply, inject, name } from "./dsh-plugin.js";
|
package/dist/index.js
CHANGED
|
@@ -6,4 +6,9 @@ export { UrlExtractor } from "./extractors/url-extractor.js";
|
|
|
6
6
|
export { DocxExtractor } from "./extractors/docx-extractor.js";
|
|
7
7
|
export { PdfExtractor } from "./extractors/pdf-extractor.js";
|
|
8
8
|
export { ACADEMIC_PAPER_DEFAULTS, BUSINESS_REPORT_DEFAULTS, TECHNICAL_DOC_DEFAULTS, generatePrintFriendlyGrayscale, generateMorandiPrintPalette, validateDocumentStyle, normalizeForPrinting, getRecommendedPreset, DOCUMENT_STYLE_PRESETS, } from "./docx-style-paradigm.js";
|
|
9
|
+
// Platform compatibility layer — runtime probes for @bytechain.cn/colamd
|
|
10
|
+
// version / contract drift and the renderer API surface.
|
|
11
|
+
export { SUPPORTED_CONTRACT, MIN_RENDERER_VERSION, REQUIRED_RENDERER_API, getColamdCompat, formatColamdCompat, } from "./compat.js";
|
|
12
|
+
// DSH (dsh-market) plugin protocol exports — consumed by the Harness runtime.
|
|
13
|
+
export { apply, inject, name } from "./dsh-plugin.js";
|
|
9
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAUlC,yEAAyE;AACzE,yDAAyD;AACzD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,8EAA8E;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/models.d.ts
CHANGED
package/dist/models.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Theme style data models — v4.0 Seed Palette paradigm (ColaMD 2.7.8-rc.
|
|
1
|
+
/** Theme style data models — v4.0 Seed Palette paradigm (ColaMD 2.7.8-rc.2 contract). */
|
|
2
2
|
// ═══════════════════════════════════════════════════════════
|
|
3
3
|
// Defaults
|
|
4
4
|
// ═══════════════════════════════════════════════════════════
|
package/dist/renderer.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Puppeteer-based rendering engine for ColaMD HTML/PDF export.
|
|
3
3
|
*
|
|
4
4
|
* Uses the @bytechain.cn/colamd 2.x library build (dist/lib/colamd-renderer.js +
|
|
5
|
-
* colamd.css, requires ≥2.7.8-rc.
|
|
5
|
+
* colamd.css, requires ≥2.7.8-rc.2) to create a headless editor, apply themes,
|
|
6
6
|
* render mermaid/math, and export standalone HTML or PDF. Theme CSS targets the
|
|
7
|
-
* ColaMD 2.7.8-rc.
|
|
7
|
+
* ColaMD 2.7.8-rc.2 contract (machine-readable as themes/contract.json in the
|
|
8
8
|
* npm package) and is consumed directly as `:root` declarations.
|
|
9
9
|
*
|
|
10
10
|
* Architecture:
|
package/dist/renderer.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Puppeteer-based rendering engine for ColaMD HTML/PDF export.
|
|
3
3
|
*
|
|
4
4
|
* Uses the @bytechain.cn/colamd 2.x library build (dist/lib/colamd-renderer.js +
|
|
5
|
-
* colamd.css, requires ≥2.7.8-rc.
|
|
5
|
+
* colamd.css, requires ≥2.7.8-rc.2) to create a headless editor, apply themes,
|
|
6
6
|
* render mermaid/math, and export standalone HTML or PDF. Theme CSS targets the
|
|
7
|
-
* ColaMD 2.7.8-rc.
|
|
7
|
+
* ColaMD 2.7.8-rc.2 contract (machine-readable as themes/contract.json in the
|
|
8
8
|
* npm package) and is consumed directly as `:root` declarations.
|
|
9
9
|
*
|
|
10
10
|
* Architecture:
|
|
@@ -18,11 +18,14 @@ import puppeteer from "puppeteer";
|
|
|
18
18
|
import { createServer } from "node:http";
|
|
19
19
|
import { readFileSync, existsSync, createReadStream } from "node:fs";
|
|
20
20
|
import { resolve, dirname, join } from "node:path";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { formatColamdCompat, getColamdCompat, MIN_RENDERER_VERSION, REQUIRED_RENDERER_API } from "./compat.js";
|
|
21
23
|
// ── File resolution ──
|
|
22
24
|
/** Locate the ColaMD renderer ESM bundle in node_modules. */
|
|
23
25
|
function findRendererPath() {
|
|
26
|
+
const moduleDir = fileURLToPath(new URL("../node_modules/@bytechain.cn/colamd/dist/lib", import.meta.url));
|
|
24
27
|
const candidates = [
|
|
25
|
-
resolve(
|
|
28
|
+
resolve(moduleDir, "colamd-renderer.js"),
|
|
26
29
|
resolve(process.cwd(), "node_modules/@bytechain.cn/colamd/dist/lib/colamd-renderer.js"),
|
|
27
30
|
];
|
|
28
31
|
for (const p of candidates) {
|
|
@@ -38,7 +41,7 @@ function findRendererPath() {
|
|
|
38
41
|
const version = JSON.parse(readFileSync(pkgJson, "utf-8")).version;
|
|
39
42
|
if (version.startsWith("2.")) {
|
|
40
43
|
throw new Error(`@bytechain.cn/colamd ${version} 不含 colamd-renderer.js 库入口(2.7.8 起恢复提供)。` +
|
|
41
|
-
|
|
44
|
+
`请升级: npm install @bytechain.cn/colamd@^${MIN_RENDERER_VERSION}`);
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
catch (e) {
|
|
@@ -48,7 +51,7 @@ function findRendererPath() {
|
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
throw new Error("Cannot find @bytechain.cn/colamd renderer. " +
|
|
51
|
-
|
|
54
|
+
`Install it: npm install @bytechain.cn/colamd@^${MIN_RENDERER_VERSION}`);
|
|
52
55
|
}
|
|
53
56
|
// ── Local HTTP server ──
|
|
54
57
|
const SHELL_HTML = `<!DOCTYPE html>
|
|
@@ -134,6 +137,29 @@ export class ColamdRenderer {
|
|
|
134
137
|
const error = await this.page.evaluate(() => window.__colamdError);
|
|
135
138
|
if (error)
|
|
136
139
|
throw new Error(`Editor init failed: ${error}`);
|
|
140
|
+
// Capability probe: verify the editor handle exposes the API surface the
|
|
141
|
+
// export pipeline calls, so future platform API drift produces an
|
|
142
|
+
// actionable error (with the installed version) instead of an
|
|
143
|
+
// "undefined is not a function" mid-render.
|
|
144
|
+
const missingApi = await this.page.evaluate((methods) => {
|
|
145
|
+
const handle = window.__colamdHandle;
|
|
146
|
+
if (!handle || typeof handle !== "object")
|
|
147
|
+
return methods;
|
|
148
|
+
return methods.filter((m) => typeof handle[m] !== "function");
|
|
149
|
+
}, [...REQUIRED_RENDERER_API]);
|
|
150
|
+
if (missingApi.length > 0) {
|
|
151
|
+
const { version } = getColamdCompat();
|
|
152
|
+
throw new Error(`Renderer API 不兼容:@bytechain.cn/colamd ${version ?? "(未知版本)"} 缺少导出管线所需的方法 ` +
|
|
153
|
+
`[${missingApi.join(", ")}]。平台可能已升级 API,` +
|
|
154
|
+
`请安装经核验的版本: npm install @bytechain.cn/colamd@^${MIN_RENDERER_VERSION}`);
|
|
155
|
+
}
|
|
156
|
+
// Contract drift warning — non-fatal: the platform still renders, but our
|
|
157
|
+
// :root variables may no longer be fully consumed.
|
|
158
|
+
const compat = getColamdCompat();
|
|
159
|
+
if (compat.status === "drift") {
|
|
160
|
+
console.warn(`[colamd-themes] 平台契约漂移: ${formatColamdCompat(compat)}`);
|
|
161
|
+
console.warn(`[colamd-themes] 导出仍将继续;如配色异常请核对平台 changelog 或安装 @bytechain.cn/colamd@^${MIN_RENDERER_VERSION}`);
|
|
162
|
+
}
|
|
137
163
|
this.ready = true;
|
|
138
164
|
}
|
|
139
165
|
/**
|
package/dist/renderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,SAAsC,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,SAAsC,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB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IACtC,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAkB,EAClB,OAA0B;IAE1B,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IACtC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytechain.cn/colamd-themes",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Theme development & export tool for ColaMD — extract formatting, generate themes, and export Markdown to HTML/PDF",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"dsh",
|
|
23
|
+
"dsh-plugin",
|
|
23
24
|
"deepseek-harness",
|
|
24
25
|
"colamd",
|
|
25
26
|
"themes",
|
|
@@ -31,8 +32,27 @@
|
|
|
31
32
|
"ai-agent",
|
|
32
33
|
"agent-skill"
|
|
33
34
|
],
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"themes",
|
|
38
|
+
"skills",
|
|
39
|
+
"cordis.patch.yml"
|
|
40
|
+
],
|
|
41
|
+
"dsh": {
|
|
42
|
+
"bundle": {
|
|
43
|
+
"patch": "./cordis.patch.yml"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@deepseek-ai/dsh-skill": "^0.1.5-rc.1 || ^0.2.0-rc || ^0.2.1-rc || ^0.3.0-rc || ^0.4.0-rc"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"@deepseek-ai/dsh-skill": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
34
54
|
"dependencies": {
|
|
35
|
-
"@bytechain.cn/colamd": "^2.7.8-rc.
|
|
55
|
+
"@bytechain.cn/colamd": "^2.7.8-rc.2",
|
|
36
56
|
"axios": "^1.7",
|
|
37
57
|
"chalk": "^5.3",
|
|
38
58
|
"cheerio": "^1.0",
|
package/skills/build-skills.sh
CHANGED
|
@@ -18,15 +18,22 @@ if [[ ! -f "$SOURCE" ]]; then
|
|
|
18
18
|
exit 1
|
|
19
19
|
fi
|
|
20
20
|
|
|
21
|
-
# Read the body (everything after the first blank line following the heading)
|
|
22
|
-
|
|
21
|
+
# Read the body (everything after the first blank line following the heading).
|
|
22
|
+
# Strip CR first: on Windows checkouts the source may use CRLF, and sed's
|
|
23
|
+
# `/^$/` cannot match a "\r" line — silently producing an empty BODY and
|
|
24
|
+
# truncated skill files (regression shipped in 0.5.2).
|
|
25
|
+
BODY=$(sed 's/\r$//' "$SOURCE" | sed -n '/^$/,$ { /^# ColaMD/!p; }' | sed '1{/^$/d;}')
|
|
26
|
+
if [[ -z "$BODY" ]]; then
|
|
27
|
+
echo "Error: extracted body from $SOURCE is empty (line-ending issue?)" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
23
30
|
|
|
24
31
|
# ── Frontmatter templates ──
|
|
25
32
|
|
|
26
33
|
FRONT_CLAUDE='---
|
|
27
34
|
name: colamd-themes
|
|
28
35
|
description: >
|
|
29
|
-
Generate, validate, export, and manage ColaMD 2.7.
|
|
36
|
+
Generate, validate, export, and manage ColaMD 2.7.8-rc.2 contract CSS themes.
|
|
30
37
|
Extract formatting from URLs, DOCX, or PDF sources; export Markdown to
|
|
31
38
|
standalone HTML/PDF with themes applied; batch export; manage theme
|
|
32
39
|
configuration.
|
|
@@ -36,7 +43,7 @@ FRONT_OPENCODE='---
|
|
|
36
43
|
name: colamd-themes
|
|
37
44
|
version: "1.0.0"
|
|
38
45
|
description: >
|
|
39
|
-
Generate, validate, export, and manage ColaMD 2.7.
|
|
46
|
+
Generate, validate, export, and manage ColaMD 2.7.8-rc.2 contract CSS themes.
|
|
40
47
|
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
41
48
|
user-invocable: true
|
|
42
49
|
allowed-tools:
|
|
@@ -52,7 +59,7 @@ FRONT_OPENCLAW='---
|
|
|
52
59
|
id: colamd-themes
|
|
53
60
|
name: ColaMD Themes
|
|
54
61
|
description: >
|
|
55
|
-
Generate, validate, export, and manage ColaMD 2.7.
|
|
62
|
+
Generate, validate, export, and manage ColaMD 2.7.8-rc.2 contract CSS themes.
|
|
56
63
|
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
57
64
|
version: "1.0.0"
|
|
58
65
|
icon: "\U0001F3A8"
|
|
@@ -70,7 +77,7 @@ metadata:
|
|
|
70
77
|
|
|
71
78
|
FRONT_HERMES='---
|
|
72
79
|
name: colamd-themes
|
|
73
|
-
description: "Generate, validate, export, and manage ColaMD 2.7.
|
|
80
|
+
description: "Generate, validate, export, and manage ColaMD 2.7.8-rc.2 contract CSS themes."
|
|
74
81
|
version: 1.0.0
|
|
75
82
|
author: bytechain
|
|
76
83
|
license: MIT
|
|
@@ -85,7 +92,7 @@ FRONT_DSH='---
|
|
|
85
92
|
name: colamd-themes
|
|
86
93
|
version: "1.0.0"
|
|
87
94
|
description: >
|
|
88
|
-
Generate, validate, export, and manage ColaMD 2.7.
|
|
95
|
+
Generate, validate, export, and manage ColaMD 2.7.8-rc.2 contract CSS themes.
|
|
89
96
|
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
90
97
|
metadata:
|
|
91
98
|
dsh:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ColaMD Themes — Universal AI Agent Skill
|
|
2
2
|
|
|
3
|
-
Generate, validate, export, and manage ColaMD **2.7.
|
|
3
|
+
Generate, validate, export, and manage ColaMD **2.7.8-rc.2 contract** CSS themes. Extract formatting from URLs, DOCX, or PDF sources; export Markdown to standalone HTML/PDF with themes applied; batch export; manage theme configuration.
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
@@ -44,6 +44,8 @@ colamd-themes list [-d <dir>]
|
|
|
44
44
|
colamd-themes validate <file.css>
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
`validate` prints a **platform compat line** ("平台兼容") — it reports the installed `@bytechain.cn/colamd` version and whether its `themes/contract.json` matches the 2.7.8-rc.2 theme contract. On drift it lists missing live variables; treat that as a signal to check the platform changelog or pin `@bytechain.cn/colamd@^2.7.8-rc.2`.
|
|
48
|
+
|
|
47
49
|
## Options
|
|
48
50
|
|
|
49
51
|
### Extract options
|
|
@@ -121,14 +123,15 @@ Export uses Puppeteer (headless Chromium) with `@bytechain.cn/colamd/renderer`:
|
|
|
121
123
|
|
|
122
124
|
1. Local HTTP server serves renderer ESM bundle (avoids CORS)
|
|
123
125
|
2. Puppeteer navigates to server page (same-origin)
|
|
124
|
-
3. `createColaMDEditor({ editable: false })` initializes
|
|
125
|
-
4. `applyTheme
|
|
126
|
-
5. `
|
|
127
|
-
6. `
|
|
128
|
-
7. `
|
|
129
|
-
8.
|
|
126
|
+
3. `createColaMDEditor({ editable: false })` initializes the CM6 editor
|
|
127
|
+
4. Capability probe verifies the export API surface (`applyTheme` / `setMarkdown` / `ensureAllPluginsRendered` / `buildExportHTML`); drift fails fast with the installed version and a fix command
|
|
128
|
+
5. `applyTheme(name, customCSS?)` sets theme
|
|
129
|
+
6. `setMarkdown(content)` loads document
|
|
130
|
+
7. `ensureAllPluginsRendered()` waits for mermaid/KaTeX
|
|
131
|
+
8. `buildExportHTML()` → standalone HTML with embedded CSS
|
|
132
|
+
9. For PDF: load the export HTML in a fresh page + `page.pdf()` — do NOT `emulateMediaType('screen')`, the theme's `@media print` rules (with `print-color-adjust: exact`) must apply
|
|
130
133
|
|
|
131
|
-
## 2.7.
|
|
134
|
+
## 2.7.8-rc.2 Contract Constraints
|
|
132
135
|
|
|
133
136
|
- Variables live in `:root`; anything in `body.theme-*` is ignored
|
|
134
137
|
- Live variables only: `--bg-color --text-color --text-secondary --text-muted --border-color --link-color --code-bg --code-block-bg --code-block-text --blockquote-border --blockquote-bg --table-header-bg --selection-bg --highlight-bg --font-body --font-mono --editor-font-size --editor-column-width` + `--pele-*`
|
|
@@ -172,9 +175,9 @@ Export uses Puppeteer (headless Chromium) with `@bytechain.cn/colamd/renderer`:
|
|
|
172
175
|
## Architecture
|
|
173
176
|
|
|
174
177
|
```
|
|
175
|
-
Source → Extractor → ThemeStyle → Color System + Pele + Validators → CSS (2.7.
|
|
178
|
+
Source → Extractor → ThemeStyle → Color System + Pele + Validators → CSS (2.7.8-rc.2 contract)
|
|
176
179
|
|
|
177
180
|
Markdown → Puppeteer + ColaMD renderer → HTML / PDF
|
|
178
181
|
```
|
|
179
182
|
|
|
180
|
-
> Export runs the
|
|
183
|
+
> Export runs the ColaMD 2.x library renderer (`@bytechain.cn/colamd@^2.7.8-rc.2` ships `dist/lib/colamd-renderer.js` + `colamd.css`); the same CM6 editor as the app runs headless via Puppeteer. Theme CSS is consumed directly as `:root` declarations and `buildExportHTML({ title })` serializes only contract live variables. Generated CSS targets the 2.7.8-rc.2 contract (unchanged since 2.7.7, machine-readable as `themes/contract.json` in the npm package), so it carries over unchanged. Platform upgrades are handled by a compat layer (`src/compat.ts`): contract drift is reported by `validate` and non-fatally at export, and the renderer API surface is probed at init — upgrades produce actionable diagnostics, not crashes.
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: colamd-themes-preview
|
|
3
|
-
description: >-
|
|
4
|
-
Preview and showcase ColaMD themes with interactive HTML demos, batch
|
|
5
|
-
comparisons, and development server. Use when user wants to visualize a
|
|
6
|
-
theme's appearance across different Markdown elements or compare multiple
|
|
7
|
-
themes side-by-side.
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# ColaMD Themes Preview — Visual Theme Showcase
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
This skill complements `colamd-themes` by adding visual preview capabilities:
|
|
15
|
-
|
|
16
|
-
- **Static HTML preview** — Generate a standalone HTML file showcasing a theme
|
|
17
|
-
- **Batch comparison** — Compare multiple themes in one page with synchronized scrolling
|
|
18
|
-
- **Dev server** — Hot-reload preview server for theme development
|
|
19
|
-
- **Demo content** — Includes comprehensive Markdown examples (headings, lists, tables, code blocks, Mermaid diagrams, math, etc.)
|
|
20
|
-
|
|
21
|
-
## When to Use
|
|
22
|
-
|
|
23
|
-
- After generating a theme with `colamd-themes extract` → preview it before validation
|
|
24
|
-
- When choosing between multiple extracted themes → batch compare
|
|
25
|
-
- During theme fine-tuning → use dev server for instant feedback
|
|
26
|
-
- Before sharing a theme → generate polished showcase page
|
|
27
|
-
|
|
28
|
-
## Prerequisites
|
|
29
|
-
|
|
30
|
-
- Node.js ≥ 18
|
|
31
|
-
- ColaMD-themes project at: `/Volumes/DATA/data/develop/git/ColaMD-themes`
|
|
32
|
-
- Theme CSS files available in `themes/` directory
|
|
33
|
-
|
|
34
|
-
## Commands
|
|
35
|
-
|
|
36
|
-
### Generate Static Preview for a Single Theme
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
colamd-themes-preview generate <theme.css> [options]
|
|
40
|
-
# Output: themes-preview/<theme-name>-preview.html
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Options:
|
|
44
|
-
|
|
45
|
-
| Flag | Description |
|
|
46
|
-
|------|-------------|
|
|
47
|
-
| `-c, --content <file.md>` | Custom Markdown content (default: built-in demo) |
|
|
48
|
-
| `-o, --output <path>` | Output HTML file path |
|
|
49
|
-
| `-t, --title <text>` | Page title |
|
|
50
|
-
| `--embedded` | Embed theme CSS directly (single file) |
|
|
51
|
-
| `--no-mermaid` | Skip Mermaid demo section |
|
|
52
|
-
|
|
53
|
-
### Batch Compare Multiple Themes
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
colamd-themes-preview compare <theme1.css> <theme2.css> [theme3.css...] [options]
|
|
57
|
-
# Output: themes-preview/comparison-<timestamp>.html
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Features:
|
|
61
|
-
- Themes displayed in vertical tabs
|
|
62
|
-
- Synchronized scroll position
|
|
63
|
-
- Common content rendered under each theme
|
|
64
|
-
- Visual diff indicators (color swatches)
|
|
65
|
-
|
|
66
|
-
### Start Development Preview Server
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
colamd-themes-preview serve [options]
|
|
70
|
-
# Serves at http://localhost:3000
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Options:
|
|
74
|
-
|
|
75
|
-
| Flag | Description |
|
|
76
|
-
|------|-------------|
|
|
77
|
-
| `-p, --port <number>` | Server port (default: 3000) |
|
|
78
|
-
| `-w, --watch <dir>` | Watch directory for CSS changes |
|
|
79
|
-
| `-t, --themes-dir <dir>` | Themes directory (default: `themes/`) |
|
|
80
|
-
| `--open` | Open browser automatically |
|
|
81
|
-
|
|
82
|
-
Auto-reload: When a watched CSS file changes, the page refreshes automatically.
|
|
83
|
-
|
|
84
|
-
### Export Demo Content
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
colamd-themes-preview export-demo <output.md>
|
|
88
|
-
# Generates comprehensive Markdown with all element types
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Audit Theme against Document Type
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
colamd-themes-preview audit <theme.css> [options]
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Performs a comprehensive audit of the generated CSS against type-specific design constraints and prints a compliance score.
|
|
98
|
-
|
|
99
|
-
Options:
|
|
100
|
-
|
|
101
|
-
| Flag | Description |
|
|
102
|
-
|------|-------------|
|
|
103
|
-
| `-t, --type <type>` | Document type: `document` (meeting minutes, reports), `design` (web page conversions), `ppt` (PDF from slides) |
|
|
104
|
-
| `-s, --source <file>` | Source file (DOCX/PDF) to compare against (used for PPT type) |
|
|
105
|
-
| `-f, --format <fmt>` | Report format: `text` (default), `json`, `html` |
|
|
106
|
-
| `--strict` | Exit with non-zero code on ANY violation (default: only MUST/MUST_NOT failures) |
|
|
107
|
-
|
|
108
|
-
The audit checks:
|
|
109
|
-
|
|
110
|
-
- Color values against type expectations
|
|
111
|
-
- Font stacks for appropriateness
|
|
112
|
-
- Pele chart palette suitability (`--pele-*` derives from code block colors)
|
|
113
|
-
- Print fidelity (2.7 exports the current window; `@media print` only needs `print-color-adjust`)
|
|
114
|
-
- Contrast ratios and accessibility
|
|
115
|
-
- Conformance to the 2.7 contract (`:root` vars, `.cm-md-*` selectors, no dead variables)
|
|
116
|
-
|
|
117
|
-
Output includes overall score (0–100) and categorized issues (CRITICAL, WARNING, INFO).
|
|
118
|
-
|
|
119
|
-
Example:
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
Audit: meeting-minutes.css (type: document)
|
|
123
|
-
Overall score: 92/100
|
|
124
|
-
|
|
125
|
-
CRITICAL:
|
|
126
|
-
(none)
|
|
127
|
-
|
|
128
|
-
WARNINGS:
|
|
129
|
-
- Accent saturation 0.72 exceeds document-type max 0.6
|
|
130
|
-
- Consider a more muted blue for formal documents
|
|
131
|
-
|
|
132
|
-
INFO:
|
|
133
|
-
- Chart palette: derived from `--pele-*`
|
|
134
|
-
- Font stack includes CJK fallbacks: Yes
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Built-in Demo Content
|
|
138
|
-
|
|
139
|
-
The preview includes this sample Markdown structure:
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
# Heading 1
|
|
143
|
-
## Heading 2
|
|
144
|
-
### Heading 3
|
|
145
|
-
|
|
146
|
-
Paragraph with **bold**, *italic*, `inline code`, [links](https://example.com), and ~~strikethrough~~.
|
|
147
|
-
|
|
148
|
-
> Blockquote with *emphasized* text and a link.
|
|
149
|
-
|
|
150
|
-
- Unordered list item 1
|
|
151
|
-
- Unordered list item 2
|
|
152
|
-
- Nested item
|
|
153
|
-
- Another nested item
|
|
154
|
-
|
|
155
|
-
1. Ordered list item 1
|
|
156
|
-
2. Ordered list item 2
|
|
157
|
-
1. Nested ordered item
|
|
158
|
-
|
|
159
|
-
- [ ] Task list item (unchecked)
|
|
160
|
-
- [x] Task list item (checked)
|
|
161
|
-
|
|
162
|
-
```python
|
|
163
|
-
def hello():
|
|
164
|
-
print("Hello, ColaMD!")
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
| Header 1 | Header 2 | Header 3 |
|
|
168
|
-
|----------|----------|----------|
|
|
169
|
-
| Cell 1 | Cell 2 | Cell 3 |
|
|
170
|
-
| Cell 4 | Cell 5 | Cell 6 |
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
```mermaid
|
|
175
|
-
graph TD
|
|
176
|
-
A[Start] --> B{Decision}
|
|
177
|
-
B --> C[Option 1]
|
|
178
|
-
B --> D[Option 2]
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
$$
|
|
182
|
-
\int_{a}^{b} x^2 dx
|
|
183
|
-
$$
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
[[toc]]
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## HTML Preview Features
|
|
191
|
-
|
|
192
|
-
Generated preview pages include:
|
|
193
|
-
|
|
194
|
-
1. **Theme metadata bar** — name, color system, mermaid preset
|
|
195
|
-
2. **Color palette swatches** — seed colors displayed as swatches
|
|
196
|
-
3. **Typography samples** — heading and body font renders
|
|
197
|
-
4. **Full Markdown rendering** — all ColaMD-supported elements
|
|
198
|
-
5. **Print preview toggle** — switch to print stylesheet view
|
|
199
|
-
6. **Mobile responsive toggle** — simulate mobile viewport
|
|
200
|
-
7. **CSS source viewer** — collapsible panel to inspect the theme file
|
|
201
|
-
8. **Download button** — export the theme CSS
|
|
202
|
-
|
|
203
|
-
## Batch Comparison Layout
|
|
204
|
-
|
|
205
|
-
Comparison page organizes themes horizontally (if < 4 themes) or in tabs:
|
|
206
|
-
|
|
207
|
-
- **Color palette matrix** — side-by-side swatch comparison
|
|
208
|
-
- **Shared scroll container** — all themes scroll together
|
|
209
|
-
- **Highlight differences** — hover a theme to emphasize it
|
|
210
|
-
- **Export all** — zip all themes + preview HTML
|
|
211
|
-
|
|
212
|
-
## Development Server Workflow
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
# Start server with watch
|
|
216
|
-
colamd-themes-preview serve -w themes/
|
|
217
|
-
|
|
218
|
-
# In another terminal, edit your theme CSS
|
|
219
|
-
# Browser auto-refreshes on save
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
The server serves:
|
|
223
|
-
- `/` — theme selector + preview
|
|
224
|
-
- `/preview/<theme-name>` — single theme preview
|
|
225
|
-
- `/compare` — batch comparison (query: ?themes=a.css,b.css)
|
|
226
|
-
- `/demo-content.md` — raw demo content
|
|
227
|
-
|
|
228
|
-
## Integration with colamd-themes
|
|
229
|
-
|
|
230
|
-
Typical workflow:
|
|
231
|
-
|
|
232
|
-
1. Extract theme:
|
|
233
|
-
```bash
|
|
234
|
-
colamd-themes extract source.docx --name my-theme --auto-match
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
2. Preview it:
|
|
238
|
-
```bash
|
|
239
|
-
colamd-themes-preview generate themes/my-theme.css --embedded
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
3. Fine-tune seed colors manually in `themes/my-theme.css` (SECTION 1 only)
|
|
243
|
-
|
|
244
|
-
4. Re-preview instantly with dev server:
|
|
245
|
-
```bash
|
|
246
|
-
colamd-themes-preview serve -w themes/
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
5. Validate:
|
|
250
|
-
```bash
|
|
251
|
-
colamd-themes validate themes/my-theme.css
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
6. (Optional) Compare with alternatives:
|
|
255
|
-
```bash
|
|
256
|
-
colamd-themes-preview compare themes/*.css
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
7. Audit against document type expectations:
|
|
260
|
-
```bash
|
|
261
|
-
colamd-themes-preview audit themes/my-theme.css --type document
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
## Code Audit Rules
|
|
265
|
-
|
|
266
|
-
The `audit` command validates a theme against expectations for its document type. Rules are prioritized:
|
|
267
|
-
|
|
268
|
-
- **MUST** / **MUST_NOT** — critical non-negotiable constraints (fail audit)
|
|
269
|
-
- **SHOULD** / **SHOULD_NOT** — recommended best practices (warnings)
|
|
270
|
-
- **INFO** — informational notes (no score impact)
|
|
271
|
-
|
|
272
|
-
### Document Type Rules
|
|
273
|
-
|
|
274
|
-
**Document** (meeting minutes, reports, proposals):
|
|
275
|
-
|
|
276
|
-
- Surface: near-white (Luminance ≥ 0.95)
|
|
277
|
-
- Ink: dark (Luminance ≤ 0.2 or hex `#000000`–`#222222`)
|
|
278
|
-
- Accent: medium saturation (0.3 ≤ S ≤ 0.6), professional hues (blue, teal, burgundy)
|
|
279
|
-
- Chart palette: muted `--pele-*` derived from code block tones
|
|
280
|
-
- Font bodies: serif or clean sans-serif, include CJK fallbacks
|
|
281
|
-
- Print styles: no mirrored color block needed; `@media print` only carries `print-color-adjust: exact`
|
|
282
|
-
- Expectation: readability, print-friendliness, conservative palette
|
|
283
|
-
|
|
284
|
-
**Design** (web page style conversions):
|
|
285
|
-
|
|
286
|
-
- Surface: varies (light or dark)
|
|
287
|
-
- Accent: high saturation (S ≥ 0.6), vibrant colors, possible gradients
|
|
288
|
-
- Font families: modern sans-serif stack, may include display fonts
|
|
289
|
-
- Chart palette: `--pele-*` tuned to the background luminance
|
|
290
|
-
- Print styles: SHOULD preserve brand colors; if source has print styles, compare against them
|
|
291
|
-
- Expectation: faithful reproduction of source website's visual identity
|
|
292
|
-
|
|
293
|
-
**PPT** (PDF from presentation slides):
|
|
294
|
-
|
|
295
|
-
- Must preserve original slide color scheme (extracted from source PDF)
|
|
296
|
-
- Text colors must match original slide text colors within tolerance
|
|
297
|
-
- Chart colors should follow slide accent palette (`--pele-accent`)
|
|
298
|
-
- Font choices should reflect slide typography
|
|
299
|
-
- Print styles: CRITICAL — 2.7 prints the current window, so screen rules apply as-is; verify `@media print` carries `print-color-adjust: exact`
|
|
300
|
-
- Expectation: high fidelity to original slide design, including print output
|
|
301
|
-
|
|
302
|
-
## Implementation Notes
|
|
303
|
-
|
|
304
|
-
- Preview HTML uses a simple client-side renderer (marked.js or similar)
|
|
305
|
-
- No additional build step required — copies template + injects theme CSS
|
|
306
|
-
- Embedded mode inlines the entire CSS to avoid CORS issues when sharing
|
|
307
|
-
- Dev server uses `chokidar` for file watching and `ws` for live reload WebSocket
|
|
308
|
-
|
|
309
|
-
## File Structure
|
|
310
|
-
|
|
311
|
-
```
|
|
312
|
-
ColaMD-themes/
|
|
313
|
-
├── .claude/skills/
|
|
314
|
-
│ ├── colamd-themes.skill.md (existing)
|
|
315
|
-
│ └── colamd-themes-preview.skill.md (this skill)
|
|
316
|
-
├── src/
|
|
317
|
-
│ ├── preview/
|
|
318
|
-
│ │ ├── preview-server.ts (dev server)
|
|
319
|
-
│ │ ├── generate-html.ts (static HTML generator)
|
|
320
|
-
│ │ ├── demo-content.md (built-in Markdown sample)
|
|
321
|
-
│ │ └── template.html (HTML skeleton)
|
|
322
|
-
│ └── cli.ts (+ new subcommands)
|
|
323
|
-
├── themes-preview/ (output directory)
|
|
324
|
-
└── package.json (adds preview deps)
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
## Future Enhancements
|
|
328
|
-
|
|
329
|
-
- Screenshot automation (puppeteer) for documentation
|
|
330
|
-
- Export to PDF with print styles applied
|
|
331
|
-
- Share to ColaMD community gallery
|
|
332
|
-
- AI-driven theme critique (color harmony, contrast feedback)
|
|
333
|
-
- Theme package (.zip) with preview, demo, and license
|