Skip to content

Contributing

Thanks for your interest in contributing to MarkdownViewer!

Getting Started

  1. Fork the repository
  2. Clone your fork: git clone git@github.com:YOUR_USERNAME/MarkdownViewer.git
  3. Install dependencies: npm install
  4. Start the dev server: npm run tauri dev

Development

Prerequisites

  • Node.js >= 18
  • Rust stable (install via rustup)
  • macOS with Xcode Command Line Tools

Project Structure

├── index.html                  # App HTML + CSS
├── src/
│   ├── main.ts                 # App logic (UI, file browsing, theme)
│   ├── markdown.ts             # Markdown parsing + sanitization pipeline
│   ├── dom.ts                  # DOM post-processing (copy buttons, lightbox)
│   ├── utils.ts                # Utility functions (path resolution, etc.)
│   ├── markdown.test.ts        # Markdown pipeline tests
│   ├── integration.test.ts     # Integration tests (DOM rendering)
│   └── utils.test.ts           # Utility function tests
├── src-tauri/
│   ├── src/
│   │   ├── main.rs             # CLI argument parsing
│   │   └── lib.rs              # Tauri setup, plugins, native menu
│   ├── tauri.conf.json         # App configuration
│   └── capabilities/
│       └── default.json        # Permission scopes
├── docs/                       # VitePress documentation
├── vite.config.ts              # Vite + Vitest configuration
└── tsconfig.json               # TypeScript configuration

Commands

CommandDescription
npm run tauri devRun in development mode with HMR
npm run tauri buildBuild production .app and .dmg
npm run devRun Vite dev server only (no Tauri)
npm run buildBuild frontend only
npm testRun all tests
npm run test:watchRun tests in watch mode
npm run docs:devRun documentation dev server
npm run docs:buildBuild documentation site

Testing

The project uses Vitest with jsdom for testing. Tests cover:

  • Utility functions — Path resolution, entry filtering, link classification
  • Markdown pipeline — Parsing, extensions, sanitization
  • Integration — DOM rendering, copy buttons, lightbox

Run all tests:

bash
npm test

Submitting Changes

  1. Create a feature branch: git checkout -b feature/my-change
  2. Make your changes
  3. Run tests: npm test
  4. Type check: npx tsc --noEmit
  5. Commit with a clear message describing the change
  6. Push and open a Pull Request

Reporting Issues

Please open an issue with:

  • A clear description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • macOS version and app version