PostScript Preview is a VS Code extension that renders previews for .ps and .eps files.
- Core Logic: Uses
Ghostscript(ps2pdf) to convert PS -> PDF, thenPoppler(pdftocairo) to convert PDF -> SVG for display in a webview. - Languages: TypeScript.
- Build:
yarn compile(runstsc). - Test:
yarn test(runs VS Code extension tests viamocha). - Lint:
yarn lint(eslint).
src/extension.ts: Entry point. Registers commands (postscript-preview.sidePreview).src/preview.ts: Core logic.generatePreview(): Handles theps2pdfandpdftocairopipeline.- CRITICAL: usage of
spawnSyncforps2pdfmust use{ shell: false }to support special characters in filenames.
src/webview.ts: Generates HTML content for the webview.src/config.ts: Manages configuration settings (paths to executables).src/test/suite/extension.test.ts: Integration tests. Includes cases for special character filenames..github/workflows/release.yml: CI/CD for publishing. Automatically extracts changelog entries for release descriptions.
- Release:
- Bump version in
package.json. - Add entry to
CHANGELOG.md. - Push to
main. The GitHub Action will build, test, package (vsce), and publish to Marketplace/OpenVSX.
- Bump version in
- Ghostscript Warnings: "no display font for 'ArialUnicode'" is a common benign warning from Ghostscript.
- Filenames: Always ensure command execution avoids shell injection (use
shell: false).