@bytechain.cn/colamd-themes 0.3.2 → 0.5.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/.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 +318 -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/bytechain.cn-colamd-themes-0.5.0.tgz +0 -0
- 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 +4 -2
- package/dist/renderer.js +64 -84
- 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 +332 -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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bytechain.cn/colamd-themes-mcp",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP Server for ColaMD-themes — expose theme extraction, export, and validation as MCP tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"colamd-themes-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsx src/index.ts",
|
|
13
|
+
"start": "node dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
17
|
+
"zod": "^3.23.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^22.0",
|
|
21
|
+
"tsx": "^4.0",
|
|
22
|
+
"typescript": "^5.5"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"sourceMap": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*"],
|
|
18
|
+
"exclude": ["node_modules", "dist"]
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,36 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bytechain.cn/colamd-themes",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Theme development & export tool for ColaMD — extract formatting, generate themes, and export Markdown to HTML/PDF",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"colamd-themes": "./dist/cli.js",
|
|
9
|
-
"cthemes": "./dist/cli.js"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"build
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@bytechain.cn/colamd-themes",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Theme development & export tool for ColaMD — extract formatting, generate themes, and export Markdown to HTML/PDF",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"colamd-themes": "./dist/cli.js",
|
|
9
|
+
"cthemes": "./dist/cli.js",
|
|
10
|
+
"colamd-themes-mcp": "./mcp-server/dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc && node --input-type=commonjs -e \"require('fs').cpSync('src/templates','dist/templates',{recursive:true})\"",
|
|
14
|
+
"build:skills": "bash skills/build-skills.sh",
|
|
15
|
+
"dev": "tsx src/cli.ts",
|
|
16
|
+
"start": "node dist/cli.js",
|
|
17
|
+
"build:mcp": "cd mcp-server && npm run build",
|
|
18
|
+
"build:all": "npm run build && npm run build:mcp",
|
|
19
|
+
"mcp": "node mcp-server/dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"dsh",
|
|
23
|
+
"deepseek-harness",
|
|
24
|
+
"colamd",
|
|
25
|
+
"themes",
|
|
26
|
+
"css",
|
|
27
|
+
"markdown",
|
|
28
|
+
"pdf",
|
|
29
|
+
"html",
|
|
30
|
+
"skill",
|
|
31
|
+
"ai-agent",
|
|
32
|
+
"agent-skill"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@bytechain.cn/colamd": "^1.5.2",
|
|
36
|
+
"axios": "^1.7",
|
|
37
|
+
"chalk": "^5.3",
|
|
38
|
+
"cheerio": "^1.0",
|
|
39
|
+
"commander": "^12.0",
|
|
40
|
+
"css-tree": "^3.0",
|
|
41
|
+
"handlebars": "^4.7",
|
|
42
|
+
"mammoth": "^1.8",
|
|
43
|
+
"ora": "^8.0",
|
|
44
|
+
"pdf-parse": "^1.1",
|
|
45
|
+
"pptxgenjs": "^4.0.1",
|
|
46
|
+
"puppeteer": "^24.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/css-tree": "^2.3",
|
|
50
|
+
"@types/node": "^22.0",
|
|
51
|
+
"tsx": "^4.0",
|
|
52
|
+
"typescript": "^5.5"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/skills/build-skills.sh
CHANGED
|
@@ -26,7 +26,7 @@ BODY=$(sed -n '/^$/,$ { /^# ColaMD/!p; }' "$SOURCE" | sed '1{/^$/d;}')
|
|
|
26
26
|
FRONT_CLAUDE='---
|
|
27
27
|
name: colamd-themes
|
|
28
28
|
description: >
|
|
29
|
-
Generate, validate, export, and manage ColaMD
|
|
29
|
+
Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
|
|
30
30
|
Extract formatting from URLs, DOCX, or PDF sources; export Markdown to
|
|
31
31
|
standalone HTML/PDF with themes applied; batch export; manage theme
|
|
32
32
|
configuration.
|
|
@@ -36,7 +36,7 @@ FRONT_OPENCODE='---
|
|
|
36
36
|
name: colamd-themes
|
|
37
37
|
version: "1.0.0"
|
|
38
38
|
description: >
|
|
39
|
-
Generate, validate, export, and manage ColaMD
|
|
39
|
+
Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
|
|
40
40
|
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
41
41
|
user-invocable: true
|
|
42
42
|
allowed-tools:
|
|
@@ -52,7 +52,7 @@ FRONT_OPENCLAW='---
|
|
|
52
52
|
id: colamd-themes
|
|
53
53
|
name: ColaMD Themes
|
|
54
54
|
description: >
|
|
55
|
-
Generate, validate, export, and manage ColaMD
|
|
55
|
+
Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
|
|
56
56
|
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
57
57
|
version: "1.0.0"
|
|
58
58
|
icon: "\U0001F3A8"
|
|
@@ -70,7 +70,7 @@ metadata:
|
|
|
70
70
|
|
|
71
71
|
FRONT_HERMES='---
|
|
72
72
|
name: colamd-themes
|
|
73
|
-
description: "Generate, validate, export, and manage ColaMD
|
|
73
|
+
description: "Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes."
|
|
74
74
|
version: 1.0.0
|
|
75
75
|
author: bytechain
|
|
76
76
|
license: MIT
|
|
@@ -81,6 +81,19 @@ prerequisites:
|
|
|
81
81
|
commands: [node, npm]
|
|
82
82
|
---'
|
|
83
83
|
|
|
84
|
+
FRONT_DSH='---
|
|
85
|
+
name: colamd-themes
|
|
86
|
+
version: "1.0.0"
|
|
87
|
+
description: >
|
|
88
|
+
Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
|
|
89
|
+
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
90
|
+
metadata:
|
|
91
|
+
dsh:
|
|
92
|
+
tags: [colamd, themes, css, markdown, export, pdf, html]
|
|
93
|
+
prerequisites:
|
|
94
|
+
commands: [node, npm]
|
|
95
|
+
---'
|
|
96
|
+
|
|
84
97
|
# ── Generator functions ──
|
|
85
98
|
|
|
86
99
|
generate_claude() {
|
|
@@ -123,6 +136,16 @@ generate_hermes() {
|
|
|
123
136
|
echo " → $file"
|
|
124
137
|
}
|
|
125
138
|
|
|
139
|
+
generate_dsh() {
|
|
140
|
+
local dir=".dsh/skills/colamd-themes"
|
|
141
|
+
mkdir -p "$dir"
|
|
142
|
+
local file="$dir/SKILL.md"
|
|
143
|
+
echo "$FRONT_DSH" > "$file"
|
|
144
|
+
echo "" >> "$file"
|
|
145
|
+
echo "$BODY" >> "$file"
|
|
146
|
+
echo " → $file"
|
|
147
|
+
}
|
|
148
|
+
|
|
126
149
|
generate_trae() {
|
|
127
150
|
local dir=".trae/rules"
|
|
128
151
|
mkdir -p "$dir"
|
|
@@ -148,16 +171,18 @@ case "$TARGET" in
|
|
|
148
171
|
openclaw) generate_openclaw ;;
|
|
149
172
|
hermes) generate_hermes ;;
|
|
150
173
|
trae) generate_trae ;;
|
|
174
|
+
dsh) generate_dsh ;;
|
|
151
175
|
all)
|
|
152
176
|
generate_claude
|
|
153
177
|
generate_opencode
|
|
154
178
|
generate_openclaw
|
|
155
179
|
generate_hermes
|
|
156
180
|
generate_trae
|
|
181
|
+
generate_dsh
|
|
157
182
|
;;
|
|
158
183
|
*)
|
|
159
184
|
echo "Unknown agent: $TARGET" >&2
|
|
160
|
-
echo "Usage: $0 [claude|opencode|openclaw|hermes|trae|all]" >&2
|
|
185
|
+
echo "Usage: $0 [claude|opencode|openclaw|hermes|trae|dsh|all]" >&2
|
|
161
186
|
exit 1
|
|
162
187
|
;;
|
|
163
188
|
esac
|
|
@@ -1,178 +1,180 @@
|
|
|
1
|
-
# ColaMD Themes — Universal AI Agent Skill
|
|
2
|
-
|
|
3
|
-
Generate, validate, export, and manage ColaMD
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- Node.js ≥ 18
|
|
8
|
-
- Project root: run `npm install && npm run build` before first use
|
|
9
|
-
- Or run directly: `npx tsx src/cli.ts <command>`
|
|
10
|
-
|
|
11
|
-
## Commands
|
|
12
|
-
|
|
13
|
-
### Theme extraction
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
colamd-themes from-url <URL> [options]
|
|
17
|
-
colamd-themes from-docx <file> [options]
|
|
18
|
-
colamd-themes from-pdf <file> [options]
|
|
19
|
-
colamd-themes extract <source> [options]
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Export to HTML / PDF
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
colamd-themes export-html <input.md> -t <theme> -o <output.html>
|
|
26
|
-
colamd-themes export-pdf <input.md> -t <theme> -o <output.pdf>
|
|
27
|
-
colamd-themes export <inputs...> --format html|pdf -t <theme> -d <dir>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Theme management
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
colamd-themes set-theme <name> --default
|
|
34
|
-
colamd-themes set-theme <name> --css <file>
|
|
35
|
-
colamd-themes set-theme <name> --css <file> --default
|
|
36
|
-
colamd-themes set-theme <name> --remove
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Inspection
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
colamd-themes color-systems [-j]
|
|
43
|
-
colamd-themes
|
|
44
|
-
colamd-themes
|
|
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
|
-
- No
|
|
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
|
-
### 5.
|
|
165
|
-
|
|
166
|
-
**Pitfall:**
|
|
167
|
-
|
|
168
|
-
### 6.
|
|
169
|
-
|
|
170
|
-
**Pitfall:**
|
|
171
|
-
|
|
172
|
-
## Architecture
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
Source → Extractor → ThemeStyle → Color System +
|
|
176
|
-
|
|
177
|
-
Markdown → Puppeteer + ColaMD
|
|
178
|
-
```
|
|
1
|
+
# ColaMD Themes — Universal AI Agent Skill
|
|
2
|
+
|
|
3
|
+
Generate, validate, export, and manage ColaMD **2.7.7 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
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js ≥ 18
|
|
8
|
+
- Project root: run `npm install && npm run build` before first use
|
|
9
|
+
- Or run directly: `npx tsx src/cli.ts <command>`
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
### Theme extraction
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
colamd-themes from-url <URL> [options]
|
|
17
|
+
colamd-themes from-docx <file> [options]
|
|
18
|
+
colamd-themes from-pdf <file> [options]
|
|
19
|
+
colamd-themes extract <source> [options]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Export to HTML / PDF
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
colamd-themes export-html <input.md> -t <theme> -o <output.html>
|
|
26
|
+
colamd-themes export-pdf <input.md> -t <theme> -o <output.pdf>
|
|
27
|
+
colamd-themes export <inputs...> --format html|pdf -t <theme> -d <dir>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Theme management
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
colamd-themes set-theme <name> --default
|
|
34
|
+
colamd-themes set-theme <name> --css <file>
|
|
35
|
+
colamd-themes set-theme <name> --css <file> --default
|
|
36
|
+
colamd-themes set-theme <name> --remove
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Inspection
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
colamd-themes color-systems [-j]
|
|
43
|
+
colamd-themes list [-d <dir>]
|
|
44
|
+
colamd-themes validate <file.css>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Options
|
|
48
|
+
|
|
49
|
+
### Extract options
|
|
50
|
+
|
|
51
|
+
| Flag | Description |
|
|
52
|
+
|------|-------------|
|
|
53
|
+
| `-n, --name` | Theme name |
|
|
54
|
+
| `-o, --output` | Output CSS file path |
|
|
55
|
+
| `-d, --themes-dir` | Themes directory (default: `themes/`) |
|
|
56
|
+
| `-c, --color-system` | Force a color system |
|
|
57
|
+
| `-A, --auto-match` | Auto-match a color system from the extracted palette |
|
|
58
|
+
|
|
59
|
+
### Export options
|
|
60
|
+
|
|
61
|
+
| Flag | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `-t, --theme` | Theme: built-in name, custom name, or `.css` file path |
|
|
64
|
+
| `-o, --output` | Output file path |
|
|
65
|
+
| `-d, --output-dir` | Output directory for batch export |
|
|
66
|
+
| `--format` | Batch: `html` or `pdf`; PDF: `A4`, `Letter`, `A3` |
|
|
67
|
+
|
|
68
|
+
## Theme Resolution
|
|
69
|
+
|
|
70
|
+
`-t, --theme` accepts:
|
|
71
|
+
1. **Built-in**: `light`, `dark`, `elegant`, `newsprint`
|
|
72
|
+
2. **Custom registered**: name set via `set-theme --css`
|
|
73
|
+
3. **File path**: any `.css` file on disk
|
|
74
|
+
|
|
75
|
+
Config: `~/.colamd-themes/config.json`
|
|
76
|
+
|
|
77
|
+
## Color Systems (15 schemes)
|
|
78
|
+
|
|
79
|
+
| Family | Schemes |
|
|
80
|
+
|--------|---------|
|
|
81
|
+
| 莫兰迪 (Morandi) | misty-rose, sage-green, dusky-blue |
|
|
82
|
+
| 马卡龙 (Macaron) | strawberry, mint, lavender |
|
|
83
|
+
| 北欧 (Nordic) | fjord-blue, pine-green, cloud-grey |
|
|
84
|
+
| 复古 (Vintage) | amber, burgundy, forest |
|
|
85
|
+
| 薄荷绿 (Mint) | matcha, spearmint, seafoam |
|
|
86
|
+
|
|
87
|
+
## Diagram Colors (Pele)
|
|
88
|
+
|
|
89
|
+
Mermaid 20-variable presets are gone. ColaMD 2.7.7 draws diagrams with Pele, whose SVG embeds `var(--pele-*)` and resolves them in the document. Override the 9 `--pele-*` variables on `:root` if needed; defaults derive from `--code-block-bg` / `--code-block-text` / `--link-color`.
|
|
90
|
+
|
|
91
|
+
## Workflow Examples
|
|
92
|
+
|
|
93
|
+
### Create theme from source
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
colamd-themes extract <source> --name "my-theme" --auto-match
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Export with theme
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
colamd-themes export-html doc.md -t elegant -o output.html
|
|
103
|
+
colamd-themes export-pdf doc.md -t my-brand -o output.pdf
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Batch export
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
colamd-themes export docs/ --format pdf -t dark -d output/
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Validate theme
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
colamd-themes validate themes/my-theme.css
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Rendering Pipeline
|
|
119
|
+
|
|
120
|
+
Export uses Puppeteer (headless Chromium) with `@bytechain.cn/colamd/renderer`:
|
|
121
|
+
|
|
122
|
+
1. Local HTTP server serves renderer ESM bundle (avoids CORS)
|
|
123
|
+
2. Puppeteer navigates to server page (same-origin)
|
|
124
|
+
3. `createColaMDEditor({ editable: false })` initializes Milkdown editor
|
|
125
|
+
4. `applyTheme(name, customCSS?)` sets theme
|
|
126
|
+
5. `setMarkdown(content)` loads document
|
|
127
|
+
6. `ensureAllPluginsRendered()` waits for mermaid/KaTeX
|
|
128
|
+
7. `buildExportHTML()` → standalone HTML with embedded CSS
|
|
129
|
+
8. For PDF: `emulateMediaType('screen')` + `page.pdf()`
|
|
130
|
+
|
|
131
|
+
## 2.7.7 Contract Constraints
|
|
132
|
+
|
|
133
|
+
- Variables live in `:root`; anything in `body.theme-*` is ignored
|
|
134
|
+
- 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-*`
|
|
135
|
+
- Dead variables are rejected: `--surface-color` `--surface-alt` `--text-dim` `--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` `--font-mermaid`
|
|
136
|
+
- Editor selectors only: `#editor .cm-content` + `.cm-md-*` (CodeMirror 6 has no `<h1>` / `<blockquote>` elements)
|
|
137
|
+
- No vertical padding on `.cm-md-blockquote` / `.cm-md-codeblock` (one div per line)
|
|
138
|
+
- No `pt` units; use `px` / `em` / `rem`
|
|
139
|
+
- No `!important` (except `print-color-adjust` in `@media print`)
|
|
140
|
+
- Export DOM styling goes on `.colamd-document` (semantic tags), not `.cm-md-*`
|
|
141
|
+
- Generated CSS ≤ 300 lines
|
|
142
|
+
- Font stacks must include CJK fallback and end with generic family
|
|
143
|
+
|
|
144
|
+
## CSS Pitfall Quick Reference
|
|
145
|
+
|
|
146
|
+
> When adjusting themes, follow these rules strictly. Reference `themes/template.css` and the upstream examples in `ColaMD-extend/resources/templates/themes/`.
|
|
147
|
+
|
|
148
|
+
### 1. Root Block
|
|
149
|
+
|
|
150
|
+
**Pitfall:** Declaring variables on `body.theme-custom`. **Correct:** `:root { ... }` — the editor inherits from the document root only.
|
|
151
|
+
|
|
152
|
+
### 2. Body Text First-Line Indent
|
|
153
|
+
|
|
154
|
+
**Pitfall:** `#write p` matches nothing. **Correct:** `#editor .cm-content .cm-line { text-indent: 2em; }`, then reset `text-indent: 0` on heading / quote / code / list / rule / mermaid lines.
|
|
155
|
+
|
|
156
|
+
### 3. Indent Exclusion
|
|
157
|
+
|
|
158
|
+
**Pitfall:** Indent leaks into quotes, code and lists because every markdown line is a `.cm-line`. **Correct:** enumerate all `.cm-md-*` line classes in the reset block (template §2.5).
|
|
159
|
+
|
|
160
|
+
### 4. List Indentation
|
|
161
|
+
|
|
162
|
+
**Pitfall:** Assuming `ul/ol/li` elements exist. **Correct:** CodeMirror marks list depth with `.cm-md-li-0` … `.cm-md-li-6` on the line; style those classes, never `li::before`.
|
|
163
|
+
|
|
164
|
+
### 5. Quote / Code Block Padding
|
|
165
|
+
|
|
166
|
+
**Pitfall:** Adding `padding: 12px 16px` to `.cm-md-blockquote`. **Correct:** only `padding-left` / `padding-right` — vertical padding is applied once per line.
|
|
167
|
+
|
|
168
|
+
### 6. Pele Diagram Colors
|
|
169
|
+
|
|
170
|
+
**Pitfall:** Writing `themeVariables` or Mermaid `classDef` in the theme. **Correct:** override `--pele-*` on `:root`; the SVG reads them at render time.
|
|
171
|
+
|
|
172
|
+
## Architecture
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Source → Extractor → ThemeStyle → Color System + Pele + Validators → CSS (2.7.7 contract)
|
|
176
|
+
|
|
177
|
+
Markdown → Puppeteer + ColaMD renderer → HTML / PDF
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
> Export runs the 1.5.x Milkdown renderer library; the npm 2.x package (`@bytechain.cn/colamd@2.7.7`) is the Electron app distribution and no longer ships `dist/lib/colamd-renderer.js` — `renderer.ts` detects a 2.x install and asks for `@^1.5.2`. Generated CSS targets 2.7.7 (verified against the published 2.7.7 package), so it carries over unchanged.
|