vscode-colaview 0.4.5 → 0.4.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.4.7] - 2026-12-06
6
+
7
+ ### Added
8
+ - **Four new slide layouts** — `chapter` (section divider), `statement` (big-claim page), `stat` (single hero number) and `table` (full-width table page) now have dedicated slide layouts. They use the same `<!-- slide: layout -->` directives as the existing layouts and are covered in preview, fullscreen presenting and the slide PDF.
9
+
10
+ ### Changed
11
+ - **Theme collection** — the custom-theme guidance now covers the 58 contract themes from ColaMD-themes.
12
+
13
+ ### Fixed
14
+ - **PPTX exports keep the theme accent color** — themes that reference their palette through a color variable (as the ColaMD-themes contract themes do) exported PowerPoint decks with a built-in fallback color instead of the theme accent. The deck now carries the same accent the preview shows.
15
+ - **Table slide pages stretch to the full slide width** in fullscreen presenting and the slide PDF, matching the on-screen preview.
16
+
17
+ ## [0.4.6] - 2026-12-05
18
+
19
+ ### Fixed
20
+ - **README images on npm** — badges and theme thumbnails used relative paths that the npm package page cannot resolve, so every image was broken. They now use absolute URLs and render on npm, GitHub and the Marketplace page.
21
+
22
+ ### Changed
23
+ - **Version badge** — updated to 0.4.6.
24
+ - **Documentation links** — README file links now point to the repository instead of missing files on the npm page.
25
+
5
26
  ## [0.4.5] - 2026-12-05
6
27
 
7
28
  ### Added
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # ColaView MD
2
2
 
3
- [English](README.md) · [中文](README_CN.md)
3
+ [English](https://github.com/byteuser1977/vscode-colaview/blob/develop/README.md) · [中文](https://github.com/byteuser1977/vscode-colaview/blob/develop/README_CN.md)
4
4
 
5
- [![Star on GitHub](assets/badges/star.png)](https://github.com/byteuser1977/vscode-colaview/stargazers)
6
-
7
- [![VS Code](assets/badges/vscode.png)](https://code.visualstudio.com/)
8
- [![TypeScript](assets/badges/typescript.png)](https://www.typescriptlang.org/)
9
- [![License](assets/badges/license.png)](LICENSE)
10
- [![Version](assets/badges/version.png)](package.json)
5
+ [![Star on GitHub](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/star.png)](https://github.com/byteuser1977/vscode-colaview/stargazers)
6
+
7
+ [![VS Code](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/vscode.png)](https://code.visualstudio.com/)
8
+ [![TypeScript](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/typescript.png)](https://www.typescriptlang.org/)
9
+ [![License](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/license.png)](https://github.com/byteuser1977/vscode-colaview/blob/develop/LICENSE)
10
+ [![Version](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/version.png)](https://github.com/byteuser1977/vscode-colaview/blob/develop/package.json)
11
11
 
12
12
  > Rich Markdown preview · slide presenting · **HTML / A4 PDF / 16:9 slide PDF / Word / PPTX** export — one theme across preview and paper.
13
13
 
@@ -17,7 +17,7 @@ Rich Markdown preview & export for VS Code — powered by the [ColaMD](https://g
17
17
 
18
18
  ## Install & First Use
19
19
 
20
- 1. **Install** — search **ColaView MD** (ID `bytechain.vscode-colaview`) in the VS Code Marketplace, or [install from the Marketplace page](https://marketplace.visualstudio.com/items?itemName=bytechain.vscode-colaview); a `.vsix` can be installed with `code --install-extension vscode-colaview-0.4.5.vsix`.
20
+ 1. **Install** — search **ColaView MD** (ID `bytechain.vscode-colaview`) in the VS Code Marketplace, or [install from the Marketplace page](https://marketplace.visualstudio.com/items?itemName=bytechain.vscode-colaview); a `.vsix` can be installed with `code --install-extension vscode-colaview-0.4.7.vsix`.
21
21
  2. **Open a document** — open any `.md` file in VS Code.
22
22
  3. **Open the preview** — press `Ctrl+Alt+V` (macOS `Cmd+Alt+V`) or run **“Markdown Preview”** from the Command Palette; `Ctrl+Alt+S` switches to the **slides preview**.
23
23
  4. **Pick a theme** — right-click inside the preview → **Theme**, grouped into Built-in · Light / Built-in · Dark / Custom; import any `.css` as a custom theme.
@@ -33,11 +33,11 @@ Every thumbnail below is a **real export** of the same document rendered with th
33
33
 
34
34
  | Elegant | Dark | Sepia | Notion |
35
35
  |:--:|:--:|:--:|:--:|
36
- | ![elegant](assets/gallery/builtin-elegant.png) | ![dark](assets/gallery/builtin-dark.png) | ![sepia](assets/gallery/builtin-sepia.png) | ![notion](assets/gallery/builtin-notion.png) |
36
+ | ![elegant](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-elegant.png) | ![dark](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-dark.png) | ![sepia](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-sepia.png) | ![notion](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-notion.png) |
37
37
 
38
38
  | Academic Paper | Forest Ink | Pink Script Dark | Swiss Design |
39
39
  |:--:|:--:|:--:|:--:|
40
- | ![academic-paper](assets/gallery/academic-paper.png) | ![forest-ink](assets/gallery/forest-ink.png) | ![pink-script-dark](assets/gallery/pink-script-dark.png) | ![swiss-design](assets/gallery/swiss-design.png) |
40
+ | ![academic-paper](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/academic-paper.png) | ![forest-ink](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/forest-ink.png) | ![pink-script-dark](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/pink-script-dark.png) | ![swiss-design](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/swiss-design.png) |
41
41
 
42
42
  <sub>More themes live in [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes) (57 contract themes + 12 built-in themes); drop any `.css` into your workspace `.themes/` folder and it appears in the extension.</sub>
43
43
 
@@ -123,7 +123,7 @@ The Theme ▸ submenu is grouped into Built-in · Light / Built-in · Dark / Cus
123
123
 
124
124
  ### Custom Themes
125
125
 
126
- Place `.css` files in the `.themes/` directory at your workspace root and they are picked up automatically. The 57 contract themes from [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes) work as-is (copy any `.css` from its `themes/` folder). Examples:
126
+ Place `.css` files in the `.themes/` directory at your workspace root and they are picked up automatically. The 58 contract themes from [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes) work as-is (copy any `.css` from its `themes/` folder). Examples:
127
127
 
128
128
  | Theme | Style | Best For |
129
129
  |-------|-------|----------|
@@ -131,7 +131,8 @@ Place `.css` files in the `.themes/` directory at your workspace root and they a
131
131
  | **Forest Ink** | Deep greens, editorial-magazine mood | Nature, brand stories, long reads |
132
132
  | **Pink Script Dark** | Dark canvas + pink script titles, magazine slides | Sharing, launches, creative decks |
133
133
  | **Swiss Design** | Grid, whitespace, high-contrast sans system | Reports, products, data storytelling |
134
- | **Trae Blue** | Trae IDE documentation style, white + Slate gray, blue accents | Technical docs, modern documentation |
134
+ | **Trae Blue** | Trae IDE documentation style, white + Slate gray, blue accents | Technical docs, modern documentation |
135
+ | **Dashi Theme01 Replica** | Soft neumorphic light deck, gradient paper, white rounded cards, capsule kickers | Product launches, brand storytelling, slide decks |
135
136
 
136
137
  ```
137
138
  my-project/
@@ -239,7 +240,7 @@ src/
239
240
  ## Development
240
241
 
241
242
  ```bash
242
- git clone https://github.com/bytechain/vscode-colaview.git
243
+ git clone https://github.com/byteuser1977/vscode-colaview.git
243
244
  cd vscode-colaview
244
245
  npm install
245
246
 
@@ -259,20 +260,20 @@ npm run package
259
260
 
260
261
  The project uses **esbuild** for bundling — the extension side (`out/extension.js`) is a small CJS bundle with only VS Code API imports. The WebView side (`out/preview/webview/app.js`) is an IIFE bundle containing the full ColaMD 2.8.2 rendering engine (CodeMirror 6 + Mermaid + KaTeX) — approximately 3.5MB unminified, gzip ~400KB. Resource files (CSS, WebView HTML, KaTeX stylesheet, Mermaid script) are copied to `out/` during build so they survive `.vscodeignore` packaging.
261
262
 
262
- ## Contributing & Support
263
-
264
- - **Star the repo** — [byteuser1977/vscode-colaview](https://github.com/byteuser1977/vscode-colaview) (use the Star button to follow updates)
265
- - **Official site** — [colamd.com](https://colamd.com/); theme and export tooling lives in [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes)
266
- - **Desktop editor** — [ColaMD-extend](https://github.com/byteuser1977/ColaMD-extend): the cross-platform Markdown editor sharing the same theme and rendering contracts
267
- - **Feedback** — [Issues](https://github.com/byteuser1977/vscode-colaview/issues); themes, export styling and slide-layout suggestions are welcome
268
-
269
- ## Version & Release Notes
270
-
271
- - Current: **v0.4.5** — GitHub Star entry in the README; slide styling aligned with the reference deck across preview, presenting and PDF
272
- - Full changelog: [CHANGELOG.md](CHANGELOG.md)
273
- - Release highlights: [RELEASE_NOTES.md](RELEASE_NOTES.md)
274
-
263
+ ## Contributing & Support
264
+
265
+ - **Star the repo** — [byteuser1977/vscode-colaview](https://github.com/byteuser1977/vscode-colaview) (use the Star button to follow updates)
266
+ - **Official site** — [colamd.com](https://colamd.com/); theme and export tooling lives in [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes)
267
+ - **Desktop editor** — [ColaMD-extend](https://github.com/byteuser1977/ColaMD-extend): the cross-platform Markdown editor sharing the same theme and rendering contracts
268
+ - **Feedback** — [Issues](https://github.com/byteuser1977/vscode-colaview/issues); themes, export styling and slide-layout suggestions are welcome
269
+
270
+ ## Version & Release Notes
271
+
272
+ - Current: **v0.4.7** — four new slide layouts (chapter / statement / stat / table) and consistent slide exports
273
+ - Full changelog: [CHANGELOG.md](https://github.com/byteuser1977/vscode-colaview/blob/develop/CHANGELOG.md)
274
+ - Release highlights: [RELEASE_NOTES.md](https://github.com/byteuser1977/vscode-colaview/blob/develop/RELEASE_NOTES.md)
275
+
275
276
  ## License
276
277
 
277
- [MIT](LICENSE)
278
+ [MIT](https://github.com/byteuser1977/vscode-colaview/blob/develop/LICENSE)
278
279
 
package/README_CN.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # ColaView MD
2
2
 
3
- [English](README.md) · [中文](README_CN.md)
3
+ [English](https://github.com/byteuser1977/vscode-colaview/blob/develop/README.md) · [中文](https://github.com/byteuser1977/vscode-colaview/blob/develop/README_CN.md)
4
4
 
5
- [![Star on GitHub](assets/badges/star.png)](https://github.com/byteuser1977/vscode-colaview/stargazers)
6
-
7
- [![VS Code](assets/badges/vscode.png)](https://code.visualstudio.com/)
8
- [![TypeScript](assets/badges/typescript.png)](https://www.typescriptlang.org/)
9
- [![License](assets/badges/license.png)](LICENSE)
10
- [![Version](assets/badges/version.png)](package.json)
5
+ [![Star on GitHub](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/star.png)](https://github.com/byteuser1977/vscode-colaview/stargazers)
6
+
7
+ [![VS Code](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/vscode.png)](https://code.visualstudio.com/)
8
+ [![TypeScript](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/typescript.png)](https://www.typescriptlang.org/)
9
+ [![License](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/license.png)](https://github.com/byteuser1977/vscode-colaview/blob/develop/LICENSE)
10
+ [![Version](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/badges/version.png)](https://github.com/byteuser1977/vscode-colaview/blob/develop/package.json)
11
11
 
12
12
  > 富文本 Markdown 预览 · 幻灯片放映 · **HTML / A4 PDF / 16:9 幻灯片 PDF / Word / PPTX** 导出,一套主题贯穿预览与纸面。
13
13
 
@@ -17,7 +17,7 @@ VS Code 富文本 Markdown 预览与导出扩展 — 基于 [ColaMD](https://git
17
17
 
18
18
  ## 安装与首次使用
19
19
 
20
- 1. **安装扩展** — 在 VS Code 扩展市场搜索 **ColaView MD**(ID `bytechain.vscode-colaview`),或[从市场页安装](https://marketplace.visualstudio.com/items?itemName=bytechain.vscode-colaview);也可下载 `.vsix` 后执行 `code --install-extension vscode-colaview-0.4.5.vsix`。
20
+ 1. **安装扩展** — 在 VS Code 扩展市场搜索 **ColaView MD**(ID `bytechain.vscode-colaview`),或[从市场页安装](https://marketplace.visualstudio.com/items?itemName=bytechain.vscode-colaview);也可下载 `.vsix` 后执行 `code --install-extension vscode-colaview-0.4.7.vsix`。
21
21
  2. **打开文档** — 在 VS Code 中打开任意 `.md` 文件。
22
22
  3. **打开预览** — 按 `Ctrl+Alt+V`(macOS `Cmd+Alt+V`),或命令面板运行 **「MD-预览」**;按 `Ctrl+Alt+S` 切换到 **幻灯片预览**。
23
23
  4. **换主题** — 预览面板内右键 → **主题**,按「内置 · 亮色 / 内置 · 暗色 / 自定义」分组选择;也可导入 `.css` 自定义主题。
@@ -33,11 +33,11 @@ VS Code 富文本 Markdown 预览与导出扩展 — 基于 [ColaMD](https://git
33
33
 
34
34
  | Elegant | Dark | Sepia | Notion |
35
35
  |:--:|:--:|:--:|:--:|
36
- | ![elegant](assets/gallery/builtin-elegant.png) | ![dark](assets/gallery/builtin-dark.png) | ![sepia](assets/gallery/builtin-sepia.png) | ![notion](assets/gallery/builtin-notion.png) |
36
+ | ![elegant](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-elegant.png) | ![dark](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-dark.png) | ![sepia](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-sepia.png) | ![notion](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/builtin-notion.png) |
37
37
 
38
38
  | Academic Paper | Forest Ink | Pink Script Dark | Swiss Design |
39
39
  |:--:|:--:|:--:|:--:|
40
- | ![academic-paper](assets/gallery/academic-paper.png) | ![forest-ink](assets/gallery/forest-ink.png) | ![pink-script-dark](assets/gallery/pink-script-dark.png) | ![swiss-design](assets/gallery/swiss-design.png) |
40
+ | ![academic-paper](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/academic-paper.png) | ![forest-ink](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/forest-ink.png) | ![pink-script-dark](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/pink-script-dark.png) | ![swiss-design](https://raw.githubusercontent.com/byteuser1977/vscode-colaview/develop/assets/gallery/swiss-design.png) |
41
41
 
42
42
  <sub>更多主题可在 [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes) 获取(57 套范式主题 + 12 套内置主题),把 `.css` 放进工作区 `.themes/` 即可在扩展中直接使用。</sub>
43
43
 
@@ -123,7 +123,7 @@ Theme ▸ 子菜单按「内置 · 亮色 / 内置 · 暗色 / 自定义」分
123
123
 
124
124
  ### 自定义主题
125
125
 
126
- 在工作区根目录的 `.themes/` 目录下放置 `.css` 文件即可自动识别。可直接使用 [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes) 的 57 套范式主题(从仓库 `themes/` 复制 `.css` 到 `.themes/`),例如:
126
+ 在工作区根目录的 `.themes/` 目录下放置 `.css` 文件即可自动识别。可直接使用 [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes) 的 58 套范式主题(从仓库 `themes/` 复制 `.css` 到 `.themes/`),例如:
127
127
 
128
128
  | 主题 | 风格 | 适用场景 |
129
129
  |------|------|----------|
@@ -131,7 +131,8 @@ Theme ▸ 子菜单按「内置 · 亮色 / 内置 · 暗色 / 自定义」分
131
131
  | **Forest Ink(森林墨)** | 深浅绿意、编辑画册气质 | 自然、品牌与长文阅读 |
132
132
  | **Pink Script Dark** | 深色底 + 粉色手写感标题,杂志风幻灯片 | 分享、发布会、创意演示 |
133
133
  | **Swiss Design(瑞士国际主义)** | 网格、留白、强对比的无衬线体系 | 报告、产品与数据展示 |
134
- | **Trae Blue** | Trae IDE 文档风格,白底 slate 灰字,蓝色点缀 | 技术文档、现代文档编写 |
134
+ | **Trae Blue** | Trae IDE 文档风格,白底 slate 灰字,蓝色点缀 | 技术文档、现代文档编写 |
135
+ | **Dashi Theme01 Replica(轻拟态复刻)** | 柔彩渐变纸面、白色拟态圆角卡、胶囊 kicker 的轻拟态风 | 产品发布、品牌叙事、幻灯片演示 |
135
136
 
136
137
  ```
137
138
  my-project/
@@ -239,7 +240,7 @@ src/
239
240
  ## 开发
240
241
 
241
242
  ```bash
242
- git clone https://github.com/bytechain/vscode-colaview.git
243
+ git clone https://github.com/byteuser1977/vscode-colaview.git
243
244
  cd vscode-colaview
244
245
  npm install
245
246
 
@@ -259,20 +260,20 @@ npm run package
259
260
 
260
261
  项目使用 **esbuild** 打包 — 扩展端(`out/extension.js`)是一个仅依赖 VS Code API 的小型 CJS bundle。WebView 端(`out/preview/webview/app.js`)是包含完整 ColaMD 2.8.2 渲染引擎(CodeMirror 6 + Mermaid + KaTeX)的 IIFE bundle — 未压缩约 3.5MB,gzip 后约 400KB。构建时自动复制资源文件(CSS、WebView HTML、KaTeX 样式表、Mermaid 脚本)到 `out/` 目录,确保打包安装后功能正常。
261
262
 
262
- ## 参与与支持
263
-
264
- - **Star 仓库** — [byteuser1977/vscode-colaview](https://github.com/byteuser1977/vscode-colaview)(右上角 Star,方便第一时间获取更新)
265
- - **官方网站** — [colamd.com](https://colamd.com/);主题与导出工具链见 [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes)
266
- - **桌面版** — [ColaMD-extend](https://github.com/byteuser1977/ColaMD-extend):同一套主题与渲染契约的跨平台 Markdown 编辑器
267
- - **问题反馈** — [Issues](https://github.com/byteuser1977/vscode-colaview/issues);欢迎提交主题、导出样式与幻灯片版式的改进建议
268
-
269
- ## 版本与更新记录
270
-
271
- - 当前版本:**v0.4.5** — README 顶部新增 GitHub Star 入口;预览 / 放映 / 导出统一套用主题幻灯片样式,与参照稿对齐
272
- - 完整变更:[CHANGELOG.md](CHANGELOG.md)
273
- - 版本亮点:[RELEASE_NOTES.md](RELEASE_NOTES.md)
274
-
263
+ ## 参与与支持
264
+
265
+ - **Star 仓库** — [byteuser1977/vscode-colaview](https://github.com/byteuser1977/vscode-colaview)(右上角 Star,方便第一时间获取更新)
266
+ - **官方网站** — [colamd.com](https://colamd.com/);主题与导出工具链见 [ColaMD-themes](https://github.com/byteuser1977/ColaMD-themes)
267
+ - **桌面版** — [ColaMD-extend](https://github.com/byteuser1977/ColaMD-extend):同一套主题与渲染契约的跨平台 Markdown 编辑器
268
+ - **问题反馈** — [Issues](https://github.com/byteuser1977/vscode-colaview/issues);欢迎提交主题、导出样式与幻灯片版式的改进建议
269
+
270
+ ## 版本与更新记录
271
+
272
+ - 当前版本:**v0.4.7** — 新增 chapter / statement / stat / table 四种幻灯片版式,幻灯片导出全面一致
273
+ - 完整变更:[CHANGELOG.md](https://github.com/byteuser1977/vscode-colaview/blob/develop/CHANGELOG.md)
274
+ - 版本亮点:[RELEASE_NOTES.md](https://github.com/byteuser1977/vscode-colaview/blob/develop/RELEASE_NOTES.md)
275
+
275
276
  ## 许可证
276
277
 
277
- [MIT](LICENSE)
278
+ [MIT](https://github.com/byteuser1977/vscode-colaview/blob/develop/LICENSE)
278
279
 
package/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Release Notes
2
2
 
3
+ ## v0.4.7 (2026-12-06)
4
+
5
+ ### 🆕 Four New Slide Layouts
6
+
7
+ Slide decks gain four dedicated layouts alongside the existing cover, section, agenda, KPI and quote pages — declared the same way, with a page directive:
8
+
9
+ - `<!-- slide: chapter -->` — a full-width section divider for the title only;
10
+ - `<!-- slide: statement -->` — a big-claim page for a single sentence;
11
+ - `<!-- slide: stat -->` — one hero number, centred with a thin rule above;
12
+ - `<!-- slide: table -->` — the table becomes the page: it stretches across the slide, the header row is highlighted and alternating rows get a subtle tint.
13
+
14
+ All four render identically in the slide preview, in fullscreen presenting and in the slide PDF.
15
+
16
+ ### 🎨 PPTX Keeps the Theme Accent Color
17
+
18
+ PowerPoint exports used a built-in fallback color for themes that reference their palette through a color variable — as the ColaMD-themes contract themes do. Exported decks now carry the same accent color the preview shows, with the theme's body font.
19
+
20
+ ## v0.4.6 (2026-12-05)
21
+
22
+ ### 🖼️ README Images Now Render on npm
23
+
24
+ The npm package page showed every badge and theme thumbnail as a broken image, because the README referenced them by relative paths that npm cannot resolve.
25
+
26
+ - all badges and theme thumbnails now use absolute URLs, so they display on npm, GitHub and the Marketplace page;
27
+ - the Version badge is updated to 0.4.6;
28
+ - documentation links in the README now open the repository files instead of missing pages on npm.
29
+
3
30
  ## v0.4.5 (2026-12-05)
4
31
 
5
32
  ### ⭐ Star the Project from the README
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vscode-colaview",
3
3
  "displayName": "ColaView MD",
4
- "version": "0.4.5",
4
+ "version": "0.4.7",
5
5
  "publisher": "bytechain",
6
6
  "description": "ColaMD Preview — Rich Markdown Preview & PDF/HTML Export for VSCode",
7
7
  "icon": "icon.png",
@@ -1,187 +1,187 @@
1
- // 本地相对图片解析 — 文档预览 / 幻灯片 / 全屏放映 / 导出共用。
2
- //
3
- // Markdown 里的图片通常写成相对路径(`![](./images/example.png)`),但预览
4
- // WebView 与导出的独立 HTML 都没有「文档所在目录」这一上下文:相对路径会按
5
- // 页面地址解析,图片加载失败后引擎会把源码 `![alt](path)` 原样显示出来。
6
- // 这里把本地图片内联成 data URL,一次解析、四处通用(与 ColaMD-themes 的
7
- // `dsh-assets.ts` 同一条思路)。
8
- import * as fs from 'fs/promises';
9
- import * as path from 'path';
10
- import { fileURLToPath } from 'url';
11
-
12
- /** 单张图片上限;超过时保留原 src,交给浏览器按原路径处理。 */
13
- const MAX_ASSET_BYTES = 24 * 1024 * 1024;
14
- /** 进程内缓存:同一文件在 mtime/size 不变时复用 data URL。 */
15
- const assetCache = new Map<string, { stamp: string; dataUrl: string }>();
16
- const ASSET_CACHE_LIMIT = 64;
17
-
18
- const MIME_BY_EXT: Record<string, string> = {
19
- '.png': 'image/png',
20
- '.jpg': 'image/jpeg',
21
- '.jpeg': 'image/jpeg',
22
- '.gif': 'image/gif',
23
- '.webp': 'image/webp',
24
- '.svg': 'image/svg+xml',
25
- '.bmp': 'image/bmp',
26
- '.avif': 'image/avif',
27
- '.ico': 'image/x-icon',
28
- };
29
-
30
- /** `D:\…` 这类 Windows 盘符不是 URL 协议。 */
31
- function hasScheme(raw: string): boolean {
32
- return /^[a-z][a-z0-9+.-]*:/i.test(raw) && !/^[a-z]:[\\/]/i.test(raw);
33
- }
34
-
35
- /** 逐段解码,坏转义保留原样。 */
36
- function decodeSegments(raw: string): string {
37
- return raw
38
- .split('/')
39
- .map((segment) => {
40
- try {
41
- return decodeURIComponent(segment);
42
- } catch {
43
- return segment;
44
- }
45
- })
46
- .join('/');
47
- }
48
-
49
- function mimeFor(file: string): string | undefined {
50
- return MIME_BY_EXT[path.extname(file).toLowerCase()];
51
- }
52
-
53
- async function dataUrlFor(file: string): Promise<string | undefined> {
54
- try {
55
- const info = await fs.stat(file);
56
- if (!info.isFile() || info.size === 0 || info.size > MAX_ASSET_BYTES) return undefined;
57
- const stamp = `${info.size}:${info.mtimeMs}`;
58
- const hit = assetCache.get(file);
59
- if (hit !== undefined && hit.stamp === stamp) return hit.dataUrl;
60
- const bytes = await fs.readFile(file);
61
- const mime = mimeFor(file);
62
- if (mime === undefined) return undefined;
63
- const dataUrl = `data:${mime};base64,${bytes.toString('base64')}`;
64
- if (assetCache.size >= ASSET_CACHE_LIMIT) {
65
- const oldest = assetCache.keys().next();
66
- if (oldest.done !== true) assetCache.delete(oldest.value);
67
- }
68
- assetCache.set(file, { stamp, dataUrl });
69
- return dataUrl;
70
- } catch {
71
- return undefined;
72
- }
73
- }
74
-
75
- /**
76
- * 解析单个图片地址:远程地址保持原样,本地文件转 data URL。
77
- * 解析失败或超限时返回原值,不影响页面其它内容。
78
- */
79
- export async function resolveLocalImage(src: string, baseDir: string): Promise<string> {
80
- const value = src.trim();
81
- if (value === '' || value.startsWith('#')) return src;
82
- if (/^(?:data:|blob:|https?:\/\/|\/\/)/i.test(value)) return src;
83
- if (/^file:/i.test(value)) {
84
- let filePath: string;
85
- try {
86
- filePath = fileURLToPath(value);
87
- } catch {
88
- return src;
89
- }
90
- return (await dataUrlFor(filePath)) ?? src;
91
- }
92
- // 其它协议(vscode-webview、mailto…)不动;Windows 盘符除外。
93
- if (hasScheme(value)) return src;
94
-
95
- const decoded = decodeSegments(value).replace(/&amp;/g, '&');
96
- const target = path.isAbsolute(decoded) ? decoded : path.resolve(baseDir, decoded);
97
- return (await dataUrlFor(target)) ?? src;
98
- }
99
-
100
- /** 把 HTML 里的 `<img src="…">` 按文档目录解析为 data URL。 */
101
- export async function inlineHtmlImages(html: string, baseDir: string): Promise<string> {
102
- if (baseDir === '') return html;
103
- const pattern = /(<img\b[^>]*?\bsrc\s*=\s*)("([^"]*)"|'([^']*)'|([^\s>]+))/gi;
104
- let cursor = 0;
105
- let result = '';
106
- for (const match of html.matchAll(pattern)) {
107
- const quoted = match[3] ?? match[4];
108
- const raw = quoted ?? match[5] ?? '';
109
- const resolved = await resolveLocalImage(raw, baseDir);
110
- if (resolved === raw) continue;
111
- const quote = match[3] !== undefined ? '"' : match[4] !== undefined ? "'" : '';
112
- result += html.slice(cursor, (match.index ?? 0) + match[1].length);
113
- result += quote + resolved + quote;
114
- cursor = (match.index ?? 0) + match[0].length;
115
- }
116
- return cursor === 0 ? html : result + html.slice(cursor);
117
- }
118
-
119
- /** 行内代码用占位符保护,避免把 `` `![x](y)` `` 里的示例路径也替换掉。 */
120
- async function rewriteLineImages(line: string, baseDir: string): Promise<string> {
121
- const parts = line.split(/(`+[^`]*`+)/g);
122
- for (let i = 0; i < parts.length; i += 2) {
123
- const part = parts[i] ?? '';
124
- parts[i] = await rewriteImageSyntax(part, baseDir);
125
- }
126
- return parts.join('');
127
- }
128
-
129
- const MARKDOWN_IMAGE = /(!\[[^\]]*\]\()\s*(<[^>]*>|[^)\s]+)(\s+"[^"]*")?(\))/g;
130
- const HTML_IMAGE = /(<img\b[^>]*?\bsrc\s*=\s*)(["'])([^"']+)\2/gi;
131
-
132
- async function rewriteImageSyntax(text: string, baseDir: string): Promise<string> {
133
- let out = text;
134
- const mdMatches = [...out.matchAll(MARKDOWN_IMAGE)];
135
- if (mdMatches.length > 0) {
136
- let cursor = 0;
137
- let result = '';
138
- for (const match of mdMatches) {
139
- const raw = (match[2] ?? '').replace(/^<|>$/g, '');
140
- const resolved = await resolveLocalImage(raw, baseDir);
141
- result += out.slice(cursor, match.index);
142
- result += `${match[1] ?? ''}${resolved}${match[3] ?? ''}${match[4] ?? ''}`;
143
- cursor = (match.index ?? 0) + match[0].length;
144
- }
145
- out = result + out.slice(cursor);
146
- }
147
- const htmlMatches = [...out.matchAll(HTML_IMAGE)];
148
- if (htmlMatches.length > 0) {
149
- let cursor = 0;
150
- let result = '';
151
- for (const match of htmlMatches) {
152
- const resolved = await resolveLocalImage(match[3] ?? '', baseDir);
153
- result += out.slice(cursor, match.index);
154
- result += `${match[1] ?? ''}${match[2] ?? ''}${resolved}${match[2] ?? ''}`;
155
- cursor = (match.index ?? 0) + match[0].length;
156
- }
157
- out = result + out.slice(cursor);
158
- }
159
- return out;
160
- }
161
-
162
- /**
163
- * 把 Markdown 里的本地图片路径内联成 data URL。
164
- * 围栏代码块与行内代码原样保留;远程地址、data/blob、其它协议不动。
165
- */
166
- export async function inlineMarkdownImages(markdown: string, baseDir: string): Promise<string> {
167
- if (baseDir === '') return markdown;
168
- const lines = markdown.replace(/\r\n?/g, '\n').split('\n');
169
- let fence: string | null = null;
170
- const out: string[] = [];
171
- for (const line of lines) {
172
- const fenceMatch = /^\s*(`{3,}|~{3,})/.exec(line);
173
- if (fenceMatch !== null) {
174
- const marker = fenceMatch[1] ?? '```';
175
- if (fence === null) fence = marker;
176
- else if (line.trimStart().startsWith(fence)) fence = null;
177
- out.push(line);
178
- continue;
179
- }
180
- if (fence !== null) {
181
- out.push(line);
182
- continue;
183
- }
184
- out.push(await rewriteLineImages(line, baseDir));
185
- }
186
- return out.join('\n');
187
- }
1
+ // 本地相对图片解析 — 文档预览 / 幻灯片 / 全屏放映 / 导出共用。
2
+ //
3
+ // Markdown 里的图片通常写成相对路径(`![](./images/example.png)`),但预览
4
+ // WebView 与导出的独立 HTML 都没有「文档所在目录」这一上下文:相对路径会按
5
+ // 页面地址解析,图片加载失败后引擎会把源码 `![alt](path)` 原样显示出来。
6
+ // 这里把本地图片内联成 data URL,一次解析、四处通用(与 ColaMD-themes 的
7
+ // `dsh-assets.ts` 同一条思路)。
8
+ import * as fs from 'fs/promises';
9
+ import * as path from 'path';
10
+ import { fileURLToPath } from 'url';
11
+
12
+ /** 单张图片上限;超过时保留原 src,交给浏览器按原路径处理。 */
13
+ const MAX_ASSET_BYTES = 24 * 1024 * 1024;
14
+ /** 进程内缓存:同一文件在 mtime/size 不变时复用 data URL。 */
15
+ const assetCache = new Map<string, { stamp: string; dataUrl: string }>();
16
+ const ASSET_CACHE_LIMIT = 64;
17
+
18
+ const MIME_BY_EXT: Record<string, string> = {
19
+ '.png': 'image/png',
20
+ '.jpg': 'image/jpeg',
21
+ '.jpeg': 'image/jpeg',
22
+ '.gif': 'image/gif',
23
+ '.webp': 'image/webp',
24
+ '.svg': 'image/svg+xml',
25
+ '.bmp': 'image/bmp',
26
+ '.avif': 'image/avif',
27
+ '.ico': 'image/x-icon',
28
+ };
29
+
30
+ /** `D:\…` 这类 Windows 盘符不是 URL 协议。 */
31
+ function hasScheme(raw: string): boolean {
32
+ return /^[a-z][a-z0-9+.-]*:/i.test(raw) && !/^[a-z]:[\\/]/i.test(raw);
33
+ }
34
+
35
+ /** 逐段解码,坏转义保留原样。 */
36
+ function decodeSegments(raw: string): string {
37
+ return raw
38
+ .split('/')
39
+ .map((segment) => {
40
+ try {
41
+ return decodeURIComponent(segment);
42
+ } catch {
43
+ return segment;
44
+ }
45
+ })
46
+ .join('/');
47
+ }
48
+
49
+ function mimeFor(file: string): string | undefined {
50
+ return MIME_BY_EXT[path.extname(file).toLowerCase()];
51
+ }
52
+
53
+ async function dataUrlFor(file: string): Promise<string | undefined> {
54
+ try {
55
+ const info = await fs.stat(file);
56
+ if (!info.isFile() || info.size === 0 || info.size > MAX_ASSET_BYTES) return undefined;
57
+ const stamp = `${info.size}:${info.mtimeMs}`;
58
+ const hit = assetCache.get(file);
59
+ if (hit !== undefined && hit.stamp === stamp) return hit.dataUrl;
60
+ const bytes = await fs.readFile(file);
61
+ const mime = mimeFor(file);
62
+ if (mime === undefined) return undefined;
63
+ const dataUrl = `data:${mime};base64,${bytes.toString('base64')}`;
64
+ if (assetCache.size >= ASSET_CACHE_LIMIT) {
65
+ const oldest = assetCache.keys().next();
66
+ if (oldest.done !== true) assetCache.delete(oldest.value);
67
+ }
68
+ assetCache.set(file, { stamp, dataUrl });
69
+ return dataUrl;
70
+ } catch {
71
+ return undefined;
72
+ }
73
+ }
74
+
75
+ /**
76
+ * 解析单个图片地址:远程地址保持原样,本地文件转 data URL。
77
+ * 解析失败或超限时返回原值,不影响页面其它内容。
78
+ */
79
+ export async function resolveLocalImage(src: string, baseDir: string): Promise<string> {
80
+ const value = src.trim();
81
+ if (value === '' || value.startsWith('#')) return src;
82
+ if (/^(?:data:|blob:|https?:\/\/|\/\/)/i.test(value)) return src;
83
+ if (/^file:/i.test(value)) {
84
+ let filePath: string;
85
+ try {
86
+ filePath = fileURLToPath(value);
87
+ } catch {
88
+ return src;
89
+ }
90
+ return (await dataUrlFor(filePath)) ?? src;
91
+ }
92
+ // 其它协议(vscode-webview、mailto…)不动;Windows 盘符除外。
93
+ if (hasScheme(value)) return src;
94
+
95
+ const decoded = decodeSegments(value).replace(/&amp;/g, '&');
96
+ const target = path.isAbsolute(decoded) ? decoded : path.resolve(baseDir, decoded);
97
+ return (await dataUrlFor(target)) ?? src;
98
+ }
99
+
100
+ /** 把 HTML 里的 `<img src="…">` 按文档目录解析为 data URL。 */
101
+ export async function inlineHtmlImages(html: string, baseDir: string): Promise<string> {
102
+ if (baseDir === '') return html;
103
+ const pattern = /(<img\b[^>]*?\bsrc\s*=\s*)("([^"]*)"|'([^']*)'|([^\s>]+))/gi;
104
+ let cursor = 0;
105
+ let result = '';
106
+ for (const match of html.matchAll(pattern)) {
107
+ const quoted = match[3] ?? match[4];
108
+ const raw = quoted ?? match[5] ?? '';
109
+ const resolved = await resolveLocalImage(raw, baseDir);
110
+ if (resolved === raw) continue;
111
+ const quote = match[3] !== undefined ? '"' : match[4] !== undefined ? "'" : '';
112
+ result += html.slice(cursor, (match.index ?? 0) + match[1].length);
113
+ result += quote + resolved + quote;
114
+ cursor = (match.index ?? 0) + match[0].length;
115
+ }
116
+ return cursor === 0 ? html : result + html.slice(cursor);
117
+ }
118
+
119
+ /** 行内代码用占位符保护,避免把 `` `![x](y)` `` 里的示例路径也替换掉。 */
120
+ async function rewriteLineImages(line: string, baseDir: string): Promise<string> {
121
+ const parts = line.split(/(`+[^`]*`+)/g);
122
+ for (let i = 0; i < parts.length; i += 2) {
123
+ const part = parts[i] ?? '';
124
+ parts[i] = await rewriteImageSyntax(part, baseDir);
125
+ }
126
+ return parts.join('');
127
+ }
128
+
129
+ const MARKDOWN_IMAGE = /(!\[[^\]]*\]\()\s*(<[^>]*>|[^)\s]+)(\s+"[^"]*")?(\))/g;
130
+ const HTML_IMAGE = /(<img\b[^>]*?\bsrc\s*=\s*)(["'])([^"']+)\2/gi;
131
+
132
+ async function rewriteImageSyntax(text: string, baseDir: string): Promise<string> {
133
+ let out = text;
134
+ const mdMatches = [...out.matchAll(MARKDOWN_IMAGE)];
135
+ if (mdMatches.length > 0) {
136
+ let cursor = 0;
137
+ let result = '';
138
+ for (const match of mdMatches) {
139
+ const raw = (match[2] ?? '').replace(/^<|>$/g, '');
140
+ const resolved = await resolveLocalImage(raw, baseDir);
141
+ result += out.slice(cursor, match.index);
142
+ result += `${match[1] ?? ''}${resolved}${match[3] ?? ''}${match[4] ?? ''}`;
143
+ cursor = (match.index ?? 0) + match[0].length;
144
+ }
145
+ out = result + out.slice(cursor);
146
+ }
147
+ const htmlMatches = [...out.matchAll(HTML_IMAGE)];
148
+ if (htmlMatches.length > 0) {
149
+ let cursor = 0;
150
+ let result = '';
151
+ for (const match of htmlMatches) {
152
+ const resolved = await resolveLocalImage(match[3] ?? '', baseDir);
153
+ result += out.slice(cursor, match.index);
154
+ result += `${match[1] ?? ''}${match[2] ?? ''}${resolved}${match[2] ?? ''}`;
155
+ cursor = (match.index ?? 0) + match[0].length;
156
+ }
157
+ out = result + out.slice(cursor);
158
+ }
159
+ return out;
160
+ }
161
+
162
+ /**
163
+ * 把 Markdown 里的本地图片路径内联成 data URL。
164
+ * 围栏代码块与行内代码原样保留;远程地址、data/blob、其它协议不动。
165
+ */
166
+ export async function inlineMarkdownImages(markdown: string, baseDir: string): Promise<string> {
167
+ if (baseDir === '') return markdown;
168
+ const lines = markdown.replace(/\r\n?/g, '\n').split('\n');
169
+ let fence: string | null = null;
170
+ const out: string[] = [];
171
+ for (const line of lines) {
172
+ const fenceMatch = /^\s*(`{3,}|~{3,})/.exec(line);
173
+ if (fenceMatch !== null) {
174
+ const marker = fenceMatch[1] ?? '```';
175
+ if (fence === null) fence = marker;
176
+ else if (line.trimStart().startsWith(fence)) fence = null;
177
+ out.push(line);
178
+ continue;
179
+ }
180
+ if (fence !== null) {
181
+ out.push(line);
182
+ continue;
183
+ }
184
+ out.push(await rewriteLineImages(line, baseDir));
185
+ }
186
+ return out.join('\n');
187
+ }
@@ -26,6 +26,14 @@ export function adaptSlidesCss(css: string): string {
26
26
  // 的规则,改落到每页自己的纸盒上(后代选择器,注意留空格):flow / 放映 / 打印
27
27
  // 三种模式下都逐页生效,收束页的 chrome 淡出与首版式无关。
28
28
  .replace(/:has\(\.cm-page\[data-slide-layout='([a-z0-9-]+)'\]\)/g, " .cm-page[data-slide-layout='$1']")
29
+ // table 版式的上游基线按 DSH 就地编辑表格写(.cm-md-table-row/.cm-md-table-cell,
30
+ // 用 :has(.cm-md-slide-table) 判行);这里的表格 widget 是真实表格 DOM,且
31
+ // 版式类与 .cm-md-table-widget 同元素——把三套选择器都映射过来,导出与放映
32
+ // 的 table 页才能撑满版心、吃到表头定标与斑马纹。
33
+ .replace(/\.cm-md-table-widget:has\(\.cm-md-slide-table\)/g, '.cm-md-table-widget.cm-md-slide-table')
34
+ .replace(/\.cm-md-table-header \.cm-md-table-cell/g, 'thead th')
35
+ .replace(/\.cm-md-table-row:nth-child\(even\) \.cm-md-table-cell/g, 'tbody tr:nth-child(even) td')
36
+ .replace(/\.cm-md-table-row \.cm-md-table-cell/g, 'tbody td')
29
37
  .replace(/(\d*\.?\d+)vw\b/g, '$1cqw')
30
38
  .replace(/(\d*\.?\d+)vh\b/g, '$1cqh');
31
39
  }
@@ -101,7 +109,10 @@ body {
101
109
  flex-direction: column;
102
110
  justify-content: safe center;
103
111
  }
104
- .ct-stage .cm-md-table-widget table { border-collapse: collapse; }
112
+ .ct-stage .cm-md-table-widget table { border-collapse: collapse; }
113
+ /* table 版式:上游基线把 width:100% 落在 widget 行上(DSH 行即表格);
114
+ 这里的真实 <table> 也要跟着撑满 widget。 */
115
+ .ct-stage .cm-md-table-widget.cm-md-slide-table table { width: 100%; }
105
116
  /* 图形 widget:块级 HTML(内联 SVG)与图,都是一张图占一行。 */
106
117
  .ct-stage .cm-md-html-widget,
107
118
  .ct-stage .mermaid-svg {
@@ -960,6 +960,103 @@ body.slides-printing .cm-md-slide-closing.cm-md-page-title {
960
960
  max-width: 16em;
961
961
  }
962
962
 
963
+ /* ════ 新增版式:chapter / statement / stat / table ════
964
+ *
965
+ * 四种版式按colamd 2.8.3契约 的槽位抽象而来(chapter 章节隔页、statement 大字主张、
966
+ * stat 单条英雄数字、table 整页表格),画法全部走 --slide-* 令牌,主题在
967
+ * 自己的层里再叠加拟态 / 色彩。table 的选择器按本应用的就地编辑表格写:
968
+ * 表格外框是 BlockWrapper(.cm-md-table-widget),行与单元格是
969
+ * .cm-md-table-row / .cm-md-table-cell,DOM 里没有 <table> / <th> / <td>。 */
970
+
971
+ /* chapter:h1-only 章节隔页。标题吃 section 的大标题档位;放映整页居中,
972
+ * 导出保持流式页首(导出没有容器级 flex,整页居中由主题的 px 内距接管)。 */
973
+ body.presenting #editor[data-slide-layout="chapter"] .cm-content {
974
+ display: flex;
975
+ flex-direction: column;
976
+ justify-content: center;
977
+ min-height: 92vh;
978
+ }
979
+
980
+ body.presenting #editor .cm-content .cm-md-slide-chapter.cm-md-page-title,
981
+ body.slides-printing #editor .cm-content .cm-md-slide-chapter.cm-md-page-title {
982
+ font-family: var(--slide-title-font);
983
+ font-size: var(--slide-section-title-size, 5.2em);
984
+ font-weight: var(--slide-title-weight, 800);
985
+ line-height: 1.08;
986
+ letter-spacing: var(--slide-title-tracking, -0.02em);
987
+ color: var(--text-color);
988
+ }
989
+
990
+ /* statement:h2-only 大字主张页。行长放宽到接近整句、行距收紧成「主张」
991
+ * 的节奏;放映整页居中,导出回页首(主题可用 px 内距推到中线)。 */
992
+ body.presenting #editor[data-slide-layout="statement"] .cm-content {
993
+ display: flex;
994
+ flex-direction: column;
995
+ justify-content: center;
996
+ min-height: 92vh;
997
+ }
998
+
999
+ body.presenting #editor .cm-content .cm-md-slide-statement.cm-md-page-title,
1000
+ body.slides-printing #editor .cm-content .cm-md-slide-statement.cm-md-page-title {
1001
+ max-width: 78%;
1002
+ line-height: 1.16;
1003
+ letter-spacing: -0.015em;
1004
+ }
1005
+
1006
+ /* stat:单条英雄数字。整条居中、上一根细线定住,数字吃 kpi 的大数字档位
1007
+ * 并回到强调色;列表符号收掉——大字不需要 bullet。 */
1008
+ body.presenting #editor .cm-content .cm-md-slide-stat.cm-md-li,
1009
+ body.slides-printing #editor .cm-content .cm-md-slide-stat.cm-md-li {
1010
+ display: block;
1011
+ max-width: 72%;
1012
+ margin: 1.4em auto 0;
1013
+ padding-top: 1em;
1014
+ border-top: 1px solid var(--border-color);
1015
+ text-align: center;
1016
+ text-indent: 0;
1017
+ color: var(--text-secondary);
1018
+ }
1019
+
1020
+ body.presenting #editor .cm-content .cm-md-slide-stat .cm-md-listmark,
1021
+ body.slides-printing #editor .cm-content .cm-md-slide-stat .cm-md-listmark {
1022
+ display: none;
1023
+ }
1024
+
1025
+ body.presenting #editor .cm-content .cm-md-slide-stat .cm-md-strong,
1026
+ body.slides-printing #editor .cm-content .cm-md-slide-stat .cm-md-strong {
1027
+ display: block;
1028
+ font-size: var(--slide-kpi-number-size, 3.8em);
1029
+ font-weight: 800;
1030
+ line-height: 1.05;
1031
+ color: var(--pele-accent);
1032
+ }
1033
+
1034
+ /* table:表格即页面主体——撑满版心、表头定标、偶数行淡底做斑马纹。
1035
+ * 放映按当前页版式选;导出没有「当前页容器」,用表格外框 :has() 判断
1036
+ * 它里面包着 table 版式的行,避免同册里任一 table 页把其它表格一起放大。 */
1037
+ body.presenting #editor[data-slide-layout="table"] .cm-content .cm-md-table-widget,
1038
+ body.slides-printing #editor .cm-content .cm-md-table-widget:has(.cm-md-slide-table) {
1039
+ width: 100%;
1040
+ font-size: 0.95em;
1041
+ }
1042
+
1043
+ body.presenting #editor[data-slide-layout="table"] .cm-content .cm-md-table-header .cm-md-table-cell,
1044
+ body.slides-printing #editor .cm-content .cm-md-table-widget:has(.cm-md-slide-table) .cm-md-table-header .cm-md-table-cell {
1045
+ background: var(--table-header-bg);
1046
+ font-weight: 700;
1047
+ padding: 0.6em 0.9em;
1048
+ }
1049
+
1050
+ body.presenting #editor[data-slide-layout="table"] .cm-content .cm-md-table-row .cm-md-table-cell,
1051
+ body.slides-printing #editor .cm-content .cm-md-table-widget:has(.cm-md-slide-table) .cm-md-table-row .cm-md-table-cell {
1052
+ padding: 0.6em 0.9em;
1053
+ }
1054
+
1055
+ body.presenting #editor[data-slide-layout="table"] .cm-content .cm-md-table-row:nth-child(even) .cm-md-table-cell,
1056
+ body.slides-printing #editor .cm-content .cm-md-table-widget:has(.cm-md-slide-table) .cm-md-table-row:nth-child(even) .cm-md-table-cell {
1057
+ background: color-mix(in srgb, var(--text-color) 4%, transparent);
1058
+ }
1059
+
963
1060
  /* ════ 内容元素:列表 / 强调 / 代码 / 引用 / 表格 / 图片 ════
964
1061
  *
965
1062
  * 这些元素在幻灯片里是「顺带出现」的,画法要按 PPT 的读法走:符号收进强调色、
@@ -1077,6 +1174,7 @@ body.slides-printing .cm-md-slide-kpi.cm-md-li,
1077
1174
  body.slides-printing .cm-md-slide-matrix.cm-md-li,
1078
1175
  body.slides-printing .cm-md-slide-timeline.cm-md-li,
1079
1176
  body.slides-printing .cm-md-slide-steps.cm-md-li,
1177
+ body.slides-printing .cm-md-slide-stat.cm-md-li,
1080
1178
  body.slides-printing .cm-md-slide-two-col:not(.cm-md-page-start) {
1081
1179
  break-inside: avoid;
1082
1180
  }
@@ -155,10 +155,24 @@ export class ThemeManager {
155
155
  return '';
156
156
  }
157
157
 
158
- /** 主题主色(`--link-color` / `--accent-color`),供 PPTX / Word 导出取色。 */
158
+ /**
159
+ * 主题主色(`--link-color` / `--accent-color`),供 PPTX / Word 导出取色。
160
+ * 契约主题普遍用 `--link-color: var(--seed-accent)` 间接引用种子色,这里
161
+ * 逐级解析 var() 链,返回真实色值——直接返回 `var(…)` 会让 PPTX 的 hex()
162
+ * 校验失败退回内置默认色,主色与预览不一致。
163
+ */
159
164
  static getAccentColor(css: string): string | undefined {
160
165
  const match = /--(?:link|accent)-color\s*:\s*([^;}\n]+)/.exec(css);
161
- return match ? match[1].trim() : undefined;
166
+ if (!match) return undefined;
167
+ let value = match[1].trim();
168
+ for (let depth = 0; depth < 5; depth += 1) {
169
+ const ref = /^var\(\s*(--[\w-]+)\s*\)$/.exec(value);
170
+ if (ref === null) break;
171
+ const resolved = new RegExp(`${ref[1]!.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}\\s*:\\s*([^;}\\n]+)`).exec(css);
172
+ if (!resolved) break;
173
+ value = resolved[1]!.trim();
174
+ }
175
+ return value;
162
176
  }
163
177
 
164
178
  /** 主题正文字体栈(`--font-family-base` / `--font-body`),供文档导出取字体。 */