Thank you for considering a contribution to code-office. This guide covers the development setup, coding conventions, and submission process.
- Node.js 18+
- VS Code 1.64+
- npm (comes with Node.js)
# Clone the repository
git clone https://github.com/lidge-jun/code-office.git
cd code-office
# Install dependencies
npm install
# Build the extension
npm run build
# Or start in watch mode for development
npm run dev- Open the project in VS Code
- Press
F5to launch the Extension Development Host - The extension will activate automatically when you open a supported file
The React components run inside VS Code's WebView. In development mode, they connect to a Vite dev server with hot module replacement:
# Start the Vite dev server (port 5739)
npm run dev:webviewThen launch the Extension Development Host with F5. The WebView will load from the Vite dev server instead of the bundled build.
src/
├── extension.ts Extension activation entry
├── provider/ VS Code editor providers
│ ├── hwp/ HWP/HWPX editing (CustomEditorProvider)
│ ├── handlers/ File-type-specific event handlers
│ ├── compress/ Archive handling (ZIP, RAR)
│ └── wikilink/ Wikilink completion + links
├── service/ Business logic layer
│ ├── markdown/ Markdown export + rendering
│ ├── wikilink/ Wikilink parser + resolver
│ ├── pptx/ LibreOffice conversion
│ └── zip/ Archive utilities
├── common/ Shared utilities
└── react/ WebView React components
├── view/ Per-format viewer components
│ ├── hwp/ HWP editor + rhwp bridge
│ ├── excel/ Spreadsheet viewer
│ ├── word/ Editable DOCX surface
│ ├── pptx/ PowerPoint-like read-only viewer
│ ├── image/ Image gallery
│ ├── compress/ Archive tree view
│ └── fontViewer/ Font inspector
└── util/ WebView communication helpers
For detailed file responsibilities and line counts, see structure/01-file-function-map.md.
- All new code must be TypeScript (
.ts/.tsx) - Strict mode is enabled
- No
anytypes unless absolutely necessary - Prefer
constoverlet
- Maximum 500 lines per file. If a file exceeds this, split it
- ES Module (
import/export) only in React code - Extension host uses CommonJS (required by VS Code)
- Never trust data from WebView — always validate at the Host boundary
- HWP byte arrays must pass magic number validation before disk write
- WebView resource roots must be minimal (extension dir + document folder)
- CSP must not include
'unsafe-eval'in production (only'wasm-unsafe-eval')
| Surface | Convention | Example |
|---|---|---|
| Provider files | camelCase | markdownEditorProvider.ts |
| React components | PascalCase | Hwp.tsx, Excel.tsx |
| Event constants | SCREAMING_SNAKE | HWP_EVENTS.vscodeSave |
| Config keys | dot-separated | code-office.hwp.studioUrl |
Before submitting:
# TypeScript type checking
npm run typecheck
# Cross-platform CI regression suite
npm run test:ci
# Full release and VSIX package verification
npm run release:localFor the full GitHub Actions coverage matrix and when to add new tests, see docs/TESTING.md.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes with atomic commits
- Run verification scripts
- Push and create a Pull Request
type(scope): description
Types: feat, fix, refactor, docs, build, test, chore
Scope: hwp, markdown, viewer, build, structure, devlog
Examples:
feat(hwp): add HWPX to HWP conversion dialogfix(viewer): prevent PDF viewer crash on empty filedocs(structure): update file map after split
See structure/roadmap.md for the implementation roadmap. Key areas:
- Phase 3: Wikilink WebView rendering and export
- Phase 4: PPTX PowerPoint-like read-only viewer fidelity and large-deck performance
- Phase 5: Markdown CJK inline formatting
- Phase 6: Excel strikethrough preservation
- Phase 7: LibreOffice fallback for legacy formats
Open an issue on GitHub.