Developer documentation
Developer Documentation#
1. Project Setup#
1.1 Pre-Requisites#
-
Python (
>= 3.12) -
Node.js (
>=20.19.0) — the PR build CI uses Node 22.21.1, the release CI uses Node 24.14.1; any version meeting the minimum should work- Using versions significantly newer than the Electron-bundled Node may cause issues compiling native add-ons
-
A lot of patience
1.2 Linux Specific Pre-requisites#
- Linux environments require additional dependencies, please see Linux Specific Pre-reqs
1.3 Windows Specific Pre-requisites#
- You will need Build Tools for Visual Studio 2022 (Scroll all the way to the bottom)
- Additionally, you need spectre-mitigated MSVC, go to "Individual Components" and select "MSVC ... - VS2022 C++ Spectre-Mitigated Libs"
- Many native libraries do not support ClangCL well yet, hence we force it to use MSVC in our
.npmrc(pnpm respects this file)
1.4 Clone and Install#
git clone https://github.com/marktext/marktext.git
cd marktext
pnpm install1.5 Create minified locale files#
- This is automatically ran when building for production, but not for dev for performance
pnpm run minify-locales1.6 Run in Development#
pnpm run dev1.6.1 Some Points to Note:#
- The
mainandpreloadprocesses are NOT automatically hot-loaded on edit, you need to reload the development process on each edit unfortunately- The good news is Vite bundles it really really quickly so it shouldnt be too big of a hassle
- Although the
rendererprocess is hot-loaded, loss of states can often lead to weird errors. I recommend doing a full reload if this happens - Compile targets:
mainandpreloadstill compile toCommonJSrendererisESModulesonly (take note when using any legacyCommonJSlibraries)
1.7 Build for Production#
# For windows
$ pnpm run build:win
# For macOS
$ pnpm run build:mac
# For Linux
$ pnpm run build:linux