@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.
Files changed (100) hide show
  1. package/.claude/skills/colamd-themes-preview.skill.md +333 -0
  2. package/.claude/skills/colamd-themes.skill.md +10 -0
  3. package/.dsh/skills/colamd-themes/SKILL.md +14 -0
  4. package/.github/supported-topics.yml +17 -0
  5. package/.hermes/skills/tools/colamd-themes/SKILL.md +14 -0
  6. package/.openclaw/skills/colamd-themes/SKILL.md +1 -37
  7. package/.opencode/skills/colamd-themes/SKILL.md +17 -0
  8. package/.trae/rules/colamd-themes.md +0 -36
  9. package/CHANGELOG.md +318 -241
  10. package/DSH_SUPPORT_SUMMARY.md +87 -0
  11. package/README.md +414 -384
  12. package/README_CN.md +412 -384
  13. package/RELEASENOTE.md +541 -389
  14. package/bytechain.cn-colamd-themes-0.5.0.tgz +0 -0
  15. package/dist/cli.js +36 -55
  16. package/dist/cli.js.map +1 -1
  17. package/dist/color-utils.d.ts +1 -0
  18. package/dist/color-utils.js +25 -6
  19. package/dist/color-utils.js.map +1 -1
  20. package/dist/extractors/pdf-extractor.js +6 -1
  21. package/dist/extractors/pdf-extractor.js.map +1 -1
  22. package/dist/extractors/url-extractor.d.ts +0 -4
  23. package/dist/extractors/url-extractor.js +13 -126
  24. package/dist/extractors/url-extractor.js.map +1 -1
  25. package/dist/generator.d.ts +1 -1
  26. package/dist/generator.js +32 -11
  27. package/dist/generator.js.map +1 -1
  28. package/dist/models.d.ts +5 -4
  29. package/dist/models.js +2 -3
  30. package/dist/models.js.map +1 -1
  31. package/dist/renderer.d.ts +4 -2
  32. package/dist/renderer.js +64 -84
  33. package/dist/renderer.js.map +1 -1
  34. package/dist/templates/template.css +220 -498
  35. package/dist/templates/theme-paradigm.md +530 -658
  36. package/dist/templates/theme-template.hbs +256 -370
  37. package/dist/theme-store.js +19 -3
  38. package/dist/theme-store.js.map +1 -1
  39. package/dist/utils/document-paradigm.d.ts +12 -0
  40. package/dist/utils/document-paradigm.js +109 -0
  41. package/dist/utils/document-paradigm.js.map +1 -0
  42. package/dist/validators.d.ts +4 -1
  43. package/dist/validators.js +115 -1
  44. package/dist/validators.js.map +1 -1
  45. package/mcp-server/dist/index.d.ts +13 -0
  46. package/mcp-server/dist/index.d.ts.map +1 -0
  47. package/mcp-server/dist/index.js +0 -0
  48. package/mcp-server/dist/index.js.map +1 -0
  49. package/mcp-server/package-lock.json +1759 -0
  50. package/mcp-server/package.json +24 -0
  51. package/mcp-server/src/index.ts +0 -0
  52. package/mcp-server/tsconfig.json +19 -0
  53. package/package.json +54 -36
  54. package/skills/build-skills.sh +30 -5
  55. package/skills/colamd-themes/SKILL.md +180 -178
  56. package/src/cli.ts +474 -487
  57. package/src/color-systems.ts +289 -289
  58. package/src/color-utils.ts +137 -120
  59. package/src/contrast.ts +66 -66
  60. package/src/docx-style-paradigm.ts +811 -811
  61. package/src/export-cli.ts +356 -356
  62. package/src/extractors/base.ts +8 -8
  63. package/src/extractors/docx-extractor.ts +417 -417
  64. package/src/extractors/pdf-extractor.ts +533 -527
  65. package/src/extractors/url-extractor.ts +846 -981
  66. package/src/generator.ts +197 -169
  67. package/src/index.ts +29 -29
  68. package/src/models.ts +212 -212
  69. package/src/renderer.ts +332 -359
  70. package/src/templates/template.css +220 -498
  71. package/src/templates/theme-paradigm.md +530 -658
  72. package/src/templates/theme-template.hbs +256 -370
  73. package/src/theme-store.ts +185 -170
  74. package/src/types/pdf-parse.d.ts +12 -12
  75. package/src/utils/cli-utils.ts +84 -84
  76. package/src/utils/document-paradigm.ts +118 -0
  77. package/src/validators.ts +298 -176
  78. package/themes/academic-paper-pt.css +353 -1805
  79. package/themes/academic-paper.css +350 -1099
  80. package/themes/academic-style.css +342 -2430
  81. package/themes/colly.css +256 -370
  82. package/themes/elegant.css +288 -671
  83. package/themes/forest-ink.css +240 -664
  84. package/themes/guizang.css +250 -732
  85. package/themes/hermes-security.css +279 -0
  86. package/themes/meeting-minutes.css +256 -370
  87. package/themes/pixso-design.css +278 -1261
  88. package/themes/salvator-blog.css +256 -370
  89. package/themes/shimo-theme.css +256 -0
  90. package/themes/swiss-design.css +285 -746
  91. package/themes/template.css +220 -498
  92. package/themes/trae-blue.css +280 -737
  93. package/themes/word-contract.css +249 -0
  94. package/themes-preview/demo-content.md +187 -187
  95. package/tsconfig.json +18 -18
  96. package/src/mermaid-presets.ts +0 -142
  97. package/themes/swiss-design copy.css +0 -746
  98. package/themes-preview/colly-preview.html +0 -623
  99. package/themes-preview/meeting-minutes-preview.html +0 -625
  100. package/themes-preview/salvator-blog-preview.html +0 -623
@@ -0,0 +1,333 @@
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
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: colamd-themes
3
+ description: >
4
+ Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
5
+ Extract formatting from URLs, DOCX, or PDF sources; export Markdown to
6
+ standalone HTML/PDF with themes applied; batch export; manage theme
7
+ configuration.
8
+ ---
9
+
10
+
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: colamd-themes
3
+ version: "1.0.0"
4
+ description: >
5
+ Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
6
+ Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
7
+ metadata:
8
+ dsh:
9
+ tags: [colamd, themes, css, markdown, export, pdf, html]
10
+ prerequisites:
11
+ commands: [node, npm]
12
+ ---
13
+
14
+
@@ -0,0 +1,17 @@
1
+ # GitHub Topics 支持列表
2
+ # 此文件帮助 GitHub 在仓库设置页面自动建议相关 topics
3
+ # 添加后需在 GitHub 仓库 Settings > General > Topics 中手动确认保存
4
+ - dsh
5
+ - deepseek-harness
6
+ - colamd
7
+ - themes
8
+ - css
9
+ - markdown
10
+ - pdf
11
+ - html
12
+ - skill
13
+ - ai-agent
14
+ - agent-skill
15
+ - theme-generator
16
+ - markdown-export
17
+ - colamd-themes
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: colamd-themes
3
+ description: "Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes."
4
+ version: 1.0.0
5
+ author: bytechain
6
+ license: MIT
7
+ metadata:
8
+ hermes:
9
+ tags: [colamd, themes, css, markdown, export, pdf, html]
10
+ prerequisites:
11
+ commands: [node, npm]
12
+ ---
13
+
14
+
@@ -2,7 +2,7 @@
2
2
  id: colamd-themes
3
3
  name: ColaMD Themes
4
4
  description: >
5
- Generate, validate, export, and manage ColaMD v3.0 paradigm CSS themes.
5
+ Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
6
6
  Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
7
7
  version: "1.0.0"
8
8
  icon: "\U0001F3A8"
@@ -18,40 +18,4 @@ metadata:
18
18
  bins: [node, npm]
19
19
  ---
20
20
 
21
- ## CSS Pitfall Quick Reference
22
21
 
23
- > When adjusting themes, follow these rules strictly. For each step, reference the corresponding pattern in `academic-paper.css`.
24
-
25
- ### 1. Screen & Print Must Stay in Sync
26
-
27
- Every rule in SECTION 5 must have a mirror copy in SECTION 6 `@media print`. Reference the `SECTION 5 / SECTION 6` correspondence in `academic-paper.css`.
28
-
29
- ### 2. Body Text First-Line Indent
30
-
31
- **Pitfall:** `#write p` does not match. **Correct:** Reference `academic-paper.css` §5.3 directly — use `body.theme-custom p, body.theme-custom #write > p`, with `margin: 0` set beforehand.
32
-
33
- ### 3. Indent Exclusion (Do Not Pollute Lists / Tables / Diagrams)
34
-
35
- **Pitfall:** The `p` selector hits paragraphs inside all nested containers. **Correct:** Reference the exclusion block below `swiss-design.css` §5.2.1 — apply `text-indent: 0` uniformly to `li / li p / td p / th p / blockquote p / .mermaid-block p / figure p / pre p`.
36
-
37
- ### 4. List Indentation (Hardest Pitfall)
38
-
39
- **Pitfall:** `padding-left` does not move the bullet/number; missing the `#editor .ProseMirror` editor selector; missing `li::before` and `li > p` inline conversion.
40
-
41
- **Correct:** Reference `academic-paper.css` §5.7 directly — copy its full selector structure (`#editor .ProseMirror > ul/ol` + `#write > ul/ol:first-of-type` + `li::before` + `#editor .ProseMirror li > p`). Use `margin-left: 2em` for indentation instead of `padding-left`. For Swiss style, keep `list-style-position: outside` and do NOT change to `none`.
42
-
43
- ### 5. Mermaid CJK Text Overflow
44
-
45
- **Pitfall:** Multi-line `<br/>` nodes have incorrect width/height calculations. **Correct:** ≤ 2 lines per node + `fontSize: 14px` + simplify text (use `·` instead of `/`, remove redundant modifiers).
46
-
47
- ### 6. Mermaid classDef Does Not Inherit themeVariables
48
-
49
- **Pitfall:** Assuming `themeVariables` sets text color so you don't need to repeat it. **Correct:** `classDef` must explicitly declare all three properties: `fill / color / stroke`.
50
-
51
- ## Architecture
52
-
53
- ```
54
- Source → Extractor → ThemeStyle → Color System + Mermaid Preset + Validators → CSS
55
-
56
- Markdown → Puppeteer + ColaMD Renderer → HTML / PDF
57
- ```
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: colamd-themes
3
+ version: "1.0.0"
4
+ description: >
5
+ Generate, validate, export, and manage ColaMD 2.7.7 contract CSS themes.
6
+ Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
7
+ user-invocable: true
8
+ allowed-tools:
9
+ - Read
10
+ - Write
11
+ - Edit
12
+ - Bash
13
+ - Glob
14
+ - Grep
15
+ ---
16
+
17
+
@@ -2,40 +2,4 @@
2
2
 
3
3
  When the user asks to create, validate, export, or manage ColaMD themes, use the following CLI tool:
4
4
 
5
- ## CSS Pitfall Quick Reference
6
5
 
7
- > When adjusting themes, follow these rules strictly. For each step, reference the corresponding pattern in `academic-paper.css`.
8
-
9
- ### 1. Screen & Print Must Stay in Sync
10
-
11
- Every rule in SECTION 5 must have a mirror copy in SECTION 6 `@media print`. Reference the `SECTION 5 / SECTION 6` correspondence in `academic-paper.css`.
12
-
13
- ### 2. Body Text First-Line Indent
14
-
15
- **Pitfall:** `#write p` does not match. **Correct:** Reference `academic-paper.css` §5.3 directly — use `body.theme-custom p, body.theme-custom #write > p`, with `margin: 0` set beforehand.
16
-
17
- ### 3. Indent Exclusion (Do Not Pollute Lists / Tables / Diagrams)
18
-
19
- **Pitfall:** The `p` selector hits paragraphs inside all nested containers. **Correct:** Reference the exclusion block below `swiss-design.css` §5.2.1 — apply `text-indent: 0` uniformly to `li / li p / td p / th p / blockquote p / .mermaid-block p / figure p / pre p`.
20
-
21
- ### 4. List Indentation (Hardest Pitfall)
22
-
23
- **Pitfall:** `padding-left` does not move the bullet/number; missing the `#editor .ProseMirror` editor selector; missing `li::before` and `li > p` inline conversion.
24
-
25
- **Correct:** Reference `academic-paper.css` §5.7 directly — copy its full selector structure (`#editor .ProseMirror > ul/ol` + `#write > ul/ol:first-of-type` + `li::before` + `#editor .ProseMirror li > p`). Use `margin-left: 2em` for indentation instead of `padding-left`. For Swiss style, keep `list-style-position: outside` and do NOT change to `none`.
26
-
27
- ### 5. Mermaid CJK Text Overflow
28
-
29
- **Pitfall:** Multi-line `<br/>` nodes have incorrect width/height calculations. **Correct:** ≤ 2 lines per node + `fontSize: 14px` + simplify text (use `·` instead of `/`, remove redundant modifiers).
30
-
31
- ### 6. Mermaid classDef Does Not Inherit themeVariables
32
-
33
- **Pitfall:** Assuming `themeVariables` sets text color so you don't need to repeat it. **Correct:** `classDef` must explicitly declare all three properties: `fill / color / stroke`.
34
-
35
- ## Architecture
36
-
37
- ```
38
- Source → Extractor → ThemeStyle → Color System + Mermaid Preset + Validators → CSS
39
-
40
- Markdown → Puppeteer + ColaMD Renderer → HTML / PDF
41
- ```