vscode-colaview 0.3.3 → 0.4.1
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/.release-notes-v0.4.1.md +29 -0
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +45 -16
- package/README.md +318 -287
- package/README_CN.md +318 -287
- package/RELEASE_NOTES.md +80 -21
- package/esbuild.js +2 -0
- package/package.json +204 -164
- package/package.nls.json +14 -0
- package/package.nls.zh-cn.json +14 -0
- package/src/commands/commands.ts +48 -0
- package/src/docx/docx-builder.ts +241 -0
- package/src/export/docx-exporter.ts +961 -961
- package/src/export/html-exporter.ts +8 -2
- package/src/export/pdf-exporter.ts +69 -0
- package/src/export/pptx-exporter.ts +63 -0
- package/src/export/render-export-images.ts +386 -386
- package/src/export/theme-style.ts +195 -195
- package/src/pptx/pptx-builder.ts +249 -0
- package/src/pptx/zip.ts +158 -0
- package/src/present/presenter.ts +89 -0
- package/src/preview/preview-manager.ts +783 -541
- package/src/preview/webview/app.ts +695 -370
- package/src/preview/webview/index.html +167 -146
- package/src/slides/deck.ts +408 -0
- package/src/slides/markdown.ts +420 -0
- package/src/slides/render.ts +580 -0
- package/src/slides/slides.css +1082 -0
- package/src/themes/built-in/bear.css +64 -13
- package/src/themes/built-in/dark.css +64 -5
- package/src/themes/built-in/dracula.css +64 -5
- package/src/themes/built-in/elegant.css +75 -11
- package/src/themes/built-in/gruvbox.css +65 -6
- package/src/themes/built-in/light.css +62 -2
- package/src/themes/built-in/midnight.css +64 -6
- package/src/themes/built-in/nord.css +64 -5
- package/src/themes/built-in/notion.css +63 -11
- package/src/themes/built-in/sepia.css +65 -10
- package/src/themes/built-in/solarized-dark.css +64 -5
- package/src/themes/built-in/writer.css +66 -19
- package/src/themes/theme-manager.ts +207 -180
- package/src/types/colamd-renderer.d.ts +47 -47
- package/src/types/pele-lazy.d.ts +21 -0
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
-
## v0.
|
|
3
|
+
## v0.4.1 (2026-12-03)
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### 🎬 Slides Preview: Mermaid & Math Now Render
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
In the slides deck, ` ```mermaid ` fences and `$$…$$` block math were drawn as raw source lines — the slides render layer is a standalone renderer and had no widget support. Worse, the deck paginator splits oversized code blocks by line budget, so a long mermaid fence was chopped into invalid partial sources that failed mermaid parsing with "Syntax error in text".
|
|
8
|
+
|
|
9
|
+
Two fixes:
|
|
10
|
+
|
|
11
|
+
- **Mermaid fences are never split** — `splitBlock` keeps a mermaid block whole (an oversized diagram occupies a page on its own).
|
|
12
|
+
- **Hydration** — the renderer emits placeholder containers (source kept in a hidden node), and the WebView hydrates them after each deck render: mermaid diagrams become inline SVG (upstream `slides.css` `.mermaid-svg` contract), block math becomes KaTeX HTML. When rendering fails, the source stays visible as a fallback. The WebView bundle grows from 3.6MB to ~11MB because mermaid and KaTeX are now inlined alongside the engine.
|
|
13
|
+
|
|
14
|
+
### 🐛 Present (Fullscreen): Browser Opens Reliably + Mermaid Included
|
|
15
|
+
|
|
16
|
+
Two presenting problems fixed:
|
|
17
|
+
|
|
18
|
+
- **"系统找不到指定的文件"** — `vscode.env.openExternal` with a `file:` URI goes through Windows ShellExecute, which frequently cannot resolve file associations for that call. Presenting now opens the file through the platform shell — `start "" "<file>"` on Windows, `open` on macOS, `xdg-open` on Linux — with `openExternal` as a fallback and the file path in the error message if both fail.
|
|
19
|
+
- **No mermaid content in the present window / slides PDF** — the standalone documents now embed a CDN hydration script (mermaid + KaTeX) that fills the same placeholder containers, and the slides PDF exporter waits for hydration (`window.__colaviewSlidesHydrated`) before printing. Offline, the source stays visible as a fallback.
|
|
20
|
+
|
|
21
|
+
### 🎯 Slide Rendering Aligned with ColaMD-themes / ColaMD-extend
|
|
22
|
+
|
|
23
|
+
Three mechanisms ported from the two upstream implementations:
|
|
24
|
+
|
|
25
|
+
- **Mermaid renders through pele** (the same renderer ColaMD-extend uses via `pele/lazy`) — instead of configuring mermaid themes, the SVG references `var(--pele-*)` tokens that DECK_CSS injects on the holder (the same mapping as the document preview), so diagrams inherit the active theme exactly and stop looking like pasted-in neutral-theme pictures. The WebView hydrates with `pele/lazy` (bundled); the standalone present/PDF document loads the pele global build from CDN and renders synchronously.
|
|
26
|
+
- **Per-page fit via font-size shrink** (from ColaMD-themes `fitPaper`, `dsh-preview.ts`) — replaces the previous `zoom` approach: `zoom` changes the pages' cqw/cqh container-query size and is unreliable in presenting and printing. The fit shrinks the page content font by `room/need × 0.98` per pass (8 passes, 50% floor), re-runs on `fonts.ready` / `load` and is exposed as `window.__colaviewFitSlides`.
|
|
27
|
+
- **Refit after hydration** — mermaid and KaTeX change each page's content height, so the hydration script re-runs the fit when it finishes.
|
|
28
|
+
- **Blank directive-only pages filtered** (from ColaMD-extend `deckPages`, `slideshow.ts`) — slides carrying no title, lead, kicker or blocks no longer produce empty paper sheets in presenting and printing. The slides PDF exporter additionally fits under print media before printing.
|
|
29
|
+
|
|
30
|
+
## v0.4.0 (2026-12-01)
|
|
31
|
+
|
|
32
|
+
### 🔧 Engine Upgrade — ColaMD 2.8.2, No More Patches
|
|
33
|
+
|
|
34
|
+
`@bytechain.cn/colamd` bumped from 2.7.11 to 2.8.2. The CM6 multi-line replace-decoration fix (`block: true` for whole-line replace decorations — previously carried as a `patch-package` patch) is now native to the engine, extended upstream to tables and HTML blocks as well. The `patches/` directory is gone; `patch-package` remains wired through `postinstall` but finds nothing to apply.
|
|
8
35
|
|
|
9
36
|
### 🎨 Mermaid Diagrams Drawn on the Page
|
|
10
37
|
|
|
11
38
|
Diagrams used to sit on the theme's code-block background with colors derived from `--code-block-bg`/`--code-block-text`. But a mermaid fence is a whole-block replacement — there is no code block behind it — so Elegant and Bear (light pages with dark code blocks) rendered pale lines on the dark block, washed out against the page.
|
|
12
39
|
|
|
13
|
-
Preview and HTML/PDF exports now derive the `--pele-*` tokens from the page colors (`--bg-color`/`--text-color`, mixed at 18%/28%/45% — the same ratios as the engine) and no longer paint a background behind the diagram, matching ColaMD-extend
|
|
40
|
+
Preview and HTML/PDF exports now derive the `--pele-*` tokens from the page colors (`--bg-color`/`--text-color`, mixed at 18%/28%/45% — the same ratios as the engine) and no longer paint a background behind the diagram, matching ColaMD-extend. Light themes get dark lines on paper; dark themes get light lines on the dark page.
|
|
14
41
|
|
|
15
42
|
### 🐛 Theme Variables Actually Apply Now
|
|
16
43
|
|
|
@@ -24,6 +51,38 @@ The 12 theme files are byte-identical with ColaMD-extend's (the 2.7.12+ theme co
|
|
|
24
51
|
|
|
25
52
|
Two rules mirrored from ColaMD-extend's `docx-style.ts`: dark themes fall back entirely to the light palette (light text on white paper is invisible), and light themes with a dark code block (Elegant/Bear) draw diagrams on white with the body text color instead of pale code-block text.
|
|
26
53
|
|
|
54
|
+
### 🧭 Menus Simplified, Theme Submenu Grouped
|
|
55
|
+
|
|
56
|
+
The editor context menu now offers just "Show Preview" and "Show Slides Preview" — exports and presenting live in the preview panel and the Command Palette. The preview context menu keeps **Present (Fullscreen)** pinned first and scopes exports to the current mode: documents get PDF / HTML / Word, slides get PDF / PPTX.
|
|
57
|
+
|
|
58
|
+
The theme submenu is grouped into Built-in · Light / Built-in · Dark / Custom with a scrollable max-height (70vh), so a long list of custom `.themes/` files no longer runs off the page.
|
|
59
|
+
|
|
60
|
+
Command titles are localized through `package.nls.json` / `package.nls.zh-cn.json` — menus and the Command Palette follow the VS Code display language. The preview commands also gain conflict-free keybindings: `Ctrl+Alt+V` opens the preview and `Ctrl+Alt+S` the slides preview, both scoped to Markdown files so Save (`Ctrl+S`) keeps working.
|
|
61
|
+
|
|
62
|
+
### 🎯 Rendering Aligned with the DSH Plugin
|
|
63
|
+
|
|
64
|
+
The preview now follows the same rendering contract as the DSH (DeepSeek Harness) plugin in ColaMD-themes:
|
|
65
|
+
|
|
66
|
+
- **Themes upgraded to the ColaMD 2.8 contract** — seed palette plus typography tokens (`--font-body`, `--font-mono`, `--editor-font-size`, `--editor-column-width`) in all 12 built-in themes, with JetBrains Mono / Fira Code webfont mirroring (CSP now allows `fonts.gstatic.com`; offline falls back to the theme stacks). Per-theme fonts are preserved: Elegant serif, Sepia Georgia, Writer mono at 15px.
|
|
67
|
+
- **BASE_CSS alignment layer** — the WebView injects the DSH document base translated to the editor DOM via zero-specificity `:where()` rules: 820px content column with 2.2rem gutters, 1.78 body line-height (per-theme values win: Elegant 1.9, Sepia 1.85, Writer 1.8), 0.01em letter-spacing, token-driven heading metrics (h1 2rem / 1.3 / −0.01em, h1/h2 underlines removed — as DSH renders them), plus inline-code / code-block / blockquote / list-marker / HR spacing.
|
|
68
|
+
|
|
69
|
+
The cascade is engine defaults < alignment layer < theme identity rules, so themes keep their character while the page grid matches DSH.
|
|
70
|
+
|
|
71
|
+
### 🐛 Slides Mode: Theme Switch No Longer Reverts
|
|
72
|
+
|
|
73
|
+
Switching themes in the slides preview snapped the deck back to the original theme. Root cause: `switchTheme` wrote `colaview.theme` to user settings, but a workspace value (e.g. `"colaview.theme": "elegant"` in `.vscode/settings.json`) shadows it — `getCurrentTheme()` kept returning the old theme and `pushSlides` recomposed the deck CSS from it. Theme writes now target the workspace when one is open, and theme switches pass the theme name explicitly down to `pushSlides`. Document mode was unaffected because its update message carries the CSS directly.
|
|
74
|
+
|
|
75
|
+
## v0.3.4 (2026-12-01)
|
|
76
|
+
|
|
77
|
+
### 🎬 Slide Preview, Presenting & Exports
|
|
78
|
+
|
|
79
|
+
Merged from the 0.2.x line onto the CodeMirror 6 preview layer (released on main as v0.3.4):
|
|
80
|
+
|
|
81
|
+
- **Slide preview** — a dedicated render layer (`src/slides/`) reusing the upstream `slides.css` line contract; pages split by `<!-- slide: cover -->`-style directives at 1920×1080, switchable inside the preview panel.
|
|
82
|
+
- **Fullscreen presenting** — documents and slides are handed to the system browser (`src/present/`): ←/→ paging, `F` fullscreen, click either half to navigate.
|
|
83
|
+
- **Slide exports** — PDF (one 1920×1080 page each), standalone `.slides.html` with paging/fullscreen, and PPTX (16:9, zero-dependency OOXML).
|
|
84
|
+
- **Localized preview menu** — context-menu labels follow `vscode.env.language`.
|
|
85
|
+
|
|
27
86
|
## v0.3.2 (2026-11-07)
|
|
28
87
|
|
|
29
88
|
### 🐛 PDF/HTML Export Fixed: `md is not defined`
|
|
@@ -46,23 +105,23 @@ Mermaid diagrams looked centered in the preview but sat flush against the left e
|
|
|
46
105
|
|
|
47
106
|
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.
|
|
48
107
|
|
|
49
|
-
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.
|
|
50
|
-
|
|
51
|
-
### 🎨 Mermaid Colors Now Match the Preview in Every Theme
|
|
52
|
-
|
|
53
|
-
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.
|
|
54
|
-
|
|
55
|
-
**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.
|
|
56
|
-
|
|
57
|
-
**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.
|
|
58
|
-
|
|
59
|
-
### 🧹 Removed Ineffective Settings
|
|
60
|
-
|
|
61
|
-
Four entries in the settings page did nothing, and they are now gone:
|
|
62
|
-
|
|
63
|
-
- `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.
|
|
64
|
-
- `colaview.pdfMethod` / `colaview.customThemesPath` — never read by the extension (PDF always uses the local Chrome pipeline, themes always come from the workspace `.themes` directory).
|
|
65
|
-
|
|
108
|
+
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.
|
|
109
|
+
|
|
110
|
+
### 🎨 Mermaid Colors Now Match the Preview in Every Theme
|
|
111
|
+
|
|
112
|
+
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.
|
|
113
|
+
|
|
114
|
+
**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.
|
|
115
|
+
|
|
116
|
+
**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.
|
|
117
|
+
|
|
118
|
+
### 🧹 Removed Ineffective Settings
|
|
119
|
+
|
|
120
|
+
Four entries in the settings page did nothing, and they are now gone:
|
|
121
|
+
|
|
122
|
+
- `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.
|
|
123
|
+
- `colaview.pdfMethod` / `colaview.customThemesPath` — never read by the extension (PDF always uses the local Chrome pipeline, themes always come from the workspace `.themes` directory).
|
|
124
|
+
|
|
66
125
|
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`.
|
|
67
126
|
|
|
68
127
|
### 🐛 Preview: Blocks No Longer Vanish After Viewing Their Source
|
package/esbuild.js
CHANGED
|
@@ -55,6 +55,8 @@ function copyResources() {
|
|
|
55
55
|
const copies = [
|
|
56
56
|
{ src: 'src/preview/webview/index.html', dst: 'out/preview/webview/index.html' },
|
|
57
57
|
{ src: 'src/themes/built-in', dst: 'out/themes/built-in' },
|
|
58
|
+
// 幻灯片版式表(上游 slides.css):预览/放映/PDF 共用
|
|
59
|
+
{ src: 'src/slides/slides.css', dst: 'out/slides/slides.css' },
|
|
58
60
|
];
|
|
59
61
|
|
|
60
62
|
// Copy ColaMD renderer CSS if available
|
package/package.json
CHANGED
|
@@ -1,164 +1,204 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vscode-colaview",
|
|
3
|
-
"displayName": "ColaView MD",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"publisher": "bytechain",
|
|
6
|
-
"description": "ColaMD Preview — Rich Markdown Preview & PDF/HTML Export for VSCode",
|
|
7
|
-
"icon": "icon.png",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/bytechain/vscode-colaview.git"
|
|
11
|
-
},
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"engines": {
|
|
14
|
-
"vscode": "^1.85.0"
|
|
15
|
-
},
|
|
16
|
-
"categories": [
|
|
17
|
-
"Other"
|
|
18
|
-
],
|
|
19
|
-
"activationEvents": [
|
|
20
|
-
"onLanguage:markdown",
|
|
21
|
-
"onCommand:colaview.showPreview",
|
|
22
|
-
"onCommand:colaview.
|
|
23
|
-
"onCommand:colaview.
|
|
24
|
-
"onCommand:colaview.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"command": "colaview.
|
|
51
|
-
"title": "
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"command": "colaview.
|
|
55
|
-
"title": "
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "vscode-colaview",
|
|
3
|
+
"displayName": "ColaView MD",
|
|
4
|
+
"version": "0.4.1",
|
|
5
|
+
"publisher": "bytechain",
|
|
6
|
+
"description": "ColaMD Preview — Rich Markdown Preview & PDF/HTML Export for VSCode",
|
|
7
|
+
"icon": "icon.png",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/bytechain/vscode-colaview.git"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"engines": {
|
|
14
|
+
"vscode": "^1.85.0"
|
|
15
|
+
},
|
|
16
|
+
"categories": [
|
|
17
|
+
"Other"
|
|
18
|
+
],
|
|
19
|
+
"activationEvents": [
|
|
20
|
+
"onLanguage:markdown",
|
|
21
|
+
"onCommand:colaview.showPreview",
|
|
22
|
+
"onCommand:colaview.showSlides",
|
|
23
|
+
"onCommand:colaview.presentDocument",
|
|
24
|
+
"onCommand:colaview.presentSlides",
|
|
25
|
+
"onCommand:colaview.exportPDF",
|
|
26
|
+
"onCommand:colaview.exportHTML",
|
|
27
|
+
"onCommand:colaview.exportWord",
|
|
28
|
+
"onCommand:colaview.exportSlidesPDF",
|
|
29
|
+
"onCommand:colaview.exportSlidesHTML",
|
|
30
|
+
"onCommand:colaview.exportPPTX"
|
|
31
|
+
],
|
|
32
|
+
"main": "./out/extension.js",
|
|
33
|
+
"contributes": {
|
|
34
|
+
"commands": [
|
|
35
|
+
{
|
|
36
|
+
"command": "colaview.showPreview",
|
|
37
|
+
"title": "%colaview.commands.showPreview%",
|
|
38
|
+
"icon": "$(open-preview)"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"command": "colaview.showSlides",
|
|
42
|
+
"title": "%colaview.commands.showSlides%",
|
|
43
|
+
"icon": "$(preview)"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"command": "colaview.presentDocument",
|
|
47
|
+
"title": "%colaview.commands.presentDocument%"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"command": "colaview.presentSlides",
|
|
51
|
+
"title": "%colaview.commands.presentSlides%"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"command": "colaview.exportPDF",
|
|
55
|
+
"title": "%colaview.commands.exportPDF%",
|
|
56
|
+
"icon": "$(export)"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"command": "colaview.exportHTML",
|
|
60
|
+
"title": "%colaview.commands.exportHTML%",
|
|
61
|
+
"icon": "$(export)"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"command": "colaview.exportWord",
|
|
65
|
+
"title": "%colaview.commands.exportWord%",
|
|
66
|
+
"icon": "$(export)"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"command": "colaview.exportSlidesPDF",
|
|
70
|
+
"title": "%colaview.commands.exportSlidesPDF%"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"command": "colaview.exportSlidesHTML",
|
|
74
|
+
"title": "%colaview.commands.exportSlidesHTML%"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"command": "colaview.exportPPTX",
|
|
78
|
+
"title": "%colaview.commands.exportPPTX%"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"command": "colaview.switchTheme",
|
|
82
|
+
"title": "%colaview.commands.switchTheme%"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"command": "colaview.importTheme",
|
|
86
|
+
"title": "%colaview.commands.importTheme%"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"menus": {
|
|
90
|
+
"editor/title": [
|
|
91
|
+
{
|
|
92
|
+
"command": "colaview.showPreview",
|
|
93
|
+
"group": "navigation"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"command": "colaview.showSlides",
|
|
97
|
+
"group": "navigation"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"editor/context": [
|
|
101
|
+
{
|
|
102
|
+
"command": "colaview.showPreview",
|
|
103
|
+
"group": "1_colaview"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"command": "colaview.showSlides",
|
|
107
|
+
"group": "1_colaview"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"explorer/context": [
|
|
111
|
+
{
|
|
112
|
+
"command": "colaview.exportPDF",
|
|
113
|
+
"group": "1_colaview"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"command": "colaview.exportHTML",
|
|
117
|
+
"group": "1_colaview"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"command": "colaview.exportWord",
|
|
121
|
+
"group": "1_colaview"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
"configuration": {
|
|
126
|
+
"title": "ColaView MD",
|
|
127
|
+
"properties": {
|
|
128
|
+
"colaview.theme": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"default": "elegant",
|
|
131
|
+
"enum": [
|
|
132
|
+
"light",
|
|
133
|
+
"dark",
|
|
134
|
+
"elegant",
|
|
135
|
+
"sepia",
|
|
136
|
+
"notion",
|
|
137
|
+
"bear",
|
|
138
|
+
"writer",
|
|
139
|
+
"solarized-dark",
|
|
140
|
+
"nord",
|
|
141
|
+
"gruvbox",
|
|
142
|
+
"dracula",
|
|
143
|
+
"midnight"
|
|
144
|
+
],
|
|
145
|
+
"description": "Visual theme for preview and export"
|
|
146
|
+
},
|
|
147
|
+
"colaview.autoPreview": {
|
|
148
|
+
"type": "boolean",
|
|
149
|
+
"default": false,
|
|
150
|
+
"description": "Auto show preview on opening Markdown"
|
|
151
|
+
},
|
|
152
|
+
"colaview.scrollSync": {
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"default": false,
|
|
155
|
+
"description": "Enable scroll sync between editor and preview"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"keybindings": [
|
|
160
|
+
{
|
|
161
|
+
"command": "colaview.showPreview",
|
|
162
|
+
"key": "ctrl+alt+v",
|
|
163
|
+
"when": "editorLangId == markdown"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"command": "colaview.showSlides",
|
|
167
|
+
"key": "ctrl+alt+s",
|
|
168
|
+
"when": "editorLangId == markdown"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"scripts": {
|
|
173
|
+
"vscode:prepublish": "npm run esbuild-base -- --production",
|
|
174
|
+
"esbuild-base": "node esbuild.js",
|
|
175
|
+
"build": "node esbuild.js",
|
|
176
|
+
"watch": "node esbuild.js --watch",
|
|
177
|
+
"pretest": "npm run build",
|
|
178
|
+
"test": "node ./out/test/runTest.js",
|
|
179
|
+
"package": "vsce package",
|
|
180
|
+
"postinstall": "patch-package"
|
|
181
|
+
},
|
|
182
|
+
"dependencies": {
|
|
183
|
+
"@bytechain.cn/colamd": "2.8.2",
|
|
184
|
+
"docx": "^9.15.2",
|
|
185
|
+
"katex": "^0.16.47",
|
|
186
|
+
"mermaid": "^11.15.0",
|
|
187
|
+
"pele": "^1.13.0",
|
|
188
|
+
"puppeteer-core": "^25.1.0",
|
|
189
|
+
"remark-gfm": "^4.0.1",
|
|
190
|
+
"remark-parse": "^11.0.0",
|
|
191
|
+
"unified": "^11.0.5"
|
|
192
|
+
},
|
|
193
|
+
"devDependencies": {
|
|
194
|
+
"@types/katex": "^0.16.8",
|
|
195
|
+
"@types/node": "^20.0.0",
|
|
196
|
+
"@types/vscode": "^1.85.0",
|
|
197
|
+
"@vscode/test-electron": "^2.4.0",
|
|
198
|
+
"@vscode/vsce": "^3.0.0",
|
|
199
|
+
"esbuild": "^0.28.0",
|
|
200
|
+
"eslint": "^9.0.0",
|
|
201
|
+
"patch-package": "^8.0.1",
|
|
202
|
+
"typescript": "^5.7.0"
|
|
203
|
+
}
|
|
204
|
+
}
|
package/package.nls.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"colaview.commands.showPreview": " Markdown Preview",
|
|
3
|
+
"colaview.commands.showSlides": "Markdown Slides Preview",
|
|
4
|
+
"colaview.commands.presentDocument": "Present: Document Fullscreen",
|
|
5
|
+
"colaview.commands.presentSlides": "Present: Slides Fullscreen",
|
|
6
|
+
"colaview.commands.exportPDF": "Export to PDF...",
|
|
7
|
+
"colaview.commands.exportHTML": "Export to HTML...",
|
|
8
|
+
"colaview.commands.exportWord": "Export to Word...",
|
|
9
|
+
"colaview.commands.exportSlidesPDF": "Export Slides to PDF...",
|
|
10
|
+
"colaview.commands.exportSlidesHTML": "Export Slides to HTML...",
|
|
11
|
+
"colaview.commands.exportPPTX": "Export to PPTX...",
|
|
12
|
+
"colaview.commands.switchTheme": "Switch Preview Theme...",
|
|
13
|
+
"colaview.commands.importTheme": "Import Custom Theme..."
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"colaview.commands.showPreview": "MD-预览",
|
|
3
|
+
"colaview.commands.showSlides": "MD-幻灯片预览",
|
|
4
|
+
"colaview.commands.presentDocument": "全屏显示:文档",
|
|
5
|
+
"colaview.commands.presentSlides": "全屏显示:幻灯片",
|
|
6
|
+
"colaview.commands.exportPDF": "导出到 PDF...",
|
|
7
|
+
"colaview.commands.exportHTML": "导出到 HTML...",
|
|
8
|
+
"colaview.commands.exportWord": "导出到 Word...",
|
|
9
|
+
"colaview.commands.exportSlidesPDF": "幻灯片导出到 PDF...",
|
|
10
|
+
"colaview.commands.exportSlidesHTML": "幻灯片导出到 HTML...",
|
|
11
|
+
"colaview.commands.exportPPTX": "导出到 PPTX...",
|
|
12
|
+
"colaview.commands.switchTheme": "切换预览主题...",
|
|
13
|
+
"colaview.commands.importTheme": "导入自定义主题..."
|
|
14
|
+
}
|
package/src/commands/commands.ts
CHANGED
|
@@ -24,6 +24,54 @@ export function registerCommands(
|
|
|
24
24
|
previewManager.showPreview();
|
|
25
25
|
}),
|
|
26
26
|
|
|
27
|
+
vscode.commands.registerCommand('colaview.showSlides', () => {
|
|
28
|
+
if (!previewManager) {
|
|
29
|
+
vscode.window.showErrorMessage('ColaView: Preview manager not available');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
previewManager.showSlides();
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
vscode.commands.registerCommand('colaview.presentDocument', async () => {
|
|
36
|
+
if (!previewManager) {
|
|
37
|
+
vscode.window.showErrorMessage('ColaView: Preview manager not available');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
await previewManager.handlePresent('document');
|
|
41
|
+
}),
|
|
42
|
+
|
|
43
|
+
vscode.commands.registerCommand('colaview.presentSlides', async () => {
|
|
44
|
+
if (!previewManager) {
|
|
45
|
+
vscode.window.showErrorMessage('ColaView: Preview manager not available');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
await previewManager.handlePresent('slides');
|
|
49
|
+
}),
|
|
50
|
+
|
|
51
|
+
vscode.commands.registerCommand('colaview.exportSlidesPDF', async () => {
|
|
52
|
+
if (!previewManager) {
|
|
53
|
+
vscode.window.showErrorMessage('ColaView: Preview manager not available');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
await previewManager.exportSlidesPDFToFile();
|
|
57
|
+
}),
|
|
58
|
+
|
|
59
|
+
vscode.commands.registerCommand('colaview.exportSlidesHTML', async () => {
|
|
60
|
+
if (!previewManager) {
|
|
61
|
+
vscode.window.showErrorMessage('ColaView: Preview manager not available');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
await previewManager.exportSlidesHTMLToFile();
|
|
65
|
+
}),
|
|
66
|
+
|
|
67
|
+
vscode.commands.registerCommand('colaview.exportPPTX', async () => {
|
|
68
|
+
if (!previewManager) {
|
|
69
|
+
vscode.window.showErrorMessage('ColaView: Preview manager not available');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
await previewManager.exportPPTXFile();
|
|
73
|
+
}),
|
|
74
|
+
|
|
27
75
|
vscode.commands.registerCommand('colaview.exportHTML', async () => {
|
|
28
76
|
const editor = vscode.window.activeTextEditor;
|
|
29
77
|
if (!editor || editor.document.languageId !== 'markdown') {
|