|
| 1 | +# Contributing to mdeck |
| 2 | + |
| 3 | +Thank you for your interest in contributing! This guide covers everything you need to get started. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Table of contents |
| 8 | + |
| 9 | +- [Development setup](#development-setup) |
| 10 | +- [Project structure](#project-structure) |
| 11 | +- [Running the examples](#running-the-examples) |
| 12 | +- [Making changes](#making-changes) |
| 13 | +- [Commit conventions](#commit-conventions) |
| 14 | +- [Pull requests](#pull-requests) |
| 15 | +- [CI checks](#ci-checks) |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Development setup |
| 20 | + |
| 21 | +**Prerequisites:** Node.js 20 or 22, npm. |
| 22 | + |
| 23 | +```bash |
| 24 | +git clone https://github.com/dplabs/mdeck |
| 25 | +cd mdeck |
| 26 | +npm install |
| 27 | +``` |
| 28 | + |
| 29 | +Key commands: |
| 30 | + |
| 31 | +| Command | Description | |
| 32 | +|---|---| |
| 33 | +| `npm run dev` | Start dev server at `http://localhost:5173` | |
| 34 | +| `npm run build` | Type-check + build to `dist/` | |
| 35 | +| `npm test` | Run tests with vitest | |
| 36 | +| `npm run test:watch` | Run tests in watch mode | |
| 37 | +| `npm run lint` | Lint `src/` with ESLint | |
| 38 | +| `npx tsc --noEmit` | Type-check without emitting | |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Project structure |
| 43 | + |
| 44 | +``` |
| 45 | +src/ |
| 46 | + index.ts # Public entry point |
| 47 | + mdeck/ |
| 48 | + api.ts # createSlideshow() and public API |
| 49 | + converter.ts # Markdown → slide HTML conversion |
| 50 | + lexer.ts # Slide lexer / tokeniser |
| 51 | + parser.ts # Slide parser |
| 52 | + highlighter.ts # highlight.js integration |
| 53 | + macros.ts # Macro system |
| 54 | + scaler.ts # Slide scaling |
| 55 | + dom.ts # DOM utilities |
| 56 | + models/ # Data models |
| 57 | + components/ # UI components |
| 58 | + controllers/ # Input controllers (keyboard, touch, etc.) |
| 59 | + views/ # Presenter / clone views |
| 60 | + __tests__/ # Vitest test files |
| 61 | +docs/ # Markdown documentation |
| 62 | +examples/ # Ready-to-run HTML demos |
| 63 | +``` |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## Running the examples |
| 68 | + |
| 69 | +```bash |
| 70 | +npm run dev |
| 71 | +``` |
| 72 | + |
| 73 | +Then open any of the example URLs listed in [docs/getting-started.md](docs/getting-started.md#running-the-examples-locally). |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Making changes |
| 78 | + |
| 79 | +1. **Fork** the repo and create a branch from `main`. |
| 80 | +2. Make your changes with focused, well-scoped commits. |
| 81 | +3. Add or update tests in `src/__tests__/` for any changed behaviour. |
| 82 | +4. Ensure all checks pass before opening a PR: |
| 83 | + |
| 84 | +```bash |
| 85 | +npx tsc --noEmit # type-check |
| 86 | +npm run lint # lint |
| 87 | +npm test # tests |
| 88 | +npm run build # build |
| 89 | +``` |
| 90 | + |
| 91 | +### Guidelines |
| 92 | + |
| 93 | +- Keep the library **dependency-light** — new runtime dependencies require strong justification. |
| 94 | +- Maintain **remark.js compatibility** — existing slide decks must continue to work. |
| 95 | +- Write **TypeScript** throughout; avoid `any` unless unavoidable. |
| 96 | +- Only add code comments where the logic genuinely needs clarification. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Commit conventions |
| 101 | + |
| 102 | +This project uses [Conventional Commits](https://www.conventionalcommits.org/), enforced by commitlint and husky. |
| 103 | + |
| 104 | +**Format:** `<type>(<optional scope>): <description>` |
| 105 | + |
| 106 | +Common types: |
| 107 | + |
| 108 | +| Type | When to use | |
| 109 | +|---|---| |
| 110 | +| `feat` | New user-facing feature | |
| 111 | +| `fix` | Bug fix | |
| 112 | +| `docs` | Documentation only | |
| 113 | +| `refactor` | Code change with no behaviour change | |
| 114 | +| `test` | Adding or updating tests | |
| 115 | +| `chore` | Build, tooling, or dependency updates | |
| 116 | +| `perf` | Performance improvement | |
| 117 | + |
| 118 | +**Examples:** |
| 119 | + |
| 120 | +``` |
| 121 | +feat: add sourceUrl option to load external markdown files |
| 122 | +fix: preserve slide order when using template property |
| 123 | +docs: document content classes syntax |
| 124 | +chore: bump markdown-it to v14 |
| 125 | +``` |
| 126 | + |
| 127 | +The commit message hook will reject non-conforming messages on commit. |
| 128 | + |
| 129 | +--- |
| 130 | + |
| 131 | +## Pull requests |
| 132 | + |
| 133 | +- Open PRs against the `main` branch. |
| 134 | +- Keep PRs focused — one feature or fix per PR. |
| 135 | +- Fill in the PR description explaining **what** changed and **why**. |
| 136 | +- Reference any related issues (e.g. `Closes #42`). |
| 137 | +- Ensure CI passes before requesting review. |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +## CI checks |
| 142 | + |
| 143 | +GitHub Actions runs on every push and pull request against Node.js 20 and 22: |
| 144 | + |
| 145 | +1. **Type-check** — `npx tsc --noEmit` |
| 146 | +2. **Tests** — `npm test` |
| 147 | +3. **Build** — `npm run build` |
| 148 | + |
| 149 | +All three must pass for a PR to be merged. |
0 commit comments