vscode-colaview 0.0.0-stage → 0.3.2
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/.vscode/launch.json +30 -0
- package/.vscode/settings.json +4 -0
- package/.vscode/tasks.json +18 -0
- package/.vscodeignore +23 -0
- package/CHANGELOG.md +141 -0
- package/LICENSE +21 -0
- package/README.md +278 -2
- package/README_CN.md +279 -0
- package/RELEASE_NOTES.md +292 -0
- package/esbuild.js +112 -0
- package/icon.png +0 -0
- package/package.json +162 -4
- package/patches/@bytechain.cn+colamd+2.7.11.patch +22 -0
- package/src/commands/commands.ts +105 -0
- package/src/export/css-collector.ts +50 -0
- package/src/export/docx-exporter.ts +962 -0
- package/src/export/html-exporter.ts +18 -0
- package/src/export/pdf-exporter.ts +121 -0
- package/src/export/render-export-images.ts +373 -0
- package/src/export/theme-style.ts +156 -0
- package/src/extension.ts +48 -0
- package/src/preview/preview-manager.ts +542 -0
- package/src/preview/webview/app.ts +366 -0
- package/src/preview/webview/index.html +134 -0
- package/src/themes/built-in/bear.css +38 -0
- package/src/themes/built-in/dark.css +20 -0
- package/src/themes/built-in/dracula.css +38 -0
- package/src/themes/built-in/elegant.css +52 -0
- package/src/themes/built-in/gruvbox.css +42 -0
- package/src/themes/built-in/light.css +20 -0
- package/src/themes/built-in/midnight.css +31 -0
- package/src/themes/built-in/nord.css +38 -0
- package/src/themes/built-in/notion.css +48 -0
- package/src/themes/built-in/sepia.css +47 -0
- package/src/themes/built-in/solarized-dark.css +35 -0
- package/src/themes/built-in/writer.css +44 -0
- package/src/themes/theme-manager.ts +180 -0
- package/src/types/colamd-renderer.d.ts +47 -0
- package/src/types.ts +20 -0
- package/test/fixtures/basic.md +34 -0
- package/test/fixtures/math.md +20 -0
- package/test/fixtures/mermaid.md +19 -0
- package/test/runTest.ts +30 -0
- package/test/suite/html-exporter.test.ts +20 -0
- package/test/suite/markdown-parser.test.ts +8 -0
- package/test/suite/theme-manager.test.ts +31 -0
- package/tsconfig.json +19 -0
package/README_CN.md
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# ColaView MD
|
|
2
|
+
|
|
3
|
+
[](https://code.visualstudio.com/)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](package.json)
|
|
7
|
+
|
|
8
|
+
VS Code 富文本 Markdown 预览与 PDF/HTML/Word 导出扩展 — 基于 [ColaMD](https://github.com/byteuser1977/ColaMD-extend) 渲染引擎(CodeMirror 6 内核)。
|
|
9
|
+
|
|
10
|
+
## 功能特性
|
|
11
|
+
|
|
12
|
+
- **所见即所得预览** — CodeMirror 6 驱动的只读编辑器,实时渲染 Markdown 富文本。源码缓冲区是唯一真相,导出零序列化损耗
|
|
13
|
+
- **数学公式** — KaTeX 集成,支持行内 `$...$` 和块级 `$$...$$` 公式(字体通过 base64 内联)
|
|
14
|
+
- **Mermaid 图表** — 17+ 种图表:流程图、时序图、类图、状态图、ER 图、甘特图、思维导图等
|
|
15
|
+
- **PDF 导出** — Puppeteer 无头 Chrome 生成 A4 PDF,完整保留主题样式
|
|
16
|
+
- **HTML 导出** — 独立 `.html` 文件,内嵌 CSS 和字体,零依赖分享
|
|
17
|
+
- **Word 导出** — 高保真 `.docx`,支持标题、列表、表格、图片、代码块、脚注,及 KaTeX/Mermaid 转图
|
|
18
|
+
- **导出保留主题样式** — PDF/HTML/Word 导出继承当前预览主题的字体、强调色、表格样式和引用块内边距
|
|
19
|
+
- **12 套内置主题** — Light、Dark、Elegant、Sepia、Notion、Bear、Writer、Solarized Dark、Nord、Gruvbox、Dracula、Midnight
|
|
20
|
+
- **自定义主题目录** — 在工作区根目录 `.themes/` 文件夹中放入 `.css` 文件即可自动识别
|
|
21
|
+
- **右键上下文菜单** — 预览面板内直接导出 HTML/PDF、切换主题(含子菜单)、导入自定义主题
|
|
22
|
+
- **实时同步** — 编辑后 150ms 防抖更新,实验性编辑器/预览滚动同步
|
|
23
|
+
- **源码保真** — 原始 Markdown 字节原样保留;导出直接使用缓冲区内容,无序列化损耗
|
|
24
|
+
|
|
25
|
+
## 快速开始
|
|
26
|
+
|
|
27
|
+
1. 安装扩展
|
|
28
|
+
2. 在 VS Code 中打开 `.md` 文件
|
|
29
|
+
3. `Ctrl+Shift+P` → **"ColaView MD: Show Preview"**
|
|
30
|
+
4. 侧边栏打开富文本预览
|
|
31
|
+
|
|
32
|
+
## 命令与使用方式
|
|
33
|
+
|
|
34
|
+
### 命令面板 (`Ctrl+Shift+P`)
|
|
35
|
+
|
|
36
|
+
| 命令 | 说明 |
|
|
37
|
+
|------|------|
|
|
38
|
+
| `ColaView MD: Show Preview` | 打开或聚焦预览面板 |
|
|
39
|
+
| `ColaView MD: Export to PDF...` | 导出为 A4 PDF |
|
|
40
|
+
| `ColaView MD: Export to HTML...` | 导出为独立 HTML |
|
|
41
|
+
| `ColaView MD: Export to Word...` | 导出为 `.docx` Word 文档 |
|
|
42
|
+
| `ColaView MD: Switch Preview Theme...` | 切换主题:12 套内置 + 自定义 |
|
|
43
|
+
| `ColaView MD: Import Custom Theme...` | 导入 `.css` 自定义主题 |
|
|
44
|
+
|
|
45
|
+
### 右键上下文菜单(预览面板内)
|
|
46
|
+
|
|
47
|
+
预览面板打开后,任意位置右键可访问:
|
|
48
|
+
|
|
49
|
+
| 菜单项 | 说明 |
|
|
50
|
+
|--------|------|
|
|
51
|
+
| **Export HTML** | 将当前预览导出为独立 HTML |
|
|
52
|
+
| **Export PDF** | 将当前预览导出为 A4 PDF |
|
|
53
|
+
| **Export Word** | 将当前预览导出为 `.docx` Word 文档 |
|
|
54
|
+
| **Theme ▸** | 子菜单列出所有内置 + 自定义主题(✓ 标记当前激活) |
|
|
55
|
+
| **Import Theme...** | 打开文件选择器导入 `.css` 文件 |
|
|
56
|
+
|
|
57
|
+
## 主题
|
|
58
|
+
|
|
59
|
+
### 内置主题
|
|
60
|
+
|
|
61
|
+
| 主题 | 风格 | 适用场景 |
|
|
62
|
+
|------|------|----------|
|
|
63
|
+
| **Light** | 干净白底,蓝色调 | 通用、文档 |
|
|
64
|
+
| **Dark** | GitHub Dark 配色 | 夜间编程 |
|
|
65
|
+
| **Elegant** | 暖色衬线,米色基调 | 学术论文、长文 |
|
|
66
|
+
| **Sepia** | 暖褐色调,纸质质感 | 长时间阅读、护眼 |
|
|
67
|
+
| **Notion** | Not.so MCP 风格 | 类 Notion 极简风 |
|
|
68
|
+
| **Bear** | Bear.app 笔记风格 | 笔记、随笔 |
|
|
69
|
+
| **Writer** | 等宽友好 | 技术文档、含代码多的文档 |
|
|
70
|
+
| **Solarized Dark** | Ethan Schoonover 调色板 | 低对比深色编码 |
|
|
71
|
+
| **Nord** | 北极蓝调色板 | 沉静专注写作 |
|
|
72
|
+
| **Gruvbox** | 复古 80 年代终端风 | 怀旧、高对比 |
|
|
73
|
+
| **Dracula** | Zeno Rocha 调色板 | 活力深色主题 |
|
|
74
|
+
| **Midnight** | 深蓝 + 金色点缀 | 夜间写作、高级感 |
|
|
75
|
+
|
|
76
|
+
### 自定义主题
|
|
77
|
+
|
|
78
|
+
在工作区根目录的 `.themes/` 目录下放置 `.css` 文件。扩展内置了 2 套自定义主题:
|
|
79
|
+
|
|
80
|
+
| 主题 | 风格 | 适用场景 |
|
|
81
|
+
|------|------|----------|
|
|
82
|
+
| **Academic Paper(学术论文)** | GB/T 7713 标准,衬线正文,三线表,纯黑白 | 学术论文、正式文档、打印 |
|
|
83
|
+
| **Trae Blue** | Trae IDE 文档风格,白底 slate 灰字,蓝色点缀 | 技术文档、现代文档编写 |
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
my-project/
|
|
87
|
+
├── .themes/
|
|
88
|
+
│ ├── my-dark.css # 在主题菜单中显示为 "My-dark"
|
|
89
|
+
│ └── corporate.css # 在主题菜单中显示为 "Corporate"
|
|
90
|
+
└── README.md
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
自定义主题会被自动检测,与内置主题一起出现在命令面板和右键菜单的主题列表中。
|
|
94
|
+
|
|
95
|
+
通过命令面板或设置切换:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{ "colaview.theme": "nord" }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
导入自定义 CSS:`Ctrl+Shift+P` → "ColaView MD: Import Custom Theme..." 或右键菜单 → "Import Theme..."
|
|
102
|
+
|
|
103
|
+
## 配置项
|
|
104
|
+
|
|
105
|
+
| 配置 | 类型 | 默认值 | 说明 |
|
|
106
|
+
|------|------|--------|------|
|
|
107
|
+
| `colaview.theme` | `string` | `"elegant"` | 预览主题:`light`、`dark`、`elegant`、`sepia`、`notion`、`bear`、`writer`、`solarized-dark`、`nord`、`gruvbox`、`dracula`、`midnight` 或任意自定义主题名 |
|
|
108
|
+
| `colaview.autoPreview` | `boolean` | `false` | 打开 `.md` 文件时自动显示预览 |
|
|
109
|
+
| `colaview.scrollSync` | `boolean` | `false` | **实验性功能** — 启用编辑器与预览面板的滚动同步 |
|
|
110
|
+
|
|
111
|
+
## 支持的语法
|
|
112
|
+
|
|
113
|
+
**标准 Markdown** — 标题、粗体、斜体、删除线、代码块、链接、图片、列表、引用
|
|
114
|
+
|
|
115
|
+
**GFM 扩展** — 表格、任务列表、脚注、自动链接
|
|
116
|
+
|
|
117
|
+
**数学公式(KaTeX)**
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
行内:$E = mc^2$
|
|
121
|
+
|
|
122
|
+
块级:
|
|
123
|
+
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**图表(Mermaid)**
|
|
127
|
+
|
|
128
|
+
````markdown
|
|
129
|
+
```mermaid
|
|
130
|
+
graph LR
|
|
131
|
+
A[Markdown] --> B[ColaView]
|
|
132
|
+
B --> C[PDF]
|
|
133
|
+
B --> D[HTML]
|
|
134
|
+
```
|
|
135
|
+
````
|
|
136
|
+
|
|
137
|
+
支持:流程图、时序图、类图、状态图、ER 图、用户旅程、饼图、甘特图、Git 图、思维导图、时间线、四象限图、XY 图、C4 架构图、Sankey 图、Block 图、架构图
|
|
138
|
+
|
|
139
|
+
## 技术架构
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
┌─────────────┐ postMessage ┌──────────────────┐
|
|
143
|
+
│ Extension │ ◄──────────────────► │ WebView │
|
|
144
|
+
│ (Node.js) │ │ (CodeMirror 6/ │
|
|
145
|
+
│ │ raw markdown ──► │ ColaMD 渲染器) │
|
|
146
|
+
│ ThemeManager│ theme/css ──► │ │
|
|
147
|
+
│ Exporters │ ◄── 完整 HTML │ 只读富文本预览 │
|
|
148
|
+
│ │ │ + 右键上下文菜单 │
|
|
149
|
+
└─────────────┘ └──────────────────┘
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**核心设计:** 扩展端将原始 Markdown 发送到 WebView,由 ColaMD(CodeMirror 6 内核)渲染为只读富文本预览。源码缓冲区是唯一真相,导出时直接使用缓冲区内容,零序列化损耗。导出时,WebView 异步构建完整独立 HTML(含 KaTeX 字体、Mermaid SVG、主题 CSS),返回给扩展端。
|
|
153
|
+
|
|
154
|
+
### 安全模型
|
|
155
|
+
|
|
156
|
+
WebView 采用严格的内容安全策略(CSP):
|
|
157
|
+
|
|
158
|
+
1. `style-src 'unsafe-inline'` — CodeMirror 6 动态样式和 KaTeX 内联字体需要
|
|
159
|
+
2. `script-src 'unsafe-inline'` — esbuild IIFE 打包格式需要
|
|
160
|
+
3. 所有资源 URI 通过 `webview.asWebviewUri()` 解析,实现沙箱隔离
|
|
161
|
+
4. 即使 Markdown 内容包含恶意脚本也能防止 XSS 注入
|
|
162
|
+
|
|
163
|
+
### 项目结构
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
src/
|
|
167
|
+
├── extension.ts # 入口(activate/deactivate),错误隔离
|
|
168
|
+
├── commands/commands.ts # 命令注册(showPreview, exportHTML, exportPDF 等)
|
|
169
|
+
├── preview/
|
|
170
|
+
│ ├── preview-manager.ts # WebView 生命周期、消息处理、防抖同步
|
|
171
|
+
│ └── webview/
|
|
172
|
+
│ ├── index.html # WebView 模板 + 右键菜单样式
|
|
173
|
+
│ └── app.ts # ColaMD (CM6) 初始化 + 右键菜单 + 滚动同步
|
|
174
|
+
├── export/
|
|
175
|
+
│ ├── pdf-exporter.ts # Puppeteer PDF 生成(A4、保留背景)
|
|
176
|
+
│ ├── html-exporter.ts # 独立 HTML 导出(内嵌 CSS)
|
|
177
|
+
│ ├── docx-exporter.ts # Word (.docx) 导出(docx + remark-parse/remark-gfm)
|
|
178
|
+
│ ├── render-export-images.ts # KaTeX/Mermaid → PNG(无头 Chrome)用于 Word 导出
|
|
179
|
+
│ └── theme-style.ts # 主题 CSS → 语义化 HTML 样式转换器(供导出使用)
|
|
180
|
+
├── themes/
|
|
181
|
+
│ ├── theme-manager.ts # 主题加载、切换、.themes/ 目录扫描、导入
|
|
182
|
+
│ ├── foundation.css # 基础 CSS 变量层(颜色、间距)
|
|
183
|
+
│ └── built-in/ # 12 套内置主题(light.css, dark.css, elegant.css, sepia.css, ...)
|
|
184
|
+
└── types/
|
|
185
|
+
└── colamd-renderer.d.ts # ColaMD 2.7.9 npm 包本地类型声明
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## 开发
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
git clone https://github.com/bytechain/vscode-colaview.git
|
|
192
|
+
cd vscode-colaview
|
|
193
|
+
npm install
|
|
194
|
+
|
|
195
|
+
# 构建(esbuild 将所有依赖打包到 out/)
|
|
196
|
+
npm run build
|
|
197
|
+
|
|
198
|
+
# 监听模式
|
|
199
|
+
npm run watch
|
|
200
|
+
|
|
201
|
+
# 打包 .vsix
|
|
202
|
+
npm run package
|
|
203
|
+
|
|
204
|
+
# 调试:在 VS Code 中按 F5 启动扩展开发宿主
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 构建系统
|
|
208
|
+
|
|
209
|
+
项目使用 **esbuild** 打包 — 扩展端(`out/extension.js`)是一个仅依赖 VS Code API 的小型 CJS bundle。WebView 端(`out/preview/webview/app.js`)是包含完整 ColaMD 2.7.11 渲染引擎(CodeMirror 6 + Mermaid + KaTeX)的 IIFE bundle — 未压缩约 3.4MB,gzip 后约 400KB。构建时自动复制资源文件(CSS、WebView HTML、KaTeX 样式表、Mermaid 脚本)到 `out/` 目录,确保打包安装后功能正常。
|
|
210
|
+
|
|
211
|
+
## 更新日志
|
|
212
|
+
|
|
213
|
+
### v0.3.2(当前版本)
|
|
214
|
+
|
|
215
|
+
- **🐛 修复 PDF/HTML 导出失败(`md is not defined`)** — 导出时报 "PDF export failed: md is not defined":导出样式模板字符串里的一段 CSS 注释含未转义的反引号,提前闭合了模板字面量,剩余注释被当成 JavaScript 解析。现已转义反引号,注释保持为注释。
|
|
216
|
+
- **🐛 修复 PDF/HTML 导出中 Mermaid 图未居中** — 引擎把 mermaid 块序列化成不带类名的 `<p><svg class="pele pele-…">…</svg></p>`,此前的 `div:has(> svg.pele)` 导出规则匹配不到,居中在纸面上失效。现把居中规则落到 `svg.pele` 自身(`display: block; margin: 0 auto`),与父级是 `<p>` 还是 `<div>` 无关。
|
|
217
|
+
- **🎨 Mermaid 图背景色与 ColaMD-extend 一致** — 图表配色按主题的代码块底色(`--code-block-bg`)推导,ColaMD 中图就画在这块底色上。预览与 HTML/PDF 导出现在同样给图加代码块底色(6px 圆角、`0.8em 1em` 内边距),不再浮在浅色页面上;Elegant/Bear(浅色页面配深色代码块)此前差异最明显。
|
|
218
|
+
- **🎨 修复非 Elegant 主题导出后 Mermaid 图内配色与预览不一致** — 导出端此前在 `div:has(> svg.pele)` 上重新声明 `--pele-*`,而引擎序列化出来的是 `<p><svg class="pele">` 结构,选择器从不命中,图只能落回 pele 内置浅色配色(深色主题下节点/连线/文字明显偏色)。现改为直接使用 `buildExportHTML` 从预览 `.cm-md-mermaid` 收集进 `:root` 的运行时令牌;仅在确实缺失时才按引擎同一公式补一份兜底。
|
|
219
|
+
- **🧹 移除无效配置项** — `colaview.plugins.math` / `colaview.plugins.mermaid`(自 v0.3.0 起无实际作用)与 `colaview.pdfMethod` / `colaview.customThemesPath`(从未被读取)已移除;保留 `colaview.theme`、`colaview.autoPreview`、`colaview.scrollSync`。
|
|
220
|
+
- **🐛 修复预览中块级内容「看源码后消失」** — 引擎 bug(跨行 inline replace 装饰在 CM6 增量更新时不会被重建):点击 mermaid 图 / 多行块公式查看源码后再点走,整块内容不再消失。通过 `patch-package` 固化补丁,修复同步提交到 ColaMD-extend 上游。
|
|
221
|
+
- **🐛 修复 Word 导出图片损坏** — puppeteer v25 截图返回 `Uint8Array`,此前的 base64 转换产出的是逗号十进制串,`.docx` 里公式/图表全部变成占位文本。现改用 `Buffer.from()` 转换。
|
|
222
|
+
- **🐛 修复 Word 公式字形错乱** — KaTeX 字体以 base64 内联进截图页(相对 `fonts/*.woff2` 路径无法解析),公式以正确的 KaTeX 字体渲染。
|
|
223
|
+
- **🎨 导出正文颜色与预览一致** — 引擎 colamd.css 中各主题的正文差异化规则(加粗/行内代码/标题配色)被翻译为语义化选择器并注入 HTML/PDF 导出,覆盖全部 12 套主题。
|
|
224
|
+
|
|
225
|
+
### v0.3.1
|
|
226
|
+
|
|
227
|
+
- **🔧 引擎升级 — ColaMD 2.7.11** — 表格单元格内的行内公式成图、列表缩进纯 CSS 分派、块级 widget 布局修复、回车/退格回归 CM6 官方命令。
|
|
228
|
+
- **🎨 Word 导出 Mermaid 配色跟随主题** — 图表配色从当前预览主题令牌推导(深色主题回落浅色),替代原来写死的 mermaid `neutral`。
|
|
229
|
+
- **🐛 修复 Windows 下 Word 代码块乱码** — 等宽字体写入全部四个 `w:rFonts` 槽位 + 单独的 CJK `eastAsia` 中文字体、显式左对齐、浅色边框、`noProof`(移植 ColaMD-extend #202)。
|
|
230
|
+
- **🐛 修复行内公式在 Word 导出中被折行** — 截图前测量视口加宽到 2000px。
|
|
231
|
+
- **🐛 HTML/PDF 导出图表配色跟随主题 + 不再带缩放控件** — 导出 CSS 命中序列化后的 pele SVG 包裹结构恢复 `--pele-*` 变量映射;纸面上隐藏编辑器专属缩放控件。
|
|
232
|
+
|
|
233
|
+
### v0.3.0
|
|
234
|
+
|
|
235
|
+
- **📝 Word 导出(`.docx`)** — 从 ColaMD-extend 移植。高保真 Word 导出,支持标题、段落、行内样式、代码块、列表、表格、引用块、水平线、图片、脚注,以及 KaTeX/Mermaid 转图。
|
|
236
|
+
- **🎨 导出保留主题样式** — 新增 `theme-style.ts` 转换模块,将编辑器专属选择器(`#editor .cm-content .cm-md-*`)映射为语义化 HTML 选择器,PDF/HTML/Word 导出继承当前预览主题的字体、强调色、表格表头样式和引用块内边距。
|
|
237
|
+
- **🐛 修复 PDF 导出空白** — 剥离 ColaMD 的 Electron `@media print` 规则(该规则会隐藏导出的 `<article>` 元素),PDF(和 HTML)导出不再空白。
|
|
238
|
+
- **🐛 修复 HTML 导出主题样式失效** — 修复导出 HTML 因编辑器专属选择器无法匹配而丢失主题样式的问题。
|
|
239
|
+
- **📦 新增依赖** — `docx`、`katex`、`remark-parse`、`remark-gfm`、`unified`。
|
|
240
|
+
- **🔧 引擎升级 — ColaMD 2.7.9(CodeMirror 6)** — 从 Milkdown/ProseMirror 迁移到 CodeMirror 6。源码缓冲区成为唯一真相,导出零序列化损耗
|
|
241
|
+
- **🎨 12 套内置主题** — 从 4 套扩展到 12 套:Light、Dark、Elegant、Sepia、Notion、Bear、Writer、Solarized Dark、Nord、Gruvbox、Dracula、Midnight。默认主题改为 Elegant
|
|
242
|
+
- **📤 异步 HTML 导出** — `buildExportHTML()` 变为异步,自动等待 Mermaid 图表和 KaTeX 字体渲染完成后再产出最终 HTML
|
|
243
|
+
- **🗑️ 移除插件开关** — 数学公式和 Mermaid 已内置于 ColaMD 引擎;`colaview.plugins.math` 和 `colaview.plugins.mermaid` 配置项不再生效
|
|
244
|
+
- **📰 移除 Newsprint 主题** — Newsprint 在 ColaMD 2.7.9 中不存在
|
|
245
|
+
- **🔄 DOM 结构变更** — 预览容器使用 `.cm-editor` / `.cm-scroller` / `.cm-content` 替代 `.ProseMirror`。滚动同步目标更新为 `.cm-scroller`
|
|
246
|
+
- **📦 依赖升级** — `@bytechain.cn/colamd` 从 `^1.5.2` 升级到 `^2.7.9`。2.7.9 npm 包未发布 `.d.ts` 文件,本地补充类型声明
|
|
247
|
+
- **🖼️ KaTeX 字体内联** — KaTeX 字体 base64 编码在 `colamd.css` 中,PDF 导出无需额外资源路径
|
|
248
|
+
|
|
249
|
+
### v0.2.0
|
|
250
|
+
|
|
251
|
+
- **🏗️ 架构重构** — 激活流程错误隔离、PreviewManager 重构、math/mermaid 设置变更自动实时同步
|
|
252
|
+
- **🖱️ 右键上下文菜单** — 预览面板内直接导出 HTML/PDF、切换主题(含子菜单)、导入自定义主题
|
|
253
|
+
- **🎨 新增自定义主题** — 学术论文 Academic Paper(GB/T 7713 标准)和 Trae Blue(Trae IDE 文档风格)
|
|
254
|
+
- **🧹 代码清理** — 移除废弃文件(`debug-load.js`、`configuration.ts`、`file-utils.ts`)
|
|
255
|
+
- **🐛 问题修复** — h4 标题颜色一致性、代码块边框颜色、打印页边距宽度
|
|
256
|
+
|
|
257
|
+
### v0.1.3
|
|
258
|
+
|
|
259
|
+
- **🔄 实验性滚动同步** — 编辑器与预览面板双向滚动同步。通过 `colaview.scrollSync` 设置启用。
|
|
260
|
+
- 增强扩展激活和预览管理器初始化时的错误处理
|
|
261
|
+
|
|
262
|
+
### v0.1.2
|
|
263
|
+
|
|
264
|
+
- **🐛 引用块背景色修复** — 修复 Dark、Light、Newsprint 主题下 blockquote 背景色被页面背景色覆盖的问题
|
|
265
|
+
|
|
266
|
+
### v0.1.1
|
|
267
|
+
|
|
268
|
+
- **🎨 主题一致性修复** — 统一 4 套内置主题(Light、Dark、Elegant、Newsprint)的 `--code-color` 和 `--code-block-text` CSS 变量,解决行内代码与代码块字体颜色不一致的问题
|
|
269
|
+
- **📰 Newsprint 主题对齐** — Newsprint 主题变量完全对齐 [ColaMD-extend](https://github.com/byteuser1977/ColaMD-extend) base.css,包括衬线字体(PT Serif 字体栈)、代码颜色继承及全部语义化颜色 token
|
|
270
|
+
- **🔧 Light 主题补全** — 补充 Light 主题缺失的 `--table-border` 变量,确保表格样式一致
|
|
271
|
+
- **📦 依赖迁移** — 从本地 ColaMD 项目引用切换为 npm 包 `@bytechain.cn/colamd` (^1.5.2)
|
|
272
|
+
|
|
273
|
+
### v0.1.0
|
|
274
|
+
|
|
275
|
+
- 首次发布,包含所见即所得预览、PDF/HTML 导出、4 套内置主题、自定义主题支持
|
|
276
|
+
|
|
277
|
+
## 许可证
|
|
278
|
+
|
|
279
|
+
[MIT](LICENSE)
|
package/RELEASE_NOTES.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Release Notes
|
|
2
|
+
|
|
3
|
+
## v0.3.2 (2026-11-07)
|
|
4
|
+
|
|
5
|
+
### 🐛 PDF/HTML Export Fixed: `md is not defined`
|
|
6
|
+
|
|
7
|
+
Exporting to PDF (or HTML) failed with "PDF export failed: md is not defined".
|
|
8
|
+
|
|
9
|
+
**Root cause:** the export CSS injected by `patchExportHTML` is built as a JavaScript template literal, and a CSS comment inside it contained unescaped backticks (`` `.cm-md-mermaid` ``). The first backtick closed the template literal early, so the rest of the comment was parsed as JavaScript (`…template.cm - md - mermaid…`), throwing `ReferenceError: md is not defined` the moment an export ran.
|
|
10
|
+
|
|
11
|
+
**Fix:** the backticks in the comment are escaped. The comment stays a comment and the export CSS is emitted verbatim.
|
|
12
|
+
|
|
13
|
+
### 🐛 PDF/HTML Export: Mermaid Diagrams Centered Again
|
|
14
|
+
|
|
15
|
+
Mermaid diagrams looked centered in the preview but sat flush against the left edge on paper.
|
|
16
|
+
|
|
17
|
+
**Root cause:** the engine serializes a mermaid block as a class-stripped `<p><svg class="pele pele-…">…</svg></p>`. The export CSS added in v0.3.1 targeted `div:has(> svg.pele)`, which can never match a `<p>` wrapper, so its `text-align: center` was inert.
|
|
18
|
+
|
|
19
|
+
**Fix:** centering now lives on `svg.pele` itself (`display: block; margin: 0 auto`), so it works regardless of whether the serializer emits a `<p>` or a `<div>`.
|
|
20
|
+
|
|
21
|
+
### 🎨 Mermaid Diagram Background Matches ColaMD-extend
|
|
22
|
+
|
|
23
|
+
Diagram colors are derived from the theme's code-block background (`--code-block-bg`), and in ColaMD the diagram is drawn on that block background. ColaView's preview and exports instead floated the diagram on the plain page background — most visible with Elegant and Bear, whose light pages pair with dark code blocks, so the dark diagram stood on white instead of on the dark block.
|
|
24
|
+
|
|
25
|
+
The preview (`index.html`) now paints `.cm-md-mermaid` with the code-block background (6px radius, `0.8em 1em` padding), and the export CSS (`preview-manager.ts`) applies the same block to the serialized mermaid wrapper, so preview, PDF and HTML exports match ColaMD.
|
|
26
|
+
|
|
27
|
+
### 🎨 Mermaid Colors Now Match the Preview in Every Theme
|
|
28
|
+
|
|
29
|
+
With non-Elegant themes, diagrams in exported PDF/HTML used a different color set than the preview — nodes, edges and labels drifted toward pele's built-in light palette instead of the theme's own tones.
|
|
30
|
+
|
|
31
|
+
**Root cause:** the export stylesheet re-declared the `--pele-*` color tokens on `div:has(> svg.pele)`, a selector that never matches the serialized `<p><svg class="pele">…</svg></p>` markup. The declarations were dead, and diagrams fell back to pele's defaults.
|
|
32
|
+
|
|
33
|
+
**Fix:** exports now use the tokens that `buildExportHTML` already collects from the preview's `.cm-md-mermaid` into `:root` — those are the exact colors the preview renders with, including any explicit overrides from custom themes. The derived token block is injected only when the runtime values are missing (e.g. no rendered mermaid node at export time), so no theme-aware value is ever overwritten.
|
|
34
|
+
|
|
35
|
+
### 🧹 Removed Ineffective Settings
|
|
36
|
+
|
|
37
|
+
Four entries in the settings page did nothing, and they are now gone:
|
|
38
|
+
|
|
39
|
+
- `colaview.plugins.math` / `colaview.plugins.mermaid` — no-ops since v0.3.0, because math and Mermaid are built into the engine and cannot be toggled.
|
|
40
|
+
- `colaview.pdfMethod` / `colaview.customThemesPath` — never read by the extension (PDF always uses the local Chrome pipeline, themes always come from the workspace `.themes` directory).
|
|
41
|
+
|
|
42
|
+
The dead `togglePlugin` message plumbing and no-op configuration listeners were removed with them. The settings page now shows only `colaview.theme`, `colaview.autoPreview` and `colaview.scrollSync`.
|
|
43
|
+
|
|
44
|
+
### 🐛 Preview: Blocks No Longer Vanish After Viewing Their Source
|
|
45
|
+
|
|
46
|
+
Clicking a rendered mermaid diagram or block formula reveals its source (per ColaMD-extend's block-widget rule); clicking away is supposed to re-render it — but the whole block silently disappeared instead.
|
|
47
|
+
|
|
48
|
+
**Root cause:** the engine rendered mermaid diagrams and multi-line block math as *inline* replace decorations spanning multiple lines. CodeMirror 6 only honors such decorations when the tree is built from scratch (initial load); on incremental updates the widget is never recreated — the decoration comparison even reports the change, but the render layer skips it, leaving an empty block.
|
|
49
|
+
|
|
50
|
+
**Fix:** whole-line-covering replace decorations now use `block: true` (mermaid always; block math when the range covers full lines). Verified in a headless browser: mermaid / multi-line math / tables all reveal source and restore correctly. Applied via `patch-package` (`patches/@bytechain.cn+colamd+2.7.11.patch`, wired through `postinstall`) and committed upstream to ColaMD-extend's `live-preview.ts`.
|
|
51
|
+
|
|
52
|
+
### 🐛 Word Export: Formulas & Diagrams Now Render Correctly
|
|
53
|
+
|
|
54
|
+
Two independent bugs made every formula/diagram image in the exported `.docx` broken:
|
|
55
|
+
|
|
56
|
+
1. **Corrupt image data** — puppeteer v25's `screenshot()` returns a `Uint8Array`; `Uint8Array.toString('base64')` ignores the argument and emits a comma-joined decimal byte string (`137,80,78,…`), which is not base64. The `.docx` image parser rejected it, so formulas/diagrams appeared as `[公式 1]` placeholder text. Screenshots are now converted with `Buffer.from()`.
|
|
57
|
+
2. **Wrong glyph fonts** — the screenshot page inlines `katex.min.css`, but its relative `url(fonts/*.woff2)` references cannot resolve on a `page.setContent` page (about:blank base URL), so KaTeX fell back to system fonts. KaTeX fonts are now inlined as base64 data URIs at render time; the build also copies the font files to `out/assets/katex-fonts/` for packaged installs.
|
|
58
|
+
|
|
59
|
+
### 🎨 Exports Match the Preview's Theme Colors
|
|
60
|
+
|
|
61
|
+
The engine's `colamd.css` carries per-theme body rules (`body.theme-x .cm-content .cm-md-strong`, inline code colors, heading colors, table header styling) that the exported semantic HTML could not match. These rules are now extracted from `colamd.css`, translated to semantic selectors (`body.theme-x .colamd-document strong` …), and injected into HTML/PDF exports — so exports match the preview (and ColaMD-extend) for all 12 built-in themes, including the ones whose accent rules only exist in the engine layer (sepia / dark / notion / midnight / writer).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## v0.3.1 (2026-11-07)
|
|
66
|
+
|
|
67
|
+
### 🔧 Engine Upgrade — ColaMD 2.7.11
|
|
68
|
+
|
|
69
|
+
`@bytechain.cn/colamd` bumped from 2.7.9 to 2.7.11, bringing upstream fixes: inline math inside table cells rendered as formulas, list indent handled purely by CSS, cursor alignment with multi-digit ordered lists, block-level widget layout (diagram height re-measured after async render), and Enter/Backspace restored to official CodeMirror commands.
|
|
70
|
+
|
|
71
|
+
### 🐛 Windows Word Code Blocks Fixed (ColaMD-extend #202)
|
|
72
|
+
|
|
73
|
+
Three Windows-only symptoms, one module:
|
|
74
|
+
|
|
75
|
+
1. **Garbled code** — the mono font was written into all four `w:rFonts` slots; a macOS-only font made Word substitute the whole run with symbol glyphs. Now uses a platform mono font (Menlo / Consolas / DejaVu Sans Mono) plus a dedicated CJK `eastAsia` font so Chinese comments render properly.
|
|
76
|
+
2. **Explicit left alignment** — code paragraphs inherited justified alignment, stretching every line to full width. Now explicitly left-aligned, single line spacing, with a light border and shading.
|
|
77
|
+
3. **No spell-check squiggles** — `noProof` added to inline code and code block runs.
|
|
78
|
+
|
|
79
|
+
### 🎨 Word Mermaid Diagrams Follow the Preview Theme
|
|
80
|
+
|
|
81
|
+
Exported diagrams were hardcoded to mermaid's `neutral` theme. Diagram colors are now derived from the current theme's tokens — surface/border mixes at 18% / 28% / 45%, the same ratios the editor uses — with dark themes falling back to the light palette (same rule as body text).
|
|
82
|
+
|
|
83
|
+
### 🐛 Inline Formulas No Longer Wrap in Word
|
|
84
|
+
|
|
85
|
+
The rasterization viewport was widened to 2000px before measuring, so slightly-wide formulas are no longer line-wrapped by KaTeX inside the capture (port of ColaMD-extend's `MEASURE_WIDTH` fix).
|
|
86
|
+
|
|
87
|
+
### 🐛 HTML/PDF Diagrams Follow Theme + No Zoom Controls
|
|
88
|
+
|
|
89
|
+
- Export CSS now matches the serialized `<div><svg class="pele pele-…">` wrappers to restore the `--pele-*` variable mapping, so diagrams keep the theme's colors (port of ColaMD-extend a25b3f8).
|
|
90
|
+
- The editor-only diagram zoom controls (`.pele-zoom`) are hidden in exports — Chromium print doesn't run scripts, so pele never gets the chance to remove them and they overlapped diagrams in PDFs (port of `print-layout.ts`).
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## v0.3.0 (2026-11-06)
|
|
95
|
+
|
|
96
|
+
### 🎨 Theme-Faithful Export
|
|
97
|
+
|
|
98
|
+
Exports now inherit the current preview theme's visual styling. Previously, theme CSS targeted editor-only DOM selectors (`#editor .cm-content .cm-md-*`), which could not match the semantic HTML (`<h1>`, `<strong>`, `<code>`, `<table>`, `<blockquote>`...) produced by PDF/HTML/Word export — causing fonts, accent colors, table header styling and blockquote padding to fall back to defaults.
|
|
99
|
+
|
|
100
|
+
The new `src/export/theme-style.ts` conversion layer fixes this by:
|
|
101
|
+
|
|
102
|
+
- Mapping `.cm-md-*` decoration classes to semantic HTML tags (e.g. `.cm-md-strong` → `strong`, `.cm-md-inlinecode` → `code`, `.cm-md-atxheading1` → `h1`)
|
|
103
|
+
- Extracting `:root` CSS variables and `.cm-content` font family / line-height tokens from the theme
|
|
104
|
+
- Injecting the converted styles into PDF, HTML and Word exports so the output faithfully reflects the active preview theme
|
|
105
|
+
|
|
106
|
+
### 📝 Word Export — `.docx`
|
|
107
|
+
|
|
108
|
+
Reference implementation ported from [ColaMD-extend](https://github.com/byteuser1977/ColaMD-extend)'s `docx-export.ts`. Export any Markdown document to a high-fidelity Word document:
|
|
109
|
+
|
|
110
|
+
- **Full structure** — headings, paragraphs, blockquotes, horizontal rules
|
|
111
|
+
- **Inline styles** — bold, italic, strikethrough, inline code, links, `==highlight==`, footnotes
|
|
112
|
+
- **Code blocks** — monospace with shaded background
|
|
113
|
+
- **Lists** — ordered (with correct numbering), unordered, and task lists (`☑`/`☐`)
|
|
114
|
+
- **Tables** — GFM tables with header shading and column alignment
|
|
115
|
+
- **Images** — local, `data:` and remote (`http(s)`) images embedded natively
|
|
116
|
+
- **KaTeX formulas** — inline/display math rasterized to images via headless Chrome + KaTeX
|
|
117
|
+
- **Mermaid diagrams** — rasterized to images via headless Chrome + Mermaid
|
|
118
|
+
|
|
119
|
+
The Word export runs entirely in the extension host (`docx` v9 → OOXML), parsing Markdown with `unified`/`remark-parse`/`remark-gfm`. Electron's `nativeImage` has been replaced with a pure-JS image dimension sniffer (`sniffImage`), so no DOM is required.
|
|
120
|
+
|
|
121
|
+
**Usage** — Command Palette → "ColaView MD: Export to Word...", editor/explorer context menu, or preview right-click menu.
|
|
122
|
+
|
|
123
|
+
New direct dependencies: `docx`, `katex`, `remark-parse`, `remark-gfm`, `unified`.
|
|
124
|
+
|
|
125
|
+
### 🐛 PDF Blank Export Fixed
|
|
126
|
+
|
|
127
|
+
The exported PDF was blank because `colamd.css`'s Electron desktop print rule
|
|
128
|
+
|
|
129
|
+
```css
|
|
130
|
+
@media print {
|
|
131
|
+
body > :not(#editor-region), #editor .code-copy-btn, ... { display: none !important }
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
hides the entire exported `<article>` (which lives inside `<body>` without an `#editor-region` wrapper). The rule is now stripped from the inlined CSS at source, so both PDF and HTML export render correctly.
|
|
136
|
+
|
|
137
|
+
### 🔧 Engine Upgrade — ColaMD 2.7.9 (CodeMirror 6)
|
|
138
|
+
|
|
139
|
+
This release upgrades the entire rendering engine from Milkdown/ProseMirror to **CodeMirror 6** via `@bytechain.cn/colamd@2.7.9`. This is a major version jump (from `^1.5.2` to `^2.7.9`) with fundamentally different architecture:
|
|
140
|
+
|
|
141
|
+
**Source Buffer as Single Source of Truth** — Unlike ProseMirror's document model which could silently serialize Markdown back, CodeMirror 6 treats the raw source buffer as the canonical state. Export operations use buffer content directly, guaranteeing zero serialization loss.
|
|
142
|
+
|
|
143
|
+
**Async Export Pipeline** — `buildExportHTML()` now returns a Promise. Internally it calls `ensureAllPluginsRendered()` first, waiting for Mermaid diagrams and KaTeX fonts to finish before producing the final HTML. The WebView → extension handshake remains identical (message passing), but the WebView side now properly awaits completion.
|
|
144
|
+
|
|
145
|
+
**New CM6 DOM Structure** — The preview container changed from `.ProseMirror` to `.cm-editor` / `.cm-scroller` / `.cm-content`. Scroll sync had to be retargeted from `#editor` to `.cm-scroller`.
|
|
146
|
+
|
|
147
|
+
### 🎨 12 Built-in Themes
|
|
148
|
+
|
|
149
|
+
| Theme | Style |
|
|
150
|
+
|-------|-------|
|
|
151
|
+
| **Light** | Clean white, blue accents |
|
|
152
|
+
| **Dark** | GitHub Dark palette |
|
|
153
|
+
| **Elegant** *(new default)* | Warm serif, beige tones |
|
|
154
|
+
| **Sepia** | Warm sepia, paper texture |
|
|
155
|
+
| **Notion** | Not.so MCP minimalism |
|
|
156
|
+
| **Bear** | Bear.app note style |
|
|
157
|
+
| **Writer** | Monospace-friendly |
|
|
158
|
+
| **Solarized Dark** | Ethan Schoonover palette |
|
|
159
|
+
| **Nord** | Arctic blue |
|
|
160
|
+
| **Gruvbox** | Retro 80s terminal |
|
|
161
|
+
| **Dracula** | Zeno Rocha vibrant dark |
|
|
162
|
+
| **Midnight** | Deep navy + gold |
|
|
163
|
+
|
|
164
|
+
*Newsprint was removed* — it is not part of ColaMD 2.7.9. Users with `colaview.theme: "newsprint"` will get the default ("elegant").
|
|
165
|
+
|
|
166
|
+
### 🗑️ Plugin Toggle Deprecated
|
|
167
|
+
|
|
168
|
+
`colaview.plugins.math` and `colaview.plugins.mermaid` are now **no-ops**. Math and Mermaid are integral parts of the CodeMirror 6 engine — they cannot be independently disabled. The settings remain in `package.json` for backward compatibility but have no effect at runtime.
|
|
169
|
+
|
|
170
|
+
### 📦 Build Size
|
|
171
|
+
|
|
172
|
+
| | v0.2.0 | v0.3.0 |
|
|
173
|
+
|--|-------|-------|
|
|
174
|
+
| Extension (`out/extension.js`) | ~28KB | ~30KB |
|
|
175
|
+
| WebView (`out/preview/webview/app.js`) | ~50KB | ~3.4MB |
|
|
176
|
+
| WebView (gzip) | ~15KB | ~400KB |
|
|
177
|
+
|
|
178
|
+
The WebView bundle grew significantly because it now includes the full CodeMirror 6 + Mermaid + KaTeX rendering engine inlined via esbuild IIFE. The extension side stays lean.
|
|
179
|
+
|
|
180
|
+
### ⚠️ Security Model Change
|
|
181
|
+
|
|
182
|
+
CSP was relaxed from nonce-based to `'unsafe-inline'` for both `style-src` and `script-src`. This is required by CodeMirror 6 (dynamic inline styles) and esbuild IIFE format. Sandbox isolation via `asWebviewUri()` remains intact.
|
|
183
|
+
|
|
184
|
+
### 📄 KaTeX Fonts
|
|
185
|
+
|
|
186
|
+
No more font resource path management headaches. KaTeX fonts are base64-encoded inside `colamd.css` — they work in WebView preview, HTML export, and PDF export without any additional configuration.
|
|
187
|
+
|
|
188
|
+
### Files Changed
|
|
189
|
+
10 files changed — 2,438 insertions, 912 deletions
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## v0.2.0 (2025-05-30)
|
|
194
|
+
|
|
195
|
+
### 🏗️ Architecture Overhaul
|
|
196
|
+
|
|
197
|
+
**Error-Isolated Activation** — Extension `activate()` now uses independent try/catch blocks for ThemeManager, PreviewManager, and command registration. A failure in one component no longer blocks the others, improving extension reliability in edge cases.
|
|
198
|
+
|
|
199
|
+
**PreviewManager Refactoring** — Split monolithic `setupEventListeners()` into dedicated methods (`registerActiveEditorListener`, `registerScrollSyncListeners`, `registerConfigurationListener`) for better maintainability and separation of concerns.
|
|
200
|
+
|
|
201
|
+
**Runtime Plugin Toggle Sync** — `colaview.plugins.math` and `colaview.plugins.mermaid` setting changes are now automatically synced to the preview WebView via `onDidChangeConfiguration`. No manual reload required — toggle KaTeX or Mermaid rendering in real-time.
|
|
202
|
+
|
|
203
|
+
### ✨ New Features
|
|
204
|
+
|
|
205
|
+
**Right-Click Context Menu** — Native context menu inside the preview WebView panel:
|
|
206
|
+
- Export HTML / PDF directly from the preview
|
|
207
|
+
- Switch theme via a nested submenu (✓ marks active theme)
|
|
208
|
+
- Import custom `.css` theme file
|
|
209
|
+
- All commands are now accessible without leaving the preview panel
|
|
210
|
+
|
|
211
|
+
**New Custom Themes:**
|
|
212
|
+
| Theme | File | Style |
|
|
213
|
+
|-------|------|-------|
|
|
214
|
+
| **Academic Paper** | `.themes/academic-paper.css` | GB/T 7713 standard — serif body, sans-serif headings, three-line tables, pure black-on-white |
|
|
215
|
+
| **Trae Blue** | `.themes/trae-blue.css` | Trae IDE documentation style — white + Slate gray, system sans-serif, blue (#3b82f6) accents |
|
|
216
|
+
|
|
217
|
+
**Read-Only Mode** — Preview ProseMirror editor now explicitly styles as read-only: cursor hidden, selection highlights disabled.
|
|
218
|
+
|
|
219
|
+
### 🧹 Cleanup
|
|
220
|
+
|
|
221
|
+
| Removed | Reason |
|
|
222
|
+
|---------|--------|
|
|
223
|
+
| `debug-load.js` | Obsolete development helper |
|
|
224
|
+
| `src/config/configuration.ts` | Unused module |
|
|
225
|
+
| `src/utils/file-utils.ts` | Unused module |
|
|
226
|
+
| Scroll sync fields (`scrollTop`, `scrollHeight`, `clientHeight`, `scrollPercent`) | Removed unused fields from shared message types |
|
|
227
|
+
|
|
228
|
+
### 🐛 Fixes
|
|
229
|
+
- Fixed h4 heading color inconsistency in exports
|
|
230
|
+
- Fixed code block border color mismatch after theme changes
|
|
231
|
+
- Fixed print margin width (reduced from 60px to 28px)
|
|
232
|
+
|
|
233
|
+
### Files Changed
|
|
234
|
+
42 files changed — 208,517 insertions, 208,696 deletions (includes colamd-renderer.js and colamd.css rebuild)
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## v0.1.3 (2025-05-29)
|
|
239
|
+
|
|
240
|
+
### 🔄 Experimental Scroll Sync
|
|
241
|
+
|
|
242
|
+
Bidirectional scroll synchronization between VS Code editor and preview panel. When enabled, moving the cursor in the editor scrolls the preview to the matching position, and scrolling the preview highlights the corresponding editor line.
|
|
243
|
+
|
|
244
|
+
**Enable:** Set `colaview.scrollSync` to `true` in VS Code settings.
|
|
245
|
+
|
|
246
|
+
**Algorithm:** Uses relative position mapping (cursor-to-visible-range ratio) rather than simple percentage for more accurate positioning, with debouncing to prevent performance issues and circular reference prevention to avoid infinite scroll loops.
|
|
247
|
+
|
|
248
|
+
### 🛡️ Error Handling
|
|
249
|
+
- Enhanced error handling in extension activation
|
|
250
|
+
- Improved resilience in preview manager initialization
|
|
251
|
+
|
|
252
|
+
### 🐛 Fixes
|
|
253
|
+
- Fixed list indentation and symbol alignment in HTML/PDF exports
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## v0.1.2 (2025-05-28)
|
|
258
|
+
|
|
259
|
+
### 🐛 Bug Fix
|
|
260
|
+
|
|
261
|
+
**Blockquote Background Color** — Fixed blockquote background color being overridden by page background (`--bg-color`) in Dark, Light, and Newsprint themes.
|
|
262
|
+
|
|
263
|
+
#### Root Cause
|
|
264
|
+
The base blockquote rule in `colamd.css` did not set a `background` property, causing blockquotes to inherit `body`'s background color. Only the Elegant theme had an explicit override rule, so it was unaffected.
|
|
265
|
+
|
|
266
|
+
#### Fix
|
|
267
|
+
Added explicit `background: var(--blockquote-bg)` rules to all 3 affected built-in theme CSS files:
|
|
268
|
+
|
|
269
|
+
| Theme | Blockquote Background |
|
|
270
|
+
|-------|----------------------|
|
|
271
|
+
| **Dark** | `#161b22` (slightly lighter than page `#0d1117`) |
|
|
272
|
+
| **Light** | `#ffffff` |
|
|
273
|
+
| **Newsprint** | `#eae6de` (slightly darker than page `#f5f2eb`) |
|
|
274
|
+
|
|
275
|
+
### Files Changed
|
|
276
|
+
- `src/themes/built-in/dark.css` — Added blockquote background rule
|
|
277
|
+
- `src/themes/built-in/light.css` — Added blockquote background rule
|
|
278
|
+
- `src/themes/built-in/newsprint.css` — Added blockquote background rule
|
|
279
|
+
- `package.json` / `package-lock.json` — Version bump to 0.1.2
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## v0.1.1
|
|
284
|
+
|
|
285
|
+
- **🎨 Theme Consistency Fix** — Unified `--code-color` and `--code-block-text` CSS variables across all 4 built-in themes
|
|
286
|
+
- **📰 Newsprint Theme Alignment** — Aligned with ColaMD-extend base.css variables
|
|
287
|
+
- **🔧 Light Theme Completion** — Added missing `--table-border` variable
|
|
288
|
+
- **📦 Dependency Migration** — Switched to npm package `@bytechain.cn/colamd` (^1.5.2)
|
|
289
|
+
|
|
290
|
+
## v0.1.0
|
|
291
|
+
|
|
292
|
+
- Initial release with WYSIWYG preview, PDF/HTML export, 4 built-in themes, custom theme support
|