diff --git a/.claude/docs/V1.2.1_STATUS.md b/.claude/docs/V1.2.1_STATUS.md index 907723f5a..4f3f14398 100644 --- a/.claude/docs/V1.2.1_STATUS.md +++ b/.claude/docs/V1.2.1_STATUS.md @@ -637,6 +637,8 @@ Then pushed `v1.2.1` to `origin` at the maintainer's request. **No merge and no **#168 (IDE), thirteenth PR of epic #163: split editor** [confirmed: unit tests (`tabs.test.ts`, split session), the gate, Playwright on Linux at 1280x800: `Ctrl+\` splits, typing in one group updates both and marks one dirty state, `Ctrl+1` focuses the first group, a tab dragged to the other strip moves, the sash resizes, undo clears the dirty mark in both, the split restores after a restart with the deep-analysis scene open (editor column 396 px, groups 156/240), closing the second group's tabs collapses it and `Ctrl+2` reopens it; no horizontal overflow]. `editor/editorGroup.ts` was restructured into documents (one Monaco model, save state, disk watch, lens state), tabs and up to two groups, each with its own Monaco editor, tab strip and placeholder; the breadcrumbs move to the active group. `TabSession` gains optional `second`, `split` and `focus` (same `SESSION_VERSION`, old sessions read as one group). Commands `editor.splitRight` (`CmdOrCtrl+\`), `workbench.focusFirstEditorGroup` (`CmdOrCtrl+1`), `workbench.focusSecondEditorGroup` (`CmdOrCtrl+2`); tab menu item Split Right. Plugin: nothing to do, VS Code splits natively (parity rule covers Code-XR features only). +**#179 (IDE), fourteenth PR of epic #163: Markdown preview** [confirmed: unit tests (`markdown.test.ts`: blocks and their lines, links, images, slugs, `readImage`, `isOpenableExternalLink`), the gate, Playwright on Linux at 1280x800 in dark and light: headings with ids, nested and task lists, a table, a Python block coloured by Monaco, a folder PNG inlined as data:, a remote badge turned into a link, `\n'); + assert.match(blocks[0]?.html ?? '', /'); + fs.writeFileSync(path.join(base, 'outside.png'), Buffer.from([1])); + after(() => fs.rmSync(base, { recursive: true, force: true })); + + it('inlines raster images of the folder only', async () => { + const workspace = await Workspace.open(root); + assert.equal(await workspace.readImage('img/dot.png'), 'data:image/png;base64,iVBORw=='); + assert.equal(await workspace.readImage('img/logo.svg'), null, 'no SVG'); + await assert.rejects(workspace.readImage('../outside.png')); + assert.equal(imageMimeType('a/b.JPG'), 'image/jpeg'); + assert.equal(imageMimeType('a.b/c'), null); + assert.ok(MAX_PREVIEW_IMAGE_BYTES >= 1024 * 1024); + }); + + it('opens only http, https and mailto links outside', () => { + for (const url of ['https://example.com', 'http://localhost:3000/x', 'mailto:a@b.c']) { + assert.equal(isOpenableExternalLink(url), true, url); + } + for (const url of ['file:///etc/passwd', 'javascript:alert(1)', 'smb://host/share', 'not a url', 42, null, `https://x/${'a'.repeat(9000)}`]) { + assert.equal(isOpenableExternalLink(url), false, String(url).slice(0, 30)); + } + }); +}); diff --git a/package-lock.json b/package-lock.json index 604f9e85d..6c4dee0f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,8 +28,10 @@ "@types/node": "^22.20.7", "@xterm/addon-fit": "0.11.0", "@xterm/xterm": "6.0.0", + "dompurify": "3.4.15", "electron": "^45.5.0", "electron-builder": "26.18.1", + "marked": "14.0.0", "material-icon-theme": "^5.40.0", "monaco-editor": "0.57.0", "vite": "^8.3.8",