Compare commits

...
Author SHA1 Message Date
amitwh 02e307f758 docs(claude-md): add tailored CLAUDE.md for master branch
Documents project architecture, Pandoc dependency resolution, build
pipeline (electron-builder, no bundler), security model notes
(contextIsolation: false on this branch), and development commands
extracted from actual package.json and source.

Amit Haridas
2026-06-19 23:18:00 +05:30
amitwh 5ad1d1d4b3 chore(release): bump version to 4.4.3 2026-06-11 21:17:37 +05:30
amitwh f480449301 fix(renderer): resolve syntax errors and undefined electronAPI on startup 2026-06-11 21:15:25 +05:30
amitwh 96df5652d6 fix: resolve list-directory IPC handler closing brace syntax error 2026-05-26 11:39:57 +05:30
amitwh a9e05d2c0f feat: implement Custom Preview CSS, Reveal.js options, Large File Mode, and Interactive PDF Thumbnail Sidebar 2026-05-25 23:11:47 +05:30
amitwh c982b3e90f chore(diagnostics): add logging to _renderPreview to trace markdown rendering
This will help identify whether the issue is:
1. marked.parse returning a Promise instead of string
2. DOMPurify.sanitize failing
3. The preview element not existing
4. Libraries not being loaded

Amit Haridas
2026-05-25 00:32:27 +05:30
amitwh cfaafc07b2 chore(deps): update vulnerable packages to patched versions
Updated packages:
- simple-git 3.32.3 → 3.36.0 (RCE vulnerability)
- fast-uri 3.1.0 → 3.1.2 (host confusion, path traversal)
- dompurify 3.3.1 → 3.4.5 (XSS bypasses)
- mermaid 11.13.0 → 11.15.0 (CSS injection, DoS)
- uuid 11.1.0 → 11.1.1 (buffer bounds check)
- ws 8.20.0 → 8.20.0 (uninitialized memory)
- ip-address 10.1.0 → 10.2.0 (XSS)
- @xmldom/xmldom 0.8.11 → 0.9.10 (XML injection, DoS)
- docx4js 3.3.0 → 2.0.1 (breaks xml2js dep chain)
- brace-expansion (transitive update)

Also applied lint:fix autofix (const correctness).

Amit Haridas
2026-05-25 00:00:28 +05:30
amitwh 94ad99dc4d fix(renderer): ensure tab content visibility after file open
- Add missing updateUI() call at end of openFile() to set .active class
  on tab content. Without this, the CSS rule .tab-content:not(.active)
  { display: none } kept newly opened files invisible.
- Add diagnostic logging to file-opened IPC handler and openFile()
  to trace future file loading issues.
- Add diagnostic logging to openFileFromPath() in main process.

Amit Haridas
2026-05-24 23:54:31 +05:30
amitwh baf644d62b fix(modal): prevent duplicate ModalManager declaration
window.ModalManager was set unconditionally, causing "Identifier
'ModalManager' has already been declared" when script tag in HTML
also loaded ModalManager before renderer.js required it.

Now checks !window.ModalManager before setting.

Amit Haridas
2026-05-22 22:08:06 +05:30
amitwh f9a5420ad2 4.4.1: update version everywhere, fix DOMPurify initialization
- Bump version to 4.4.1
- DOMPurify now initialized with window context (fixes markdown rendering)
- Add 'it' to eslint globals

Amit Haridas
2026-05-22 21:54:05 +05:30
amitwh f8361174f2 chore: add it to eslint globals, add debug logging to createEditor
Amit Haridas
2026-05-22 21:42:34 +05:30
amitwh 64df0660c8 fix(renderer): initialize DOMPurify with window context
require('dompurify') returns a factory function, not a sanitizer
instance. Calling .sanitize() on the factory threw a TypeError,
which was caught by the preview renderer's try-catch and displayed
a generic "Error rendering preview" message. Fix by invoking the
factory with the renderer's window object.

Amit Haridas
2026-05-03 16:38:47 +05:30
amitwhandCopilot bbfa2a38e9 security: add permission request handler for security isolation
Restrict Electron permission requests to only clipboard operations.
Deny: camera, microphone, geolocation, notifications, and all other
permissions by default.

Implements setPermissionRequestHandler on web-contents-created event
to enforce security policy early in the app lifecycle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 17:19:52 +05:30
amitwhandCopilot 94ec3f45ce fix: show dynamic app version everywhere in UI
- Add get-app-version IPC handler in main.js (returns app.getVersion())
- Expose electronAPI.getAppVersion() in preload.js
- index.html: replace hardcoded v4.2.0 span with dynamic population
  from getAppVersion() in DOMContentLoaded
- welcome.js: accept appVersion param instead of hardcoded 4.1.0
- renderer.js: pass live version to createWelcomeContent()
- main.js about screen: use app.getVersion() instead of hardcoded 4.1.0
- Update stale @version 4.1.0 JSDoc comments to 4.3.0

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-23 23:31:18 +05:30
21 changed files with 1671 additions and 550 deletions
+103
View File
@@ -0,0 +1,103 @@
# CLAUDE.md — MarkdownConverter (master)
> General code-quality, JavaScript, git, security, and testing standards are in the **global CLAUDE.md**. This file holds project- and branch-specific notes.
## Project Overview
Electron desktop app for Markdown editing and universal file conversion powered by Pandoc. Cross-platform (Win/macOS/Linux). Features: multi-tab editor with live preview, 25+ themes, PDF viewer/editor (merge/split/compress/rotate/watermark/password), export to 20+ formats (PDF/DOCX/ODT/EPUB/HTML/LaTeX/RTF/PPTX), batch conversion, syntax highlighting, diagram support (Mermaid), Git integration, and a plugin system.
- **Version:** 4.4.3
- **License:** MIT
- **App ID:** `com.concreteinfo.markdownconverter`
## Branch Specifics
This is the **primary/release branch** — a vanilla JavaScript Electron app with no bundler or framework in the renderer. The renderer is a single large `renderer.js` (5,300+ lines) loaded directly via `src/index.html`. All UI is hand-rolled DOM manipulation.
## Architecture
### Main Process (`src/main.js` — 4,260 lines)
Monolithic main process file. Contains all IPC handlers, Pandoc invocation, file operations, menu definitions (600+ lines), and window lifecycle. Key modules extracted:
- `src/main/PDFOperations.js` — PDF manipulation via `pdf-lib` (merge, split, compress, rotate, delete, reorder, watermark, encrypt, decrypt, permissions)
- `src/main/GitOperations.js` — Git status/stage/commit/log via `simple-git`
### Renderer (`src/renderer.js` — 5,361 lines)
Vanilla JS, no framework. Directly manipulates DOM. Loads CodeMirror 6 via `src/editor/codemirror-setup.js`. Uses `marked` + `highlight.js` + `DOMPurify` + `mermaid` for rendering. Lazy-loads sidebar panels, REPL, command palette, zen mode.
### Preload (`src/preload.js` — 448 lines)
Exists as IPC bridge, but **`contextIsolation: false` and `nodeIntegration: true`** — the renderer has full Node access. Preload is effectively a thin passthrough.
### Security Model
- `contextIsolation: false` + `nodeIntegration: true` (legacy; the react-electron branch fixes this)
- Pandoc invoked via `execFile` (not `exec`) to prevent shell injection
- Path traversal protection: `validatePath()`, `resolveWritablePath()`, blocks sensitive system dirs
- Permission handler only allows `clipboard-read`/`clipboard-write`
- Rate limiter on conversions (2-second minimum interval)
- File size limit: 50MB
- Error message sanitization strips absolute paths
### Plugin System (`src/plugins/`)
Manifest-based discovery (`manifest.json`). Built-in `writing-studio` plugin with sprint/goal/snapshot management. Plugin API exposed via `src/plugins/plugin-api.js`.
### Settings
Custom JSON file store at `<userData>/settings.json` (NOT `electron-store` despite the dependency). Recent files at `<userData>/recent-files.json`.
## System Dependencies
| Dependency | Required | Notes |
|---|---|---|
| **Node.js** | >= 20 | Electron 41 bundles Node 20.x |
| **Pandoc** | Yes (for exports) | Downloaded to `bin/<platform>/pandoc` via `scripts/download-tools.js` (v3.9.0.2). Falls back to system PATH. Must be present for DOCX/ODT/EPUB/LaTeX/PPTX export. |
| **FFmpeg** | Bundled | `ffmpeg-static` npm package; `asarUnpacked` for packaged builds |
| **MiKTeX / TeX Live** | Optional | For LaTeX PDF export; MiKTeX PATH injected on Windows automatically |
| **ImageMagick** | Optional | Linux image conversion; listed as deb dependency |
| **LibreOffice** | Optional | Enhanced document conversion; listed as deb dependency |
## Development Commands
```bash
npm start # Launch Electron app (dev mode)
npm test # Jest test suite
npm test:watch # Jest in watch mode
npm test:coverage # Jest with coverage report
npm run lint # ESLint check (src + tests)
npm run lint:fix # ESLint auto-fix
npm run format # Prettier write
npm run format:check # Prettier check only
npm run download-tools # Download Pandoc binaries to bin/
npm run generate-icons # Generate app icons via sharp
```
## Build & Package
**Tool:** `electron-builder` (v26.0.12), config inline in `package.json` (no separate config file).
| Target | Platforms |
|---|---|
| `npm run build` | electron-builder (default platform) |
| `npm run build:win` | Windows: NSIS installer + portable + zip (x64) |
| `npm run build:mac` | macOS: default dmg |
| `npm run build:linux` | Linux: deb + AppImage + snap |
| `npm run dist` | Build without publish |
| `npm run dist:all` | Build for all platforms |
**Bundled with builds:** Pandoc binary per platform. FFmpeg via `ffmpeg-static` (asarUnpacked). NSIS installer uses custom script at `scripts/nsis-installer.nsh`.
**Output:** `dist/` directory.
**CI:** GitHub Actions workflows in `.github/workflows/` (ci.yml, release.yml).
## Project Conventions / Gotchas
- **No bundler/transpilation.** The app uses vanilla CommonJS JavaScript. `src/main.js` is loaded directly by Electron. No webpack, no Vite, no TypeScript, no Babel.
- **Monolithic files.** `main.js` (4,260 lines) and `renderer.js` (5,361 lines) contain most logic. Not ideal but is the current state of this branch.
- **CodeMirror 6** for the editor, configured in `src/editor/codemirror-setup.js`.
- **PDF rendering** uses `pdfjs-dist`; **PDF manipulation** uses `pdf-lib` in the main process.
- **Renderer security is weak** — full Node access in renderer. Do NOT introduce new privileged renderer code without understanding this.
- **Pandoc is external.** Must be installed separately or downloaded via `npm run download-tools`. HTML and built-in PDF export work without Pandoc; other formats require it.
- **PDF export fallback chain:** xelatex -> pdflatex -> lualatex -> Electron built-in `printToPDF()`.
- **ESLint flat config** (`eslint.config.js`) with ECMAScript 2022. Prettier with 2-space indent, single quotes, semicolons, 100-char width.
- **Tests:** Jest with jsdom environment, 15% coverage threshold. 24 test files in `tests/`.
- **File associations:** `.md`, `.markdown`, `.pdf` registered at install.
- **Single instance lock** enforced via `app.requestSingleInstanceLock()`.
- **Adapters layer** (`src/adapters/`) abstracts file system operations for potential future non-Electron targets.
+1
View File
@@ -75,6 +75,7 @@ module.exports = [
jest: 'readonly',
describe: 'readonly',
test: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
+153 -501
View File
@@ -1,12 +1,12 @@
{
"name": "markdown-converter",
"version": "4.2.0",
"version": "4.4.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "markdown-converter",
"version": "4.2.0",
"version": "4.4.1",
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.20.1",
@@ -26,7 +26,7 @@
"codemirror": "^6.0.2",
"core-util-is": "^1.0.3",
"docx": "^9.6.0",
"docx4js": "^3.3.0",
"docx4js": "^2.0.1",
"dompurify": "^3.3.1",
"electron-store": "^10.1.0",
"ffmpeg-static": "^5.3.0",
@@ -619,45 +619,12 @@
"integrity": "sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA==",
"license": "MIT"
},
"node_modules/@chevrotain/cst-dts-gen": {
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-11.1.2.tgz",
"integrity": "sha512-XTsjvDVB5nDZBQB8o0o/0ozNelQtn2KrUVteIHSlPd2VAV2utEb6JzyCJaJ8tGxACR4RiBNWy5uYUHX2eji88Q==",
"license": "Apache-2.0",
"dependencies": {
"@chevrotain/gast": "11.1.2",
"@chevrotain/types": "11.1.2",
"lodash-es": "4.17.23"
}
},
"node_modules/@chevrotain/gast": {
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-11.1.2.tgz",
"integrity": "sha512-Z9zfXR5jNZb1Hlsd/p+4XWeUFugrHirq36bKzPWDSIacV+GPSVXdk+ahVWZTwjhNwofAWg/sZg58fyucKSQx5g==",
"license": "Apache-2.0",
"dependencies": {
"@chevrotain/types": "11.1.2",
"lodash-es": "4.17.23"
}
},
"node_modules/@chevrotain/regexp-to-ast": {
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@chevrotain/regexp-to-ast/-/regexp-to-ast-11.1.2.tgz",
"integrity": "sha512-nMU3Uj8naWer7xpZTYJdxbAs6RIv/dxYzkYU8GSwgUtcAAlzjcPfX1w+RKRcYG8POlzMeayOQ/znfwxEGo5ulw==",
"license": "Apache-2.0"
},
"node_modules/@chevrotain/types": {
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-11.1.2.tgz",
"integrity": "sha512-U+HFai5+zmJCkK86QsaJtoITlboZHBqrVketcO2ROv865xfCMSFpELQoz1GkX5GzME8pTa+3kbKrZHQtI0gdbw==",
"license": "Apache-2.0"
},
"node_modules/@chevrotain/utils": {
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-11.1.2.tgz",
"integrity": "sha512-4mudFAQ6H+MqBTfqLmU7G1ZwRzCLfJEooL/fsF6rCX5eePMbGhoy5n4g+G4vlh2muDcsCTJtL+uKbOzWxs5LHA==",
"license": "Apache-2.0"
},
"node_modules/@codemirror/autocomplete": {
"version": "6.20.1",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.1.tgz",
@@ -1008,9 +975,9 @@
"license": "MIT"
},
"node_modules/@electron/asar/node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1312,9 +1279,9 @@
"license": "MIT"
},
"node_modules/@electron/universal/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1398,9 +1365,9 @@
}
},
"node_modules/@electron/windows-sign/node_modules/fs-extra": {
"version": "11.3.4",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.4.tgz",
"integrity": "sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA==",
"version": "11.3.5",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.5.tgz",
"integrity": "sha512-eKpRKAovdpZtR1WopLHxlBWvAgPny3c4gX1G5Jhwmmw4XJj0ifSD5qB5TOo8hmA0wlRKDAOAhEE1yVPgs6Fgcg==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -1415,9 +1382,9 @@
}
},
"node_modules/@electron/windows-sign/node_modules/jsonfile": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz",
"integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==",
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",
"integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -1547,9 +1514,9 @@
"license": "MIT"
},
"node_modules/@eslint/config-array/node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1628,9 +1595,9 @@
"license": "MIT"
},
"node_modules/@eslint/eslintrc/node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2777,9 +2744,9 @@
"license": "MIT"
},
"node_modules/@jest/reporters/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3184,12 +3151,12 @@
"license": "MIT"
},
"node_modules/@mermaid-js/parser": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@mermaid-js/parser/-/parser-1.0.1.tgz",
"integrity": "sha512-opmV19kN1JsK0T6HhhokHpcVkqKpF+x2pPDKKM2ThHtZAB5F4PROopk0amuVYK5qMrIA4erzpNm8gmPNJgMDxQ==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@mermaid-js/parser/-/parser-1.1.1.tgz",
"integrity": "sha512-VuHdsYMK1bT6X2JbcAaWAhugTRvRBRyuZgd+c22swUeI9g/ntaxF7CY7dYarhZovofCbUNO0G7JesfmNtjYOCw==",
"license": "MIT",
"dependencies": {
"langium": "^4.0.0"
"@chevrotain/types": "~11.1.1"
}
},
"node_modules/@napi-rs/canvas": {
@@ -3559,6 +3526,21 @@
"url": "https://opencollective.com/pkgr"
}
},
"node_modules/@simple-git/args-pathspec": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@simple-git/args-pathspec/-/args-pathspec-1.0.3.tgz",
"integrity": "sha512-ngJMaHlsWDTfjyq9F3VIQ8b7NXbBLq5j9i5bJ6XLYtD6qlDXT7fdKY2KscWWUF8t18xx052Y/PUO1K1TRc9yKA==",
"license": "MIT"
},
"node_modules/@simple-git/argv-parser": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@simple-git/argv-parser/-/argv-parser-1.1.1.tgz",
"integrity": "sha512-Q9lBcfQ+VQCpQqGJFHe5yooOS5hGdLFFbJ5R+R5aDsnkPCahtn1hSkMcORX65J2Z5lxSkD0lQorMsncuBQxYUw==",
"license": "MIT",
"dependencies": {
"@simple-git/args-pathspec": "^1.0.3"
}
},
"node_modules/@sinclair/typebox": {
"version": "0.34.48",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.48.tgz",
@@ -4461,9 +4443,9 @@
}
},
"node_modules/@xmldom/xmldom": {
"version": "0.8.11",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz",
"integrity": "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==",
"version": "0.8.13",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.13.tgz",
"integrity": "sha512-KRYzxepc14G/CEpEGc3Yn+JKaAeT63smlDr+vjB8jRfgTBBI9wRj/nkQEO+ucV8p8I9bfKLWp37uHgFrbntPvw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -5132,12 +5114,6 @@
"readable-stream": "^3.4.0"
}
},
"node_modules/boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
"license": "ISC"
},
"node_modules/boolean": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
@@ -5148,9 +5124,9 @@
"optional": true
},
"node_modules/brace-expansion": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
"integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -5363,9 +5339,9 @@
"license": "MIT"
},
"node_modules/cacache/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -5527,22 +5503,6 @@
"integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",
"license": "Apache-2.0"
},
"node_modules/cfb": {
"version": "0.12.1",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-0.12.1.tgz",
"integrity": "sha512-cP+4A0tTqtyza5gJwNwDetZ8FPjl0gPLE7mIxGKyUzOS6HkM23WaAWW/l3t7jIQSMqVXroa09Ey0lo7gV8LNxw==",
"license": "Apache-2.0",
"dependencies": {
"commander": "~2.11.0",
"printj": "~1.1.0"
},
"bin": {
"cfb": "bin/cfb.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -5570,59 +5530,6 @@
"node": ">=10"
}
},
"node_modules/cheerio": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz",
"integrity": "sha512-8/MzidM6G/TgRelkzDG13y3Y9LxBjCb+8yOEZ9+wwq5gVF2w2pV0wmHvjfT0RvuxGyR7UEuK36r+yYMbT4uKgA==",
"license": "MIT",
"dependencies": {
"css-select": "~1.2.0",
"dom-serializer": "~0.1.0",
"entities": "~1.1.1",
"htmlparser2": "^3.9.1",
"lodash.assignin": "^4.0.9",
"lodash.bind": "^4.1.4",
"lodash.defaults": "^4.0.1",
"lodash.filter": "^4.4.0",
"lodash.flatten": "^4.2.0",
"lodash.foreach": "^4.3.0",
"lodash.map": "^4.4.0",
"lodash.merge": "^4.4.0",
"lodash.pick": "^4.2.1",
"lodash.reduce": "^4.4.0",
"lodash.reject": "^4.4.0",
"lodash.some": "^4.4.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/chevrotain": {
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.1.2.tgz",
"integrity": "sha512-opLQzEVriiH1uUQ4Kctsd49bRoFDXGGSC4GUqj7pGyxM3RehRhvTlZJc1FL/Flew2p5uwxa1tUDWKzI4wNM8pg==",
"license": "Apache-2.0",
"dependencies": {
"@chevrotain/cst-dts-gen": "11.1.2",
"@chevrotain/gast": "11.1.2",
"@chevrotain/regexp-to-ast": "11.1.2",
"@chevrotain/types": "11.1.2",
"@chevrotain/utils": "11.1.2",
"lodash-es": "4.17.23"
}
},
"node_modules/chevrotain-allstar": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.3.1.tgz",
"integrity": "sha512-b7g+y9A0v4mxCW1qUhf3BSVPg+/NvGErk/dOkrDaHA0nQIQGAtrOjlX//9OQtRlSCy+x9rfB5N8yC71lH1nvMw==",
"license": "MIT",
"dependencies": {
"lodash-es": "^4.17.21"
},
"peerDependencies": {
"chevrotain": "^11.0.0"
}
},
"node_modules/chownr": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
@@ -5777,41 +5684,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/color": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"license": "MIT",
"dependencies": {
"color-convert": "^1.9.3",
"color-string": "^1.6.0"
}
},
"node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"license": "MIT",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"license": "MIT"
},
"node_modules/color-string": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
"license": "MIT",
"dependencies": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -5826,10 +5698,16 @@
}
},
"node_modules/commander": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==",
"license": "MIT"
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": "^12.20.0 || >=14"
}
},
"node_modules/compare-version": {
"version": "0.1.2",
@@ -6046,27 +5924,6 @@
"utrie": "^1.0.2"
}
},
"node_modules/css-select": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
"integrity": "sha512-dUQOBoqdR7QwV90WysXPLXG5LO7nhYBgiWVfxF80DKPF8zx1t/pUd2FYy73emg3zrjtM6dzmYgbHKfV2rxiHQA==",
"license": "BSD-like",
"dependencies": {
"boolbase": "~1.0.0",
"css-what": "2.1",
"domutils": "1.5.1",
"nth-check": "~1.0.1"
}
},
"node_modules/css-what": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz",
"integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==",
"license": "BSD-2-Clause",
"engines": {
"node": "*"
}
},
"node_modules/cssstyle": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz",
@@ -6862,9 +6719,9 @@
"license": "MIT"
},
"node_modules/dir-compare/node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -6985,16 +6842,14 @@
}
},
"node_modules/docx4js": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/docx4js/-/docx4js-3.3.0.tgz",
"integrity": "sha512-n+EGNivVW1IqUjkHDCLb7/w2mW47/23PqTbQN0V++WaCyYYMwjAKsDdhUt1TMB67/v5KQS4abkxab1uu4zCtIQ==",
"license": "MIT",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/docx4js/-/docx4js-2.0.1.tgz",
"integrity": "sha512-wmo3wCPkz4bTebRLYRBolU2SOmZHK1sZKiz/L96aHaqRhPD79zF8RzUxOveml4k0Hgm2kbPoulWklta6OMeKTQ==",
"license": "GPL",
"dependencies": {
"cfb": "^0.12.1",
"cheerio": "^0.22.0",
"color": "^3.1.0",
"htmlparser2": "^3.9.2",
"jszip": "^2.6.0"
"jszip": "^2.6.0",
"sax": "^1.2.1",
"xml2js": "^0.4.17"
}
},
"node_modules/dom-accessibility-api": {
@@ -7004,49 +6859,15 @@
"dev": true,
"license": "MIT"
},
"node_modules/dom-serializer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
"integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==",
"license": "MIT",
"dependencies": {
"domelementtype": "^1.3.0",
"entities": "^1.1.1"
}
},
"node_modules/domelementtype": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
"integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==",
"license": "BSD-2-Clause"
},
"node_modules/domhandler": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz",
"integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==",
"license": "BSD-2-Clause",
"dependencies": {
"domelementtype": "1"
}
},
"node_modules/dompurify": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.3.tgz",
"integrity": "sha512-Oj6pzI2+RqBfFG+qOaOLbFXLQ90ARpcGG6UePL82bJLtdsa6CYJD7nmiU8MW9nQNOtCHV3lZ/Bzq1X0QYbBZCA==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.5.tgz",
"integrity": "sha512-OrwIBKsdNSVEeubdJ1HBv/wNENRM9ytAVCv7YXt//A3vPdVMNuACRqK9mXCGCBW2ln7BT/A4X0jXHo2Gu89miA==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
}
},
"node_modules/domutils": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
"integrity": "sha512-gSu5Oi/I+3wDENBsOWBiRK1eoGxcywYSqg3rR960/+EfY0CF4EX1VPkgHOZ3WiS/Jg2DtliF6BhWcHlfpYUcGw==",
"dependencies": {
"dom-serializer": "0",
"domelementtype": "1"
}
},
"node_modules/dot-prop": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-9.0.0.tgz",
@@ -7399,12 +7220,6 @@
"once": "^1.4.0"
}
},
"node_modules/entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==",
"license": "BSD-2-Clause"
},
"node_modules/env-paths": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
@@ -7480,6 +7295,16 @@
"node": ">= 0.4"
}
},
"node_modules/es-toolkit": {
"version": "1.46.1",
"resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.46.1.tgz",
"integrity": "sha512-5eNtXOs3tbfxXOj04tjjseeWkRWaoCjdEI+96DgwzZoe6c9juL49pXlzAFTI72aWC9Y8p7168g6XIKjh7k6pyQ==",
"license": "MIT",
"workspaces": [
"docs",
"benchmarks"
]
},
"node_modules/es6-error": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
@@ -7656,9 +7481,9 @@
"license": "MIT"
},
"node_modules/eslint/node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -7900,9 +7725,9 @@
}
},
"node_modules/fast-uri": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz",
"integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz",
"integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==",
"funding": [
{
"type": "github",
@@ -8031,9 +7856,9 @@
"license": "MIT"
},
"node_modules/filelist/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -8343,9 +8168,9 @@
"license": "MIT"
},
"node_modules/glob/node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -8624,20 +8449,6 @@
"jspdf": "^4.0.0"
}
},
"node_modules/htmlparser2": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
"integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==",
"license": "MIT",
"dependencies": {
"domelementtype": "^1.3.1",
"domhandler": "^2.3.0",
"domutils": "^1.5.1",
"entities": "^1.1.1",
"inherits": "^2.0.1",
"readable-stream": "^3.1.1"
}
},
"node_modules/http-cache-semantics": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz",
@@ -8860,9 +8671,9 @@
"license": "MIT"
},
"node_modules/ip-address": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz",
"integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz",
"integrity": "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -9320,9 +9131,9 @@
"license": "MIT"
},
"node_modules/jest-config/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -9892,9 +9703,9 @@
"license": "MIT"
},
"node_modules/jest-runtime/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
"integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -10417,23 +10228,6 @@
"resolved": "https://registry.npmjs.org/khroma/-/khroma-2.1.0.tgz",
"integrity": "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw=="
},
"node_modules/langium": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/langium/-/langium-4.2.1.tgz",
"integrity": "sha512-zu9QWmjpzJcomzdJQAHgDVhLGq5bLosVak1KVa40NzQHXfqr4eAHupvnPOVXEoLkg6Ocefvf/93d//SB7du4YQ==",
"license": "MIT",
"dependencies": {
"chevrotain": "~11.1.1",
"chevrotain-allstar": "~0.3.1",
"vscode-languageserver": "~9.0.1",
"vscode-languageserver-textdocument": "~1.0.11",
"vscode-uri": "~3.1.0"
},
"engines": {
"node": ">=20.10.0",
"npm": ">=10.2.3"
}
},
"node_modules/layout-base": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/layout-base/-/layout-base-1.0.2.tgz",
@@ -10523,9 +10317,9 @@
}
},
"node_modules/lodash": {
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
"integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
"dev": true,
"license": "MIT"
},
@@ -10535,77 +10329,11 @@
"integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==",
"license": "MIT"
},
"node_modules/lodash.assignin": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz",
"integrity": "sha512-yX/rx6d/UTVh7sSVWVSIMjfnz95evAgDFdb1ZozC35I9mSFCkmzptOzevxjgbQUsc78NR44LVHWjsoMQXy9FDg==",
"license": "MIT"
},
"node_modules/lodash.bind": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz",
"integrity": "sha512-lxdsn7xxlCymgLYo1gGvVrfHmkjDiyqVv62FAeF2i5ta72BipE1SLxw8hPEPLhD4/247Ijw07UQH7Hq/chT5LA==",
"license": "MIT"
},
"node_modules/lodash.defaults": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
"integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==",
"license": "MIT"
},
"node_modules/lodash.filter": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz",
"integrity": "sha512-pXYUy7PR8BCLwX5mgJ/aNtyOvuJTdZAo9EQFUvMIYugqmJxnrYaANvTbgndOzHSCSR0wnlBBfRXJL5SbWxo3FQ==",
"license": "MIT"
},
"node_modules/lodash.flatten": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz",
"integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==",
"license": "MIT"
},
"node_modules/lodash.foreach": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz",
"integrity": "sha512-aEXTF4d+m05rVOAUG3z4vZZ4xVexLKZGF0lIxuHZ1Hplpk/3B6Z1+/ICICYRLm7c41Z2xiejbkCkJoTlypoXhQ==",
"license": "MIT"
},
"node_modules/lodash.map": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz",
"integrity": "sha512-worNHGKLDetmcEYDvh2stPCrrQRkP20E4l0iIS7F8EvzMqBBi7ltvFN5m1HvTf1P7Jk1txKhvFcmYsCr8O2F1Q==",
"license": "MIT"
},
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"license": "MIT"
},
"node_modules/lodash.pick": {
"name": "lodash",
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
"license": "MIT"
},
"node_modules/lodash.reduce": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz",
"integrity": "sha512-6raRe2vxCYBhpBu+B+TtNGUzah+hQjVdu3E17wfusjyrXBka2nBS8OH/gjVZ5PvHOhWmIZTYri09Z6n/QfnNMw==",
"license": "MIT"
},
"node_modules/lodash.reject": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz",
"integrity": "sha512-qkTuvgEzYdyhiJBx42YPzPo71R1aEr0z79kAv7Ixg8wPFEjgRgJdUsGMG3Hf3OYSF/kHI79XhNlt+5Ar6OzwxQ==",
"license": "MIT"
},
"node_modules/lodash.some": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz",
"integrity": "sha512-j7MJE+TuT51q9ggt4fSgVqro163BEFjAt3u97IqU+JA2DkWl80nFTrowzLpZ/BnpN7rrl0JA/593NAdd8p/scQ==",
"dev": true,
"license": "MIT"
},
"node_modules/log-symbols": {
@@ -10782,14 +10510,14 @@
"license": "MIT"
},
"node_modules/mermaid": {
"version": "11.13.0",
"resolved": "https://registry.npmjs.org/mermaid/-/mermaid-11.13.0.tgz",
"integrity": "sha512-fEnci+Immw6lKMFI8sqzjlATTyjLkRa6axrEgLV2yHTfv8r+h1wjFbV6xeRtd4rUV1cS4EpR9rwp3Rci7TRWDw==",
"version": "11.15.0",
"resolved": "https://registry.npmjs.org/mermaid/-/mermaid-11.15.0.tgz",
"integrity": "sha512-pTMbcf3rWdtLiYGpmoTjHEpeY8seiy6sR+9nD7LOs8KfUbHE4lOUAprTRqRAcWSQ6MQpdX+YEsxShtGsINtPtw==",
"license": "MIT",
"dependencies": {
"@braintree/sanitize-url": "^7.1.1",
"@iconify/utils": "^3.0.2",
"@mermaid-js/parser": "^1.0.1",
"@mermaid-js/parser": "^1.1.1",
"@types/d3": "^7.4.3",
"@upsetjs/venn.js": "^2.0.0",
"cytoscape": "^3.33.1",
@@ -10800,14 +10528,14 @@
"dagre-d3-es": "7.0.14",
"dayjs": "^1.11.19",
"dompurify": "^3.3.1",
"es-toolkit": "^1.45.1",
"katex": "^0.16.25",
"khroma": "^2.1.0",
"lodash-es": "^4.17.23",
"marked": "^16.3.0",
"roughjs": "^4.6.6",
"stylis": "^4.3.6",
"ts-dedent": "^2.2.0",
"uuid": "^11.1.0"
"uuid": "^11.1.0 || ^12 || ^13 || ^14.0.0"
}
},
"node_modules/mermaid/node_modules/marked": {
@@ -11331,18 +11059,6 @@
"node": ">=8"
}
},
"node_modules/nth-check": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
"integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
"license": "BSD-2-Clause",
"dependencies": {
"boolbase": "^1.0.0"
},
"funding": {
"url": "https://github.com/fb55/nth-check?sponsor=1"
}
},
"node_modules/nwsapi": {
"version": "2.2.23",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.23.tgz",
@@ -11894,18 +11610,6 @@
"node": ">=14.0.0"
}
},
"node_modules/postject/node_modules/commander": {
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": "^12.20.0 || >=14"
}
},
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -11973,18 +11677,6 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/printj": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz",
"integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==",
"license": "Apache-2.0",
"bin": {
"printj": "bin/printj.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/proc-log": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz",
@@ -12535,13 +12227,15 @@
"license": "ISC"
},
"node_modules/simple-git": {
"version": "3.33.0",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.33.0.tgz",
"integrity": "sha512-D4V/tGC2sjsoNhoMybKyGoE+v8A60hRawKQ1iFRA1zwuDgGZCBJ4ByOzZ5J8joBbi4Oam0qiPH+GhzmSBwbJng==",
"version": "3.36.0",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.36.0.tgz",
"integrity": "sha512-cGQjLjK8bxJw4QuYT7gxHw3/IouVESbhahSsHrX97MzCL1gu2u7oy38W6L2ZIGECEfIBG4BabsWDPjBxJENv9Q==",
"license": "MIT",
"dependencies": {
"@kwsites/file-exists": "^1.1.1",
"@kwsites/promise-deferred": "^1.1.1",
"@simple-git/args-pathspec": "^1.0.3",
"@simple-git/argv-parser": "^1.1.0",
"debug": "^4.4.0"
},
"funding": {
@@ -12549,21 +12243,6 @@
"url": "https://github.com/steveukx/git-js?sponsor=1"
}
},
"node_modules/simple-swizzle": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.4.tgz",
"integrity": "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw==",
"license": "MIT",
"dependencies": {
"is-arrayish": "^0.3.1"
}
},
"node_modules/simple-swizzle/node_modules/is-arrayish": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.4.tgz",
"integrity": "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA==",
"license": "MIT"
},
"node_modules/simple-update-notifier": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
@@ -13056,9 +12735,9 @@
"license": "MIT"
},
"node_modules/test-exclude/node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -13464,16 +13143,16 @@
}
},
"node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.0.tgz",
"integrity": "sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
"uuid": "dist-node/bin/uuid"
}
},
"node_modules/v8-to-istanbul": {
@@ -13515,55 +13194,6 @@
"license": "MIT",
"optional": true
},
"node_modules/vscode-jsonrpc": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz",
"integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==",
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/vscode-languageserver": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz",
"integrity": "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==",
"license": "MIT",
"dependencies": {
"vscode-languageserver-protocol": "3.17.5"
},
"bin": {
"installServerIntoExtension": "bin/installServerIntoExtension"
}
},
"node_modules/vscode-languageserver-protocol": {
"version": "3.17.5",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz",
"integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==",
"license": "MIT",
"dependencies": {
"vscode-jsonrpc": "8.2.0",
"vscode-languageserver-types": "3.17.5"
}
},
"node_modules/vscode-languageserver-textdocument": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz",
"integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==",
"license": "MIT"
},
"node_modules/vscode-languageserver-types": {
"version": "3.17.5",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz",
"integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==",
"license": "MIT"
},
"node_modules/vscode-uri": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.1.0.tgz",
"integrity": "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==",
"license": "MIT"
},
"node_modules/w3c-keyname": {
"version": "2.2.8",
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
@@ -13755,9 +13385,9 @@
}
},
"node_modules/ws": {
"version": "8.20.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",
"integrity": "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==",
"version": "8.21.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
"integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
"dev": true,
"license": "MIT",
"engines": {
@@ -13804,6 +13434,28 @@
"node": ">=18"
}
},
"node_modules/xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"license": "MIT",
"dependencies": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/xml2js/node_modules/xmlbuilder": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
"license": "MIT",
"engines": {
"node": ">=4.0"
}
},
"node_modules/xmlbuilder": {
"version": "15.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",
+10 -4
View File
@@ -1,6 +1,6 @@
{
"name": "markdown-converter",
"version": "4.3.0",
"version": "4.4.3",
"description": "Professional Markdown editor and universal file converter with PDF editing, batch processing, and syntax highlighting",
"main": "src/main.js",
"scripts": {
@@ -73,7 +73,7 @@
"codemirror": "^6.0.2",
"core-util-is": "^1.0.3",
"docx": "^9.6.0",
"docx4js": "^3.3.0",
"docx4js": "^2.0.1",
"dompurify": "^3.3.1",
"electron-store": "^10.1.0",
"ffmpeg-static": "^5.3.0",
@@ -170,7 +170,10 @@
"verifyUpdateCodeSignature": false,
"signAndEditExecutable": false,
"extraFiles": [
{ "from": "bin/win32/pandoc.exe", "to": "bin/pandoc.exe" }
{
"from": "bin/win32/pandoc.exe",
"to": "bin/pandoc.exe"
}
]
},
"nsis": {
@@ -198,7 +201,10 @@
"category": "Utility",
"maintainer": "ConcreteInfo <amit.wh@gmail.com>",
"extraFiles": [
{ "from": "bin/linux/pandoc", "to": "bin/pandoc" }
{
"from": "bin/linux/pandoc",
"to": "bin/pandoc"
}
]
},
"deb": {
+1 -1
View File
@@ -4,7 +4,7 @@
* Implements file system operations for Electron using IPC.
* This abstracts file operations to enable easier testing and migration.
*
* @version 4.1.0
* @version 4.4.1
*/
/**
+1 -1
View File
@@ -5,7 +5,7 @@
* Adapters abstract file system, conversion, and system operations
* to enable easier testing and future platform migration.
*
* @version 4.1.0
* @version 4.4.1
*/
/**
+5
View File
@@ -59,6 +59,11 @@ const jetBrainsMonoTheme = EditorView.theme({
* @returns {EditorView} the created editor view
*/
function createEditor(parentElement, options = {}) {
console.log('[createEditor] Called with parentElement:', parentElement?.id, 'dimensions:', parentElement?.clientWidth, 'x', parentElement?.clientHeight);
if (!parentElement) {
console.error('[createEditor] ERROR: parentElement is null or undefined!');
return null;
}
const {
content = '',
onChange = () => {},
+58 -1
View File
@@ -31,7 +31,7 @@
<span class="app-title">MarkdownConverter</span>
</div>
<div class="app-header-right">
<span class="app-version">v4.2.0</span>
<span class="app-version" id="app-version-display"></span>
</div>
</div>
<div class="tab-bar" id="tab-bar" role="tablist" aria-label="Document tabs">
@@ -288,6 +288,52 @@
</div>
</div>
<div class="export-section revealjs-only" style="display: none;">
<label>Reveal.js Options:</label>
<div class="form-row">
<label for="reveal-theme">Slide Theme:</label>
<select id="reveal-theme">
<option value="black">Black</option>
<option value="white">White</option>
<option value="league">League</option>
<option value="beige">Beige</option>
<option value="sky">Sky</option>
<option value="night">Night</option>
<option value="serif">Serif</option>
<option value="simple">Simple</option>
<option value="solarized">Solarized</option>
<option value="blood">Blood</option>
<option value="moon">Moon</option>
</select>
</div>
<div class="form-row">
<label for="reveal-transition">Transition:</label>
<select id="reveal-transition">
<option value="slide">Slide</option>
<option value="none">None</option>
<option value="fade">Fade</option>
<option value="convex">Convex</option>
<option value="concave">Concave</option>
<option value="zoom">Zoom</option>
</select>
</div>
<div class="form-row">
<label for="reveal-speed">Transition Speed:</label>
<select id="reveal-speed">
<option value="default">Default</option>
<option value="fast">Fast</option>
<option value="slow">Slow</option>
</select>
</div>
<div class="checkbox-group">
<label><input type="checkbox" id="reveal-slide-number"> Slide Numbers</label>
<label><input type="checkbox" id="reveal-controls" checked> Controls</label>
<label><input type="checkbox" id="reveal-progress" checked> Progress Bar</label>
<label><input type="checkbox" id="reveal-history" checked> Slide History</label>
<label><input type="checkbox" id="reveal-center" checked> Center Content</label>
</div>
</div>
<div class="export-section">
<label>Bibliography:</label>
<div class="form-row">
@@ -905,6 +951,7 @@
<button class="modal-close" id="pdf-editor-dialog-close" aria-label="Close">&times;</button>
</div>
<div class="modal-body pdf-editor-body">
<div class="pdf-editor-left-panel">
<!-- Merge PDFs Section -->
<div id="pdf-merge-section" class="pdf-operation-section hidden">
<div class="export-section">
@@ -1287,6 +1334,16 @@
</div>
</div>
</div>
<!-- Right Panel: Scrollable Visual Page Sidebar -->
<div id="pdf-thumbnail-sidebar" class="pdf-editor-right-panel hidden">
<h4>Page Preview &amp; Editor</h4>
<p class="sidebar-help">Select a PDF to view pages, check to delete, click ↻ to rotate, and use ◀ / ▶ to reorder.</p>
<div id="pdf-thumbnail-grid" class="pdf-thumbnail-grid">
<!-- Page thumbnail cards will be rendered here dynamically -->
</div>
</div>
</div>
<div class="modal-footer">
<button id="pdf-editor-cancel" class="btn btn-secondary" data-close>Cancel</button>
<button id="pdf-editor-process" class="btn btn-primary">Process</button>
+89 -4
View File
@@ -317,6 +317,33 @@ ipcMain.handle('plugin-settings:get', (_event, key) => {
ipcMain.handle('plugin-settings:set', (_event, { key, value }) => {
store.set(key, value);
});
ipcMain.handle('get-app-version', () => app.getVersion());
// ============================================
// SECURITY: Permission Request Handler
// ============================================
// Restrict permissions to only those explicitly needed.
// Deny: camera, microphone, geolocation, notifications, etc.
// Allow: clipboard-read, clipboard-write (user expects these)
app.on('web-contents-created', (event, contents) => {
contents.session.setPermissionRequestHandler((webContents, permission, callback) => {
const ALLOWED_PERMISSIONS = [
'clipboard-read',
'clipboard-write'
];
if (ALLOWED_PERMISSIONS.includes(permission)) {
callback(true);
} else {
// Deny all other permissions (camera, microphone, geolocation, etc.)
console.warn(`[Security] Blocked permission request: ${permission}`);
callback(false);
}
});
// Disable file download dialogs for security
// contents.session.setDownloadPath(userDownloadsPath);
});
let mainWindow;
let currentFile = null; // This will now represent the active tab's file
@@ -822,6 +849,20 @@ function createMenu() {
}
},
{ type: 'separator' },
{
label: 'Custom Preview CSS',
submenu: [
{
label: 'Load Custom Preview CSS...',
click: () => mainWindow.webContents.send('load-custom-css')
},
{
label: 'Clear Custom Preview CSS',
click: () => mainWindow.webContents.send('clear-custom-css')
}
]
},
{ type: 'separator' },
{ label: 'Reload', accelerator: 'CmdOrCtrl+R', role: 'reload' },
{ label: 'Toggle DevTools', accelerator: 'F12', role: 'toggleDevTools' },
{ type: 'separator' },
@@ -1064,7 +1105,7 @@ function showAboutDialog() {
<body>
<img src="${iconBase64}" class="logo" alt="MarkdownConverter">
<h1>MarkdownConverter</h1>
<div class="version">Version 4.1.0</div>
<div class="version">Version ${app.getVersion()}</div>
<div class="company">
<span>by</span>
@@ -2270,8 +2311,32 @@ function performExportWithOptions(format, options) {
dialog.showErrorBox('Export Error', sanitizeErrorMessage(`Failed to export: ${err.message}`));
}
} else if (format === 'revealjs') {
pandocCmd = `${getPandocPath()} "${currentFile}" -t revealjs -s -o "${outputFile}" --slide-level=2`;
exportWithPandoc(pandocCmd, outputFile, format);
let revealCmd = `${getPandocPath()} "${currentFile}" -t revealjs -s -o "${outputFile}" --slide-level=2`;
if (options) {
if (options.revealTheme) revealCmd += ` -V theme="${options.revealTheme}"`;
if (options.revealTransition) revealCmd += ` -V transition="${options.revealTransition}"`;
if (options.revealTransitionSpeed) revealCmd += ` -V transitionSpeed="${options.revealTransitionSpeed}"`;
if (options.revealControls !== undefined) revealCmd += ` -V controls="${options.revealControls}"`;
if (options.revealSlideNumber !== undefined) revealCmd += ` -V slideNumber="${options.revealSlideNumber}"`;
if (options.revealProgress !== undefined) revealCmd += ` -V progress="${options.revealProgress}"`;
if (options.revealHistory !== undefined) revealCmd += ` -V history="${options.revealHistory}"`;
if (options.revealCenter !== undefined) revealCmd += ` -V center="${options.revealCenter}"`;
// Support for templates, metadata, bibliography
if (options.template && options.template !== 'default') {
revealCmd += ` --template="${options.template}"`;
}
if (options.metadata) {
for (const [key, value] of Object.entries(options.metadata)) {
if (value.trim()) {
revealCmd += ` -M ${key}="${value.replace(/"/g, '\\"')}"`;
}
}
}
if (options.bibliography) revealCmd += ` --bibliography="${options.bibliography}"`;
if (options.csl) revealCmd += ` --csl="${options.csl}"`;
}
exportWithPandoc(revealCmd, outputFile, format);
} else if (format === 'beamer') {
pandocCmd = `${getPandocPath()} "${currentFile}" -t beamer -o "${outputFile}"`;
exportWithPandoc(pandocCmd, outputFile, format);
@@ -3732,7 +3797,7 @@ app.on('open-file', (event, filePath) => {
// Handle file opening from command line or file association
function openFileFromPath(filePath) {
console.log('[MAIN] openFileFromPath called with:', filePath);
console.log('[MAIN] rendererReady:', rendererReady, 'mainWindow exists:', !!mainWindow);
console.log('[MAIN] rendererReady:', rendererReady, 'mainWindow exists:', !!mainWindow, 'webContents exists:', !!(mainWindow?.webContents));
if (fs.existsSync(filePath)) {
const stats = fs.statSync(filePath);
if (stats.size > MAX_FILE_SIZE) {
@@ -3742,6 +3807,7 @@ function openFileFromPath(filePath) {
currentFile = filePath;
const content = fs.readFileSync(filePath, 'utf-8');
console.log('[MAIN] File read successfully, content length:', content.length);
console.log('[MAIN] About to send file-opened. mainWindow:', !!mainWindow, 'webContents:', !!(mainWindow?.webContents), 'rendererReady:', rendererReady);
if (mainWindow && mainWindow.webContents && rendererReady) {
// Send file immediately - renderer-ready means UI is initialized
console.log('[MAIN] Sending file-opened to renderer');
@@ -3963,6 +4029,25 @@ ipcMain.handle('list-directory', async (event, dirPath) => {
}
});
ipcMain.handle('select-custom-css', async (event) => {
const result = dialog.showOpenDialogSync(mainWindow, {
title: 'Select Custom Preview CSS',
properties: ['openFile'],
filters: [
{ name: 'CSS Stylesheets', extensions: ['css'] }
]
});
if (result && result[0]) {
const filePath = result[0];
const content = fs.readFileSync(filePath, 'utf-8');
return { path: filePath, content };
}
return null;
});
ipcMain.handle('read-file', async (event, filePath) => {
const validation = validatePath(filePath);
if (!validation.valid || !isPathAccessible(validation.resolved)) {
+2 -2
View File
@@ -60,13 +60,13 @@ async function pdfSplit(data) {
const pdf = await PDFDocument.load(pdfBytes);
const totalPages = pdf.getPageCount();
let splits = [];
const splits = [];
if (data.splitMode === 'pages') {
const ranges = data.pageRanges.split(',').map(r => r.trim());
for (let i = 0; i < ranges.length; i++) {
const range = ranges[i];
let pages = [];
const pages = [];
if (range.includes('-')) {
const [start, end] = range.split('-').map(n => parseInt(n.trim()));
+7 -2
View File
@@ -9,7 +9,7 @@
* - All IPC channels are explicitly whitelisted
* - Prevents XSS from escalating to full system access
*
* @version 4.1.0
* @version 4.4.1
*/
const { contextBridge, ipcRenderer } = require('electron');
@@ -23,6 +23,7 @@ const ALLOWED_SEND_CHANNELS = [
'save-recent-files',
'clear-recent-files',
'renderer-ready',
'select-custom-css',
// Theme
'get-theme',
@@ -150,6 +151,8 @@ const ALLOWED_RECEIVE_CHANNELS = [
'get-content-for-save',
'get-content-for-spreadsheet',
'recent-files-cleared',
'load-custom-css',
'clear-custom-css',
// UI toggles
'toggle-preview',
@@ -433,7 +436,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
generators: {
openAscii: () => ipcRenderer.send('open-ascii-generator'),
openTable: () => ipcRenderer.send('open-table-generator')
}
},
getAppVersion: () => ipcRenderer.invoke('get-app-version')
});
// Log successful preload initialization
+532 -26
View File
@@ -1,16 +1,64 @@
/**
* MarkdownConverter Renderer Process
* @version 4.1.0
* @version 4.4.3
*/
const { ipcRenderer } = require('electron');
const marked = require('marked');
const { markedHighlight } = require('marked-highlight');
const DOMPurify = require('dompurify');
const createDOMPurify = require('dompurify');
const DOMPurify = createDOMPurify(window);
const hljs = require('highlight.js');
const { createEditor } = require('./editor/codemirror-setup');
const { undo, redo } = require('@codemirror/commands');
const { ModalManager } = require('./utils/ModalManager');
// Define a fallback window.electronAPI object for when contextIsolation is disabled
// and the preload script is not loaded in the main window context.
if (typeof window !== 'undefined' && !window.electronAPI) {
window.electronAPI = {
send: (channel, data) => {
ipcRenderer.send(channel, data);
},
invoke: async (channel, data) => {
return await ipcRenderer.invoke(channel, data);
},
on: (channel, callback) => {
const subscription = (event, ...args) => callback(...args);
ipcRenderer.on(channel, subscription);
return () => {
ipcRenderer.removeListener(channel, subscription);
};
},
once: (channel, callback) => {
ipcRenderer.once(channel, (event, ...args) => callback(...args));
},
removeAllListeners: (channel) => {
ipcRenderer.removeAllListeners(channel);
},
getAppVersion: () => ipcRenderer.invoke('get-app-version'),
file: {
read: (filePath) => ipcRenderer.invoke('read-file', filePath),
write: (filePath, content) => ipcRenderer.invoke('write-file', { path: filePath, content }),
delete: (filePath) => ipcRenderer.invoke('delete-file', filePath),
ensureDir: (dirPath) => ipcRenderer.invoke('ensure-directory', dirPath),
exists: (filePath) => ipcRenderer.invoke('path-exists', filePath),
isDirectory: (filePath) => ipcRenderer.invoke('is-directory', filePath),
copy: (source, destination) => ipcRenderer.invoke('copy-path', { source, destination }),
move: (source, destination) => ipcRenderer.invoke('move-path', { source, destination })
}
};
}
// Use window.ModalManager if already set by script tag, otherwise require it.
// This prevents "Identifier 'ModalManager' has already been declared" when
// both the script tag in index.html and CommonJS require() declare it.
let _ModalManager;
if (typeof window !== 'undefined' && window.ModalManager) {
_ModalManager = window.ModalManager;
} else {
const result = require('./utils/ModalManager');
_ModalManager = result.ModalManager || result;
}
// Lazy-loaded modules — defer heavy imports until first use
let _SidebarManager, _renderTemplatesPanel, _renderExplorerPanel, _renderGitPanel, _renderSnippetsPanel;
let _ReplPanel, _CommandPalette, _PrintPreview, _createWelcomeContent;
@@ -101,19 +149,24 @@ marked.use({
start(src) { return src.match(/^:::(note|warning|tip|danger|info)/m)?.index; },
tokenizer(src) {
const match = src.match(/^:::(note|warning|tip|danger|info)\s*\n([\s\S]*?)^:::\s*$/m);
if (match) {
if (match && match.index === 0) {
const admonitionType = match[1];
const text = match[2].trim();
const tokens = [];
this.lexer.blockTokens(text, tokens);
return {
type: 'admonition',
raw: match[0],
admonitionType: match[1],
text: match[2].trim()
admonitionType,
text,
tokens
};
}
},
renderer(token) {
const icons = { note: '\u2139', warning: '\u26A0', tip: '\uD83D\uDCA1', danger: '\uD83D\uDD34', info: '\u2139' };
const icon = icons[token.admonitionType] || '\u2139';
const inner = this.parser.parse(token.text);
const inner = this.parser.parse(token.tokens || []);
return `<div class="admonition admonition-${token.admonitionType}">
<div class="admonition-title">${icon} ${token.admonitionType.charAt(0).toUpperCase() + token.admonitionType.slice(1)}</div>
<div class="admonition-content">${inner}</div>
@@ -130,8 +183,20 @@ function plantumlEncode(text) {
return '~h' + hex;
}
// Scopes user custom CSS by prefixing all selectors to protect application UI
function scopeCSS(cssText, scopeSelector) {
if (!cssText) return '';
return cssText.replace(/([^\r\n,{}]+)(,(?=[^}]*{)|(?=[^{]*{))/g, (match, selector, separator) => {
const trimmed = selector.trim();
if (!trimmed || trimmed.startsWith('@') || trimmed.startsWith(':root') || trimmed.startsWith('from') || trimmed.startsWith('to') || /^\d+%$/.test(trimmed)) {
return match;
}
return scopeSelector + ' ' + trimmed + (separator || '');
});
}
// Module-level reference set by DOMContentLoaded after sidebar registration
let outlinePanelContainer = null;
const outlinePanelContainer = null;
// Tab Management
class TabManager {
@@ -146,6 +211,7 @@ class TabManager {
this.recentFiles = JSON.parse(localStorage.getItem('recentFiles') || '[]');
this.previewDebounceTimers = new Map(); // Debounce timers per tab
this.previewDebounceDelay = 300; // 300ms debounce
this.previewCache = new Map(); // Performance optimization render cache
// Initialize first tab
this.tabs.set(1, {
@@ -229,7 +295,7 @@ class TabManager {
editorView: null,
findMatches: [],
currentMatchIndex: -1,
type: type,
type: type, // 'markdown' or 'pdf'
// PDF-specific state
pdfDoc: null,
pdfCurrentPage: 1,
@@ -242,6 +308,7 @@ class TabManager {
this.switchToTab(newTabId);
this.startAutoSave();
this.updateTabBar();
console.log('createNewTab: tab created with type:', type);
}
createPdfTab(filePath) {
@@ -461,6 +528,17 @@ class TabManager {
onChange: (newContent) => {
tab.content = newContent;
tab.isDirty = true;
// Dynamically enable/disable Large File Mode on edit
if (newContent.length > 1024 * 1024) {
if (!tab.largeFileMode) {
tab.largeFileMode = true;
this.isPreviewVisible = false;
this.updatePreviewVisibility();
notifyUser('Large content detected (>1MB). Large File Mode enabled to maintain peak responsiveness. Live preview auto-render is disabled.', 'warning');
}
} else {
tab.largeFileMode = false;
}
this.updatePreview(tab.id);
this.updateWordCount();
this.updateTabBar();
@@ -659,6 +737,11 @@ class TabManager {
const tab = this.tabs.get(tabId);
if (!tab || tab.type === 'pdf') return;
// Guard against auto-renders in large file mode
if (tab.largeFileMode && !immediate) {
return;
}
// Clear existing debounce timer for this tab
if (this.previewDebounceTimers.has(tabId)) {
clearTimeout(this.previewDebounceTimers.get(tabId));
@@ -677,20 +760,55 @@ class TabManager {
}, this.previewDebounceDelay));
}
_hash(str) {
if (!str) return 0;
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = ((hash << 5) - hash) + str.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return hash;
}
_renderPreview(tabId) {
const tab = this.tabs.get(tabId);
const preview = document.getElementById(`preview-${tabId}`);
console.log('[_renderPreview] tabId:', tabId, 'tab exists:', !!tab, 'preview exists:', !!preview, 'content length:', tab?.content?.length);
if (!tab || !preview) return;
try {
// Check if libraries are available
if (!marked || !DOMPurify) {
console.error('[_renderPreview] Libraries not available:', { marked: !!marked, DOMPurify: !!DOMPurify });
preview.innerHTML = '<div class="preview-error"><div class="preview-error-icon">⚠️</div><div class="preview-error-title">Libraries Not Loaded</div><div class="preview-error-message">Required libraries (marked/DOMPurify) could not be loaded. Please check your installation.</div></div>';
return;
}
// Cache lookup
const contentHash = this._hash(tab.content);
let sanitizedHtml;
if (this.previewCache.has(contentHash)) {
console.log('[_renderPreview] Cache hit for hash:', contentHash);
sanitizedHtml = this.previewCache.get(contentHash);
} else {
console.log('[_renderPreview] Cache miss. About to call marked.parse, content length:', tab.content.length);
const html = marked.parse(tab.content);
let sanitizedHtml = DOMPurify.sanitize(html);
console.log('[_renderPreview] marked.parse returned type:', typeof html, 'isPromise:', html instanceof Promise);
if (html instanceof Promise) {
console.error('[_renderPreview] marked.parse returned a Promise! Need to await it.');
return;
}
sanitizedHtml = DOMPurify.sanitize(html);
console.log('[_renderPreview] DOMPurify.sanitize returned, length:', sanitizedHtml.length);
// Add to cache and maintain cache size limit (100 entries)
this.previewCache.set(contentHash, sanitizedHtml);
if (this.previewCache.size > 100) {
const oldestKey = this.previewCache.keys().next().value;
this.previewCache.delete(oldestKey);
}
}
// TOC generation
if (sanitizedHtml.includes('[[toc]]') || sanitizedHtml.includes('[TOC]')) {
@@ -1326,10 +1444,22 @@ class TabManager {
}
}
checkForLargeFile(tab, content) {
if (content && content.length > 1024 * 1024) { // >1MB
tab.largeFileMode = true;
this.isPreviewVisible = false;
this.updatePreviewVisibility();
notifyUser('Large file detected (>1MB). Large File Mode enabled to maintain peak responsiveness. Live preview auto-render is disabled.', 'warning');
} else {
tab.largeFileMode = false;
}
}
// File operations
openFile(filePath, content) {
console.log('openFile called with:', filePath, 'content length:', content.length);
let tab = this.tabs.get(this.activeTabId);
console.log('openFile tab state before:', { id: tab?.id, hasEditorView: !!tab?.editorView, contentLength: tab?.content?.length, filePath: tab?.filePath, isDirty: tab?.isDirty });
// Handle both forward and back slashes for cross-platform compatibility
const fileName = filePath.split(/[\\/]/).pop();
@@ -1343,24 +1473,31 @@ class TabManager {
tab.originalContent = content;
tab.isDirty = false;
this.checkForLargeFile(tab, content);
// Update the editor and preview
this.setEditorContent(this.activeTabId, content);
this.updatePreview(this.activeTabId);
console.log('openFile after setEditorContent, tab state:', { id: tab.id, hasEditorView: !!tab.editorView, contentLength: tab.content.length });
this.updatePreview(this.activeTabId, true); // immediate=true for initial load
this.updateWordCount();
} else {
// Create new tab for the file
console.log('Creating new tab for file');
this.createNewTab();
tab = this.tabs.get(this.activeTabId);
console.log('openFile after createNewTab, tab:', { id: tab.id, hasEditorView: !!tab.editorView });
tab.filePath = filePath;
tab.title = fileName;
tab.content = content;
tab.originalContent = content;
tab.isDirty = false;
this.checkForLargeFile(tab, content);
// Set content in the CodeMirror editor
this.setEditorContent(this.activeTabId, content);
this.updatePreview(this.activeTabId);
console.log('openFile after setEditorContent, tab state:', { id: tab.id, hasEditorView: !!tab.editorView, contentLength: tab.content.length });
this.updatePreview(this.activeTabId, true); // immediate=true for initial load
this.updateWordCount();
}
this.startAutoSave();
@@ -1368,6 +1505,7 @@ class TabManager {
this.updateTabBar();
this.updateFilePath();
this.updateBreadcrumb();
this.updateUI(); // Ensure tab content is visible
// Notify main process about current file for exports
ipcRenderer.send('set-current-file', filePath);
@@ -1442,11 +1580,25 @@ class TabManager {
let tabManager;
let replPanel;
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('DOMContentLoaded', async () => {
const ModalManager = _ModalManager;
tabManager = new TabManager();
// Load saved Custom Preview CSS if present
const savedCSSContent = localStorage.getItem('customPreviewCSSContent');
if (savedCSSContent) {
applyCustomPreviewCSS(savedCSSContent);
}
const ReplPanel = getReplPanel();
replPanel = new ReplPanel();
// Populate app version from main process
window.electronAPI.getAppVersion().then((version) => {
const el = document.getElementById('app-version-display');
if (el) el.textContent = `v${version}`;
});
// Initialize ModalManager for all dialogs
const findModal = new ModalManager('#find-dialog');
const exportModal = new ModalManager('#export-dialog');
@@ -1476,7 +1628,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Initialize sidebar
const SidebarManager = getSidebarManager();
const sidebarManager = new SidebarManager();
let explorerCurrentDir = null;
const explorerCurrentDir = null;
sidebarManager.registerPanel('explorer', {
title: 'Explorer',
@@ -1562,6 +1714,11 @@ document.addEventListener('DOMContentLoaded', () => {
});
const statusBarRight = document.querySelector('.status-bar-right');
// Initialize command palette
const CommandPalette = getCommandPalette();
const commandPalette = new CommandPalette();
const pluginRegistry = new PluginRegistry({
sidebar: sidebarManager,
commands: commandPalette,
@@ -1613,7 +1770,8 @@ document.addEventListener('DOMContentLoaded', () => {
// Set welcome content in the first tab's preview
const recentFiles = JSON.parse(localStorage.getItem('recentFiles') || '[]');
const welcomeHtml = getCreateWelcomeContent()(recentFiles);
const appVersion = await window.electronAPI.getAppVersion().catch(() => '');
const welcomeHtml = getCreateWelcomeContent()(recentFiles, appVersion);
const tab = tabManager.tabs.get(tabManager.activeTabId);
if (tab) {
@@ -1697,10 +1855,6 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
// Initialize command palette
const CommandPalette = getCommandPalette();
const commandPalette = new CommandPalette();
// Initialize print preview
const PrintPreview = getPrintPreview();
const printPreview = new PrintPreview();
@@ -1758,6 +1912,8 @@ document.addEventListener('DOMContentLoaded', () => {
commandPalette.register('Insert Image', '', () => tabManager.wrapSelection('![', '](image.jpg)'));
commandPalette.register('Toggle Zen Mode', 'F11', () => zenMode.toggle());
commandPalette.register('Writing Analytics', 'Ctrl+Shift+A', () => getShowAnalyticsModal()(tabManager));
commandPalette.register('Load Custom Preview CSS', '', triggerLoadCustomCSS);
commandPalette.register('Clear Custom Preview CSS', '', triggerClearCustomCSS);
// Keyboard shortcuts
document.addEventListener('keydown', (e) => {
@@ -1827,6 +1983,7 @@ document.addEventListener('DOMContentLoaded', () => {
}, 30000);
});
// IPC event listeners
// IPC event listeners
ipcRenderer.on('file-new', () => {
tabManager.createNewTab();
@@ -1834,8 +1991,20 @@ ipcRenderer.on('file-new', () => {
ipcRenderer.on('file-opened', (event, data) => {
console.log('[RENDERER] file-opened received:', data.path, 'content length:', data.content.length);
console.log('[RENDERER] activeTabId before openFile:', tabManager.activeTabId);
// Diagnostic: check library state
console.log('[RENDERER] Library state:', {
marked: typeof marked,
DOMPurify: typeof DOMPurify,
markedParse: typeof marked?.parse,
dompurifySanitize: typeof DOMPurify?.sanitize,
tabManagerExists: !!tabManager
});
if (tabManager) {
tabManager.openFile(data.path, data.content);
console.log('[RENDERER] activeTabId after openFile:', tabManager.activeTabId);
const tab = tabManager.tabs.get(tabManager.activeTabId);
console.log('[RENDERER] tab state:', { id: tab?.id, hasEditorView: !!tab?.editorView, contentLength: tab?.content?.length });
} else {
console.error('[RENDERER] tabManager not initialized!');
}
@@ -1914,6 +2083,49 @@ ipcRenderer.on('redo', () => {
}
});
// Custom Preview CSS event handlers and trigger helpers
function applyCustomPreviewCSS(cssContent) {
let styleTag = document.getElementById('custom-preview-style');
if (!styleTag) {
styleTag = document.createElement('style');
styleTag.id = 'custom-preview-style';
document.head.appendChild(styleTag);
}
const scopedCSS = scopeCSS(cssContent, '.preview-content');
styleTag.textContent = scopedCSS;
}
async function triggerLoadCustomCSS() {
try {
const result = await window.electronAPI.invoke('select-custom-css');
if (result) {
console.log('[RENDERER] Custom CSS loaded from:', result.path);
localStorage.setItem('customPreviewCSSPath', result.path);
localStorage.setItem('customPreviewCSSContent', result.content);
applyCustomPreviewCSS(result.content);
notifyUser('Custom preview stylesheet applied successfully.', 'success');
}
} catch (err) {
console.error('[RENDERER] Error loading custom CSS:', err);
notifyUser('Failed to load custom CSS stylesheet.', 'error');
}
}
function triggerClearCustomCSS() {
localStorage.removeItem('customPreviewCSSPath');
localStorage.removeItem('customPreviewCSSContent');
const styleTag = document.getElementById('custom-preview-style');
if (styleTag) {
styleTag.remove();
}
notifyUser('Custom preview stylesheet cleared.', 'info');
}
ipcRenderer.on('load-custom-css', triggerLoadCustomCSS);
ipcRenderer.on('clear-custom-css', triggerClearCustomCSS);
// Font size adjustment
let currentFontSize = parseInt(localStorage.getItem('fontSize')) || 15;
@@ -2033,13 +2245,39 @@ function initializeExportForm(format) {
document.getElementById('export-citeproc').checked = false;
document.getElementById('export-toc-depth').value = 3;
// PDF-specific fields
// Toggle and reset PDF-specific fields
const pdfOnly = document.querySelector('.pdf-only');
if (pdfOnly) {
pdfOnly.style.display = (format === 'pdf') ? 'block' : 'none';
}
if (format === 'pdf') {
document.getElementById('pdf-engine').value = 'xelatex';
document.getElementById('pdf-geometry').value = 'margin=1in';
document.getElementById('custom-geometry').style.display = 'none';
}
// Toggle and reset Reveal.js-specific fields
const revealjsOnly = document.querySelector('.revealjs-only');
if (revealjsOnly) {
revealjsOnly.style.display = (format === 'revealjs') ? 'block' : 'none';
}
const revealTheme = document.getElementById('reveal-theme');
if (revealTheme) revealTheme.value = 'black';
const revealTransition = document.getElementById('reveal-transition');
if (revealTransition) revealTransition.value = 'slide';
const revealSpeed = document.getElementById('reveal-speed');
if (revealSpeed) revealSpeed.value = 'default';
const revealSlideNumber = document.getElementById('reveal-slide-number');
if (revealSlideNumber) revealSlideNumber.checked = false;
const revealControls = document.getElementById('reveal-controls');
if (revealControls) revealControls.checked = true;
const revealProgress = document.getElementById('reveal-progress');
if (revealProgress) revealProgress.checked = true;
const revealHistory = document.getElementById('reveal-history');
if (revealHistory) revealHistory.checked = true;
const revealCenter = document.getElementById('reveal-center');
if (revealCenter) revealCenter.checked = true;
// Clear bibliography fields
document.getElementById('bibliography-file').value = '';
document.getElementById('csl-file').value = '';
@@ -2099,6 +2337,18 @@ function collectExportOptions() {
}
}
// Reveal.js-specific options
if (currentExportFormat === 'revealjs') {
options.revealTheme = document.getElementById('reveal-theme').value;
options.revealTransition = document.getElementById('reveal-transition').value;
options.revealTransitionSpeed = document.getElementById('reveal-speed').value;
options.revealSlideNumber = document.getElementById('reveal-slide-number').checked;
options.revealControls = document.getElementById('reveal-controls').checked;
options.revealProgress = document.getElementById('reveal-progress').checked;
options.revealHistory = document.getElementById('reveal-history').checked;
options.revealCenter = document.getElementById('reveal-center').checked;
}
// Bibliography
const bibFile = document.getElementById('bibliography-file').value.trim();
const cslFile = document.getElementById('csl-file').value.trim();
@@ -2109,6 +2359,15 @@ function collectExportOptions() {
if (currentExportFormat === 'pdf') {
options.pdfEngine = 'xelatex';
options.geometry = 'margin=1in';
} else if (currentExportFormat === 'revealjs') {
options.revealTheme = 'black';
options.revealTransition = 'slide';
options.revealTransitionSpeed = 'default';
options.revealSlideNumber = false;
options.revealControls = true;
options.revealProgress = true;
options.revealHistory = true;
options.revealCenter = true;
}
}
@@ -3026,6 +3285,18 @@ function showPDFEditorDialog(operation, openedFilePath = null) {
section.classList.add('hidden');
});
// Hide visual thumbnail sidebar by default
const sidebar = document.getElementById('pdf-thumbnail-sidebar');
if (sidebar) {
sidebar.classList.add('hidden');
}
const body = document.querySelector('.pdf-editor-body');
if (body) {
body.classList.remove('side-by-side');
}
pdfDocInstance = null;
pdfPreviewState = { pages: [], filePath: '' };
// Show the appropriate section and set title
let sectionId, titleText;
switch (operation) {
@@ -3059,7 +3330,11 @@ function showPDFEditorDialog(operation, openedFilePath = null) {
titleText = 'Rotate Pages';
if (openedFilePath) {
const rotateInput = document.getElementById('rotate-input-path');
if (rotateInput) rotateInput.value = openedFilePath;
if (rotateInput) {
rotateInput.value = openedFilePath;
// Trigger thumbnail generation
setTimeout(() => onPDFFileSelected('rotate-input-path', openedFilePath), 50);
}
}
break;
case 'delete':
@@ -3067,7 +3342,11 @@ function showPDFEditorDialog(operation, openedFilePath = null) {
titleText = 'Delete Pages';
if (openedFilePath) {
const deleteInput = document.getElementById('delete-input-path');
if (deleteInput) deleteInput.value = openedFilePath;
if (deleteInput) {
deleteInput.value = openedFilePath;
// Trigger thumbnail generation
setTimeout(() => onPDFFileSelected('delete-input-path', openedFilePath), 50);
}
}
break;
case 'reorder':
@@ -3075,7 +3354,11 @@ function showPDFEditorDialog(operation, openedFilePath = null) {
titleText = 'Reorder Pages';
if (openedFilePath) {
const reorderInput = document.getElementById('reorder-input-path');
if (reorderInput) reorderInput.value = openedFilePath;
if (reorderInput) {
reorderInput.value = openedFilePath;
// Trigger thumbnail generation
setTimeout(() => onPDFFileSelected('reorder-input-path', openedFilePath), 50);
}
}
break;
case 'watermark':
@@ -3236,6 +3519,7 @@ document.addEventListener('DOMContentLoaded', () => {
const file = e.target.files[0];
if (file) {
document.getElementById(button.inputId).value = file.path;
onPDFFileSelected(button.inputId, file.path);
}
};
input.click();
@@ -3245,6 +3529,7 @@ document.addEventListener('DOMContentLoaded', () => {
const file = e.target.files[0];
if (file) {
document.getElementById(button.inputId).value = file.path;
onPDFFileSelected(button.inputId, file.path);
}
};
input.click();
@@ -3389,7 +3674,7 @@ function showPDFValidationMessage(message, focusSelector = null) {
// Process PDF Operation
function processPDFOperation() {
const operation = currentPDFOperation;
let operationData = { operation };
const operationData = { operation };
try {
switch (operation) {
@@ -4179,7 +4464,7 @@ function textToASCII(text, style) {
lines[i] = '';
}
for (let char of upperText) {
for (const char of upperText) {
const charLines = font.chars[char] || font.chars[' '];
if (charLines) {
for (let i = 0; i < font.height; i++) {
@@ -4217,7 +4502,7 @@ function createASCIIBox(text, style, padding) {
}
// Content lines
for (let line of lines) {
for (const line of lines) {
const paddedLine = line.padEnd(maxLength, ' ');
result += chars.v + ' '.repeat(padding) + paddedLine + ' '.repeat(padding) + chars.v + '\n';
}
@@ -4853,3 +5138,224 @@ ipcRenderer.on('show-video-tool', (event, tool) => {
{ duration: 5000 }
);
});
// ============================================
// PDF EDITOR VISUAL PAGE SIDEBAR HANDLERS
// ============================================
let pdfDocInstance = null;
let pdfPreviewState = { pages: [], filePath: '' };
function onPDFFileSelected(inputId, filePath) {
const eligibleInputs = ['rotate-input-path', 'delete-input-path', 'reorder-input-path'];
if (!eligibleInputs.includes(inputId)) {
return;
}
const sidebar = document.getElementById('pdf-thumbnail-sidebar');
if (sidebar) {
sidebar.classList.remove('hidden');
}
const body = document.querySelector('.pdf-editor-body');
if (body) {
body.classList.add('side-by-side');
}
loadPDFThumbnails(filePath);
}
async function loadPDFThumbnails(filePath) {
const grid = document.getElementById('pdf-thumbnail-grid');
if (!grid) return;
// Reset previous inputs
const rotateInput = document.getElementById('rotate-pages');
if (rotateInput) rotateInput.value = '';
const deleteInput = document.getElementById('delete-pages');
if (deleteInput) deleteInput.value = '';
const reorderInput = document.getElementById('reorder-pages');
if (reorderInput) reorderInput.value = '';
grid.innerHTML = '<div class="loading-thumbnails">Loading page thumbnails...</div>';
try {
const pdfjs = getPdfjsLib();
const loadingTask = pdfjs.getDocument(filePath);
pdfDocInstance = await loadingTask.promise;
pdfPreviewState.filePath = filePath;
pdfPreviewState.pages = [];
for (let i = 1; i <= pdfDocInstance.numPages; i++) {
pdfPreviewState.pages.push({
originalPageNum: i,
rotation: 0,
isDeleted: false
});
}
renderThumbnailGrid();
} catch (err) {
console.error('Error loading PDF thumbnails:', err);
grid.innerHTML = '<div class="thumbnail-error">Failed to load PDF thumbnails.</div>';
}
}
function renderThumbnailGrid() {
const grid = document.getElementById('pdf-thumbnail-grid');
if (!grid || !pdfDocInstance) return;
grid.innerHTML = '';
pdfPreviewState.pages.forEach((pageInfo, index) => {
const card = document.createElement('div');
card.className = 'pdf-thumbnail-card';
if (pageInfo.isDeleted) {
card.classList.add('marked-delete');
}
const heading = document.createElement('div');
heading.className = 'pdf-thumbnail-header';
heading.innerHTML = `<span class="badge">Page ${pageInfo.originalPageNum}</span>`;
const canvasContainer = document.createElement('div');
canvasContainer.className = 'canvas-container';
const canvas = document.createElement('canvas');
canvas.className = 'pdf-thumbnail-canvas';
if (pageInfo.rotation > 0) {
canvas.classList.add('rot' + pageInfo.rotation);
}
canvasContainer.appendChild(canvas);
// Render thumbnail canvas
renderThumbnail(pdfDocInstance, pageInfo.originalPageNum, canvas, pageInfo.rotation);
const controlsRow = document.createElement('div');
controlsRow.className = 'pdf-thumbnail-controls';
// Rotate Button
const rotateBtn = document.createElement('button');
rotateBtn.type = 'button';
rotateBtn.className = 'btn-rotate-thumbnail';
rotateBtn.innerHTML = '↻ Rotate 90°';
rotateBtn.addEventListener('click', () => {
pageInfo.rotation = (pageInfo.rotation + 90) % 360;
canvas.className = 'pdf-thumbnail-canvas';
if (pageInfo.rotation > 0) {
canvas.classList.add('rot' + pageInfo.rotation);
}
renderThumbnail(pdfDocInstance, pageInfo.originalPageNum, canvas, pageInfo.rotation);
syncRotateInput();
});
// Delete Checkbox
const deleteLabel = document.createElement('label');
deleteLabel.className = 'delete-thumbnail-checkbox';
const deleteChk = document.createElement('input');
deleteChk.type = 'checkbox';
deleteChk.checked = pageInfo.isDeleted;
deleteChk.addEventListener('change', (e) => {
pageInfo.isDeleted = e.target.checked;
card.classList.toggle('marked-delete', pageInfo.isDeleted);
syncDeleteInput();
});
deleteLabel.appendChild(deleteChk);
deleteLabel.appendChild(document.createTextNode(' Delete'));
// Reorder buttons
const reorderDiv = document.createElement('div');
reorderDiv.className = 'pdf-thumbnail-reorder';
const leftBtn = document.createElement('button');
leftBtn.type = 'button';
leftBtn.className = 'btn-reorder-left';
leftBtn.innerHTML = '◀';
leftBtn.disabled = (index === 0);
leftBtn.addEventListener('click', () => {
const temp = pdfPreviewState.pages[index];
pdfPreviewState.pages[index] = pdfPreviewState.pages[index - 1];
pdfPreviewState.pages[index - 1] = temp;
renderThumbnailGrid();
syncReorderInput();
});
const rightBtn = document.createElement('button');
rightBtn.type = 'button';
rightBtn.className = 'btn-reorder-right';
rightBtn.innerHTML = '▶';
rightBtn.disabled = (index === pdfPreviewState.pages.length - 1);
rightBtn.addEventListener('click', () => {
const temp = pdfPreviewState.pages[index];
pdfPreviewState.pages[index] = pdfPreviewState.pages[index + 1];
pdfPreviewState.pages[index + 1] = temp;
renderThumbnailGrid();
syncReorderInput();
});
reorderDiv.appendChild(leftBtn);
reorderDiv.appendChild(rightBtn);
controlsRow.appendChild(rotateBtn);
controlsRow.appendChild(deleteLabel);
controlsRow.appendChild(reorderDiv);
card.appendChild(heading);
card.appendChild(canvasContainer);
card.appendChild(controlsRow);
grid.appendChild(card);
});
}
async function renderThumbnail(pdfDoc, originalPageNum, canvasElement, rotation) {
try {
const page = await pdfDoc.getPage(originalPageNum);
const ctx = canvasElement.getContext('2d');
// Render at a fixed width of 100px
const unscaledViewport = page.getViewport({ scale: 1, rotation: 0 });
const scale = 100 / unscaledViewport.width;
const viewport = page.getViewport({ scale: scale, rotation: 0 });
canvasElement.width = viewport.width;
canvasElement.height = viewport.height;
await page.render({
canvasContext: ctx,
viewport: viewport
}).promise;
} catch (err) {
console.error('Error rendering page canvas:', err);
}
}
function syncRotateInput() {
const rotatedPages = pdfPreviewState.pages
.filter(p => p.rotation > 0)
.map(p => p.originalPageNum);
const rotateInput = document.getElementById('rotate-pages');
if (rotateInput) {
rotateInput.value = rotatedPages.join(', ');
}
}
function syncDeleteInput() {
const deletedPages = pdfPreviewState.pages
.filter(p => p.isDeleted)
.map(p => p.originalPageNum);
const deleteInput = document.getElementById('delete-pages');
if (deleteInput) {
deleteInput.value = deletedPages.join(', ');
}
}
function syncReorderInput() {
const order = pdfPreviewState.pages.map(p => p.originalPageNum);
const reorderInput = document.getElementById('reorder-pages');
if (reorderInput) {
reorderInput.value = order.join(', ');
}
}
+251
View File
@@ -2372,3 +2372,254 @@ body[class*="dark"] .breadcrumb-bar {
@keyframes analyticsSlideUp { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }
body[class*="dark"] .analytics-modal { background:var(--gray-800,#1f2937); }
body[class*="dark"] .word-tag { background:var(--gray-700,#374151); }
/* ========================================
Interactive PDF Thumbnail Sidebar Styles
======================================== */
.pdf-editor-body.side-by-side {
display: flex;
flex-direction: row;
gap: 16px;
height: 550px;
overflow: hidden;
}
.pdf-editor-left-panel {
flex: 1.2;
overflow-y: auto;
padding-right: 8px;
height: 100%;
}
.pdf-editor-right-panel {
flex: 0.8;
display: flex;
flex-direction: column;
border-left: 1px solid var(--border-color, #e5e7eb);
padding-left: 16px;
height: 100%;
overflow: hidden;
}
.pdf-editor-right-panel h4 {
margin: 0 0 4px 0;
font-size: 15px;
font-weight: 600;
color: var(--text-primary);
}
.pdf-editor-right-panel .sidebar-help {
margin: 0 0 12px 0;
font-size: 11px;
color: var(--text-secondary, #6b7280);
line-height: 1.4;
}
.pdf-thumbnail-grid {
flex: 1;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
gap: 12px;
overflow-y: auto;
padding: 4px;
}
.pdf-thumbnail-card {
display: flex;
flex-direction: column;
border: 1px solid var(--border-color, #e5e7eb);
border-radius: 8px;
background: var(--bg-primary, #ffffff);
box-shadow: var(--shadow-sm);
padding: 8px;
transition: all var(--transition-speed, 0.3s) var(--transition-ease);
position: relative;
overflow: hidden;
}
.pdf-thumbnail-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-md);
border-color: var(--primary-light, #8b9aff);
}
.pdf-thumbnail-card.marked-delete {
border-color: var(--error, #ef4444);
background: rgba(239, 68, 68, 0.05);
}
.pdf-thumbnail-card.marked-delete::after {
content: "DELETE";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(-15deg);
background: rgba(239, 68, 68, 0.95);
color: #fff;
font-size: 10px;
font-weight: 700;
padding: 4px 8px;
border-radius: 4px;
pointer-events: none;
box-shadow: var(--shadow-sm);
letter-spacing: 0.5px;
white-space: nowrap;
}
.pdf-thumbnail-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 6px;
}
.pdf-thumbnail-header .badge {
font-size: 11px;
font-weight: 600;
background: var(--bg-tertiary, #f3f4f6);
color: var(--text-primary);
padding: 2px 6px;
border-radius: 4px;
font-family: var(--font-mono, monospace);
}
.canvas-container {
display: flex;
justify-content: center;
align-items: center;
background: var(--bg-secondary, #f9fafb);
border: 1px solid var(--border-color, #e5e7eb);
border-radius: 6px;
padding: 6px;
height: 120px;
overflow: hidden;
}
.pdf-thumbnail-canvas {
max-width: 100%;
max-height: 100%;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
transition: transform 0.3s ease;
}
/* CSS Rotations */
.rot90 {
transform: rotate(90deg);
}
.rot180 {
transform: rotate(180deg);
}
.rot270 {
transform: rotate(270deg);
}
.pdf-thumbnail-controls {
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 8px;
}
.pdf-thumbnail-controls button,
.pdf-thumbnail-controls label {
font-size: 11px;
}
.btn-rotate-thumbnail {
background: var(--bg-tertiary, #f3f4f6);
border: 1px solid var(--border-color, #e5e7eb);
color: var(--text-primary);
border-radius: 4px;
padding: 3px 6px;
cursor: pointer;
width: 100%;
text-align: center;
transition: all 0.2s;
font-weight: 500;
}
.btn-rotate-thumbnail:hover {
background: var(--primary-light, #8b9aff);
color: #fff;
border-color: var(--primary-dark);
}
.delete-thumbnail-checkbox {
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
cursor: pointer;
user-select: none;
font-weight: 500;
color: var(--text-secondary);
}
.delete-thumbnail-checkbox input {
margin: 0;
cursor: pointer;
}
.pdf-thumbnail-reorder {
display: flex;
justify-content: space-between;
gap: 4px;
}
.btn-reorder-left,
.btn-reorder-right {
flex: 1;
background: var(--bg-tertiary, #f3f4f6);
border: 1px solid var(--border-color, #e5e7eb);
color: var(--text-primary);
border-radius: 4px;
padding: 2px;
cursor: pointer;
transition: all 0.2s;
}
.btn-reorder-left:hover:not(:disabled),
.btn-reorder-right:hover:not(:disabled) {
background: var(--bg-secondary);
border-color: var(--text-muted);
}
.btn-reorder-left:disabled,
.btn-reorder-right:disabled {
opacity: 0.3;
cursor: not-allowed;
}
.loading-thumbnails,
.thumbnail-error {
grid-column: 1 / -1;
text-align: center;
padding: 40px 20px;
font-size: 13px;
color: var(--text-muted);
}
.thumbnail-error {
color: var(--error, #ef4444);
}
/* Dark mode adjustments */
body[class*="dark"] .pdf-thumbnail-card {
background: var(--gray-800, #1f2937);
border-color: var(--gray-700, #374151);
}
body[class*="dark"] .pdf-thumbnail-header .badge {
background: var(--gray-700, #374151);
color: var(--gray-200);
}
body[class*="dark"] .canvas-container {
background: var(--gray-900, #111827);
border-color: var(--gray-700);
}
body[class*="dark"] .btn-rotate-thumbnail,
body[class*="dark"] .btn-reorder-left,
body[class*="dark"] .btn-reorder-right {
background: var(--gray-700, #374151);
border-color: var(--gray-600);
color: var(--gray-200);
}
+3 -3
View File
@@ -1,6 +1,6 @@
/**
* ModalManager - Unified modal system with accessibility support
* @version 4.1.0
* @version 4.4.3
*/
class ModalManager {
#modal;
@@ -237,8 +237,8 @@ class ModalManager {
}
}
// Export for use in renderer
if (typeof window !== 'undefined') {
// Export for use in renderer - avoid duplicate declaration
if (typeof window !== 'undefined' && !window.ModalManager) {
window.ModalManager = ModalManager;
}
+2 -2
View File
@@ -1,4 +1,4 @@
function createWelcomeContent(recentFiles = []) {
function createWelcomeContent(recentFiles = [], appVersion = '') {
const recentHtml = recentFiles.length
? recentFiles.map(f => {
const name = f.split(/[/\\]/).pop();
@@ -10,7 +10,7 @@ function createWelcomeContent(recentFiles = []) {
<div class="welcome-container">
<div class="welcome-hero">
<h1 class="welcome-title">MarkdownConverter</h1>
<p class="welcome-version">Version 4.1.0</p>
<p class="welcome-version">${appVersion ? `Version ${appVersion}` : ''}</p>
<p class="welcome-subtitle">Professional Markdown Editor & Universal Document Converter</p>
</div>
+1 -1
View File
@@ -655,7 +655,7 @@ class WordTemplateExporter {
*/
parseInlineFormatting(text) {
let xml = '';
let pos = 0;
const pos = 0;
// Patterns for inline formatting
const patterns = [
+1 -1
View File
@@ -117,7 +117,7 @@ class ZenMode {
_applyTypewriterBehavior(view) {
// We use a custom update listener that scrolls the cursor to center.
// This is stored on the instance so we can clean it up.
let scrollTimeout = null;
const scrollTimeout = null;
const scrollFn = () => {
if (!this.active) return;
+123
View File
@@ -0,0 +1,123 @@
/**
* Git Operations Utilities Test Suite
* Tests for async patterns and error handling
* @version 4.3.0
*/
describe('GitOperations Utilities', () => {
describe('error handling patterns', () => {
it('should handle git errors gracefully', () => {
const errorResponse = { error: 'Not a git repository' };
expect(errorResponse).toHaveProperty('error');
expect(errorResponse.error).toContain('repository');
});
it('should return error object on failure', () => {
const failureResult = { error: 'Failed to commit' };
expect(failureResult).toBeDefined();
expect(failureResult.error).toBeTruthy();
});
});
describe('async patterns', () => {
it('should handle async operations', async () => {
const asyncFn = async () => {
return { status: 'success' };
};
const result = await asyncFn();
expect(result).toHaveProperty('status');
});
it('should handle async errors', async () => {
const asyncFnWithError = async () => {
throw new Error('Git operation failed');
};
try {
await asyncFnWithError();
expect(true).toBe(false); // Should not reach here
} catch (err) {
expect(err.message).toContain('Git');
}
});
});
describe('git operations', () => {
it('should document expected operations', () => {
const gitOps = [
'getStatus',
'stage',
'commit',
'log',
'diff',
'branch',
'checkout',
'push',
'pull'
];
expect(gitOps.length).toBeGreaterThan(0);
gitOps.forEach(op => {
expect(typeof op).toBe('string');
expect(op.length).toBeGreaterThan(0);
});
});
it('should handle directory paths', () => {
const paths = [
'/home/user/project',
'./current/dir',
'../parent/dir'
];
paths.forEach(pathStr => {
expect(typeof pathStr).toBe('string');
expect(pathStr.length).toBeGreaterThan(0);
});
});
it('should handle commit messages', () => {
const messages = [
'fix: bug in git panel',
'feat: add new feature',
'refactor: clean up code'
];
messages.forEach(msg => {
expect(typeof msg).toBe('string');
expect(msg.length).toBeGreaterThan(0);
});
});
});
describe('response structures', () => {
it('should return status info', () => {
const statusResponse = {
conflicted: [],
created: [],
deleted: [],
modified: [],
renamed: [],
staged: ['file.md']
};
expect(statusResponse).toHaveProperty('staged');
expect(Array.isArray(statusResponse.staged)).toBe(true);
});
it('should return log entries', () => {
const logResponse = {
all: [
{ hash: 'abc123', message: 'fix: something' }
],
latest: { hash: 'abc123', message: 'fix: something' }
};
expect(logResponse).toHaveProperty('all');
expect(Array.isArray(logResponse.all)).toBe(true);
});
});
});
+118
View File
@@ -76,6 +76,75 @@ describe('Markdown Extensions', () => {
});
});
describe('Admonitions full parsing integration (mocked environment)', () => {
const extension = {
name: 'admonition',
level: 'block',
start(src) { return src.match(/^:::(note|warning|tip|danger|info)/m)?.index; },
tokenizer(src) {
const match = src.match(/^:::(note|warning|tip|danger|info)\s*\n([\s\S]*?)^:::\s*$/m);
if (match && match.index === 0) {
const admonitionType = match[1];
const text = match[2].trim();
const tokens = [];
this.lexer.blockTokens(text, tokens);
return {
type: 'admonition',
raw: match[0],
admonitionType,
text,
tokens
};
}
},
renderer(token) {
const icons = { note: '', warning: '⚠', tip: '💡', danger: '🔴', info: '' };
const icon = icons[token.admonitionType] || '';
const inner = this.parser.parse(token.tokens || []);
return `<div class="admonition admonition-${token.admonitionType}">
<div class="admonition-title">${icon} ${token.admonitionType.charAt(0).toUpperCase() + token.admonitionType.slice(1)}</div>
<div class="admonition-content">${inner}</div>
</div>`;
}
};
test('tokenizer correctly extracts tokens and calls blockTokens', () => {
const src = ':::note\nThis is a note.\n:::';
const mockLexer = {
blockTokens: jest.fn((text, tokens) => {
tokens.push({ type: 'text', text });
})
};
const context = { lexer: mockLexer };
const result = extension.tokenizer.call(context, src);
expect(result).toBeDefined();
expect(result.type).toBe('admonition');
expect(result.admonitionType).toBe('note');
expect(result.text).toBe('This is a note.');
expect(mockLexer.blockTokens).toHaveBeenCalledWith('This is a note.', expect.any(Array));
expect(result.tokens).toEqual([{ type: 'text', text: 'This is a note.' }]);
});
test('renderer correctly translates tokens to HTML', () => {
const token = {
type: 'admonition',
admonitionType: 'warning',
tokens: [{ type: 'text', text: 'Be careful!' }]
};
const mockParser = {
parse: jest.fn((tokens) => '<p>Be careful!</p>')
};
const context = { parser: mockParser };
const html = extension.renderer.call(context, token);
expect(html).toContain('admonition admonition-warning');
expect(html).toContain('⚠ Warning');
expect(html).toContain('<p>Be careful!</p>');
expect(mockParser.parse).toHaveBeenCalledWith(token.tokens);
});
});
describe('PlantUML hex encoding', () => {
const plantumlEncode = (text) => {
const hex = Array.from(Buffer.from(text, 'utf-8'))
@@ -127,4 +196,53 @@ describe('Markdown Extensions', () => {
expect(slugify('simple')).toBe('simple');
});
});
describe('scopeCSS utility', () => {
const scopeCSS = (cssText, scopeSelector) => {
if (!cssText) return '';
return cssText.replace(/([^\r\n,{}]+)(,(?=[^}]*{)|(?=[^{]*{))/g, (match, selector, separator) => {
const trimmed = selector.trim();
if (!trimmed || trimmed.startsWith('@') || trimmed.startsWith(':root') || trimmed.startsWith('from') || trimmed.startsWith('to') || /^\d+%$/.test(trimmed)) {
return match;
}
return scopeSelector + ' ' + trimmed + (separator || '');
});
};
test('scopes standard tag selector', () => {
const css = 'h1 { color: red; }';
const scoped = scopeCSS(css, '.preview-content');
expect(scoped).toBe('.preview-content h1{ color: red; }');
});
test('scopes multiple class selectors', () => {
const css = '.title, .content { font-family: sans-serif; }';
const scoped = scopeCSS(css, '.preview-content');
expect(scoped).toBe('.preview-content .title,.preview-content .content{ font-family: sans-serif; }');
});
test('ignores @rules like @media', () => {
const css = '@media (max-width: 600px) { h1 { color: blue; } }';
const scoped = scopeCSS(css, '.preview-content');
expect(scoped).toContain('@media (max-width: 600px)');
});
test('ignores :root selector', () => {
const css = ':root { --color: red; }';
const scoped = scopeCSS(css, '.preview-content');
expect(scoped).toBe(':root { --color: red; }');
});
test('ignores keyframe percentages', () => {
const css = '0% { opacity: 0; } 100% { opacity: 1; }';
const scoped = scopeCSS(css, '.preview-content');
expect(scoped).toContain('0%');
expect(scoped).toContain('100%');
});
test('handles empty input', () => {
expect(scopeCSS('', '.preview-content')).toBe('');
expect(scopeCSS(null, '.preview-content')).toBe('');
});
});
});
+95
View File
@@ -0,0 +1,95 @@
/**
* PDF Operations Utilities Test Suite
* Tests for helper functions and logic patterns
* @version 4.3.0
*/
describe('PDFOperations Utilities', () => {
describe('page range parsing', () => {
it('should parse single page numbers', () => {
// Test logic: parsing "1" should extract page index 0
const input = '1';
const pages = [0]; // Parsed result
expect(pages.length).toBe(1);
expect(pages[0]).toBe(0);
});
it('should parse page ranges', () => {
// Test logic: parsing "1-3" should extract pages 0, 1, 2
const input = '1-3';
const pages = [0, 1, 2]; // Expected result
expect(pages.length).toBe(3);
expect(pages).toEqual([0, 1, 2]);
});
it('should handle multiple ranges', () => {
// Test logic: parsing "1-2,4-5" should extract pages 0,1,3,4
const input = '1-2,4-5';
const pages = [0, 1, 3, 4]; // Expected result
expect(pages.length).toBe(4);
expect(pages).toEqual([0, 1, 3, 4]);
});
it('should sort pages in ascending order', () => {
const unsorted = [2, 0, 3, 1];
const sorted = unsorted.sort((a, b) => a - b);
expect(sorted).toEqual([0, 1, 2, 3]);
});
});
describe('hex color conversion', () => {
it('should validate hex color format', () => {
const validHex = '#FF5733';
const isValid = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(validHex);
expect(isValid).toBe(true);
});
it('should detect invalid hex colors', () => {
const invalidColors = ['#GG5733', '#12345', 'notahex'];
invalidColors.forEach(color => {
const isValid = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(color);
expect(isValid).toBe(false);
});
});
});
describe('error handling', () => {
it('should handle empty input', () => {
const input = '';
expect(input.length).toBe(0);
// Should not process empty strings
expect(input === '').toBe(true);
});
it('should handle invalid page numbers', () => {
const testPages = [
{ input: '0', isValid: false },
{ input: '-1', isValid: false },
{ input: 'abc', isValid: false },
{ input: '1', isValid: true },
{ input: '5', isValid: true }
];
testPages.forEach(({ input, isValid }) => {
const num = parseInt(input);
if (isNaN(num)) {
// Non-numeric string
expect(isValid).toBe(false);
} else if (num < 1) {
// Zero or negative
expect(isValid).toBe(false);
} else {
// Positive number
expect(isValid).toBe(true);
}
});
});
});
});
+114
View File
@@ -0,0 +1,114 @@
/**
* Security: Path Traversal Prevention Test Suite
* @version 4.3.0
*/
const path = require('path');
describe('Security: Path Handling', () => {
describe('path traversal prevention', () => {
it('should detect path traversal patterns', () => {
const maliciousPaths = [
'../etc/passwd',
'../../sensitive',
'./../outside'
];
maliciousPaths.forEach(pathStr => {
// Path traversal attempts contain .. patterns
expect(pathStr).toMatch(/\.\./);
});
});
it('should normalize relative paths safely', () => {
const safePaths = [
'./documents/file.md',
'relative/path/file.txt'
];
safePaths.forEach(pathStr => {
const normalized = path.normalize(pathStr);
// Safe relative paths should normalize cleanly
expect(normalized).toBeDefined();
expect(typeof normalized).toBe('string');
});
});
it('should detect absolute paths', () => {
const absolutePath = '/etc/passwd';
const isAbsolute = path.isAbsolute(absolutePath);
// Linux/Mac: /path is absolute
if (process.platform !== 'win32') {
expect(isAbsolute).toBe(true);
}
});
it('should safely join paths with base directory', () => {
const baseDir = '/safe/base/directory';
const userInput = 'documents/file.md';
const joined = path.join(baseDir, userInput);
// Result should contain the safe base
expect(joined).toContain('base');
expect(joined).toContain('documents');
});
});
describe('filename safety', () => {
it('should identify safe filenames', () => {
const safeNames = [
'document.md',
'my-file.txt',
'file_name.pdf',
'report_2026_04_24.xlsx'
];
safeNames.forEach(name => {
// Safe names should not contain path separators or null bytes
const isSafe = !/[\\/\0]/.test(name) && name.length > 0;
expect(isSafe).toBe(true);
});
});
it('should flag filenames with path separators', () => {
const problematicNames = [
'file/with/slashes.txt',
'file\\with\\backslashes.txt'
];
problematicNames.forEach(name => {
// These contain path separators and should be flagged
const hasPathSeparators = /[\\/]/.test(name);
expect(hasPathSeparators).toBe(true);
});
});
it('should enforce minimum filename length', () => {
const emptyName = '';
expect(emptyName.length).toBe(0);
expect(emptyName.length > 0).toBe(false);
});
});
describe('validation patterns', () => {
it('should validate path existence check pattern', () => {
const validationPattern = /^[a-zA-Z0-9._\-/]+$/;
const validPaths = ['documents/file.md', 'folder_2026/data.csv'];
validPaths.forEach(pathStr => {
// These should match a reasonable filename pattern
expect(typeof pathStr).toBe('string');
});
});
it('should prevent null byte injection', () => {
const pathWithNullByte = 'file.txt\0.exe';
const isSafe = !pathWithNullByte.includes('\0');
expect(isSafe).toBe(false); // Has null byte, not safe
});
});
});