Development
ReShiki uses Rust for the desktop application, Python/RDKit for chemistry, and Astro Starlight for this documentation site.
Set up
Section titled “Set up”Install Rust 1.95 with rustfmt and Clippy, uv 0.12.3 or later, and Node.js 24 LTS.
uv sync --locked --python 3.12npm cicargo run --lockednpm ci installs Lefthook’s Git hooks automatically. npx --no-install lefthook install reinstalls them if necessary. Commands run from the repository root.
The repository uses LF line endings through .gitattributes, including on Windows, so Git’s core.autocrlf setting does not cause formatter failures.
Pre-commit checks
Section titled “Pre-commit checks”Lefthook checks staged changes by file type. It runs Oxlint and Oxfmt for web/configuration/documentation files; Ruff lint/format and ty for Python changes; and Cargo fmt, Clippy, and check for Rust changes. Dependency/configuration changes also trigger the relevant checks. Commands check formatting without rewriting or restaging your work. Rust commands run sequentially to avoid competing for Cargo’s build lock.
Run the same checks directly:
npm run lint:jsnpm run format:checkuv run --locked ruff check engine scripts testsuv run --locked ruff format --check engine scripts testsuv run --locked ty checkcargo fmt --all --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo check --workspace --all-targets --lockedTo format files, use npm run format, uv run --locked ruff format engine scripts tests, and cargo fmt --all. The first adoption reformatted the existing Python sources and tests so new work starts from a passing baseline. ty checks production Python and build scripts; tests also receive Ruff checks.
cargo test --lockeduv run --locked python -m unittest discover -s tests -p 'test_*.py'uv run --locked python scripts/check_runtime_dependencies.pycargo run --locked -- --engine-checkNative tests run on their matching operating system. CI runs Rust checks/tests on macOS, Windows x64 and Windows ARM, Python checks/tests on all five release targets, and web checks on Linux. Use cargo test --workspace --locked to include the Windows platform crate. Its clipboard integration tests replace the desktop clipboard with test data. The runtime check creates a fresh production environment, verifies that Pillow is absent, and tests chemistry and picture transport. Release packaging separately verifies first-use uv setup and offline reuse on all five native targets.
Documentation
Section titled “Documentation”npm run docs:devnpm run docs:checknpm run docs:buildEdit guide text in docs/*.md. A sync script creates Starlight pages, preserving links and pointing each Edit page action to the original Markdown. Generated copies are ignored by Git. Edit the landing page, navigation and theme in website/. The production build also checks local page and asset links.
The Documentation workflow builds pull requests and deploys main to GitHub Pages. Pages must use GitHub Actions as its source. Search, light/dark themes and responsive navigation are supplied by Starlight.
See release builds and signing for distribution setup.
Windows development
Section titled “Windows development”Use the MSVC Rust toolchain with Visual Studio Build Tools and the Windows SDK. Use cargo run --release --locked for performance checks; an unoptimized debug build is not a performance baseline. Windows uses Iced’s Tiny Skia renderer to avoid expensive software GPU emulation, with the canvas shadow disabled to avoid partial-redraw artifacts. Native Windows clipboard, printing and process checks are Rust code linked into the app; no .NET runtime or C# compiler is required. See the Windows guide.