Write equations in LaTeX and have them typeset with KaTeX.
This repository holds two things: the Inkdrop plugin, and the host-agnostic rendering package it is built on.
| Package | Published as | What it is |
|---|---|---|
packages/plugin |
math (ipm) |
The Inkdrop plugin — registers the math / inline_math code components and ships the Inkdrop stylesheet |
packages/math |
@inkdropapp/math (npm) |
The renderer — a React component plus the scoped KaTeX stylesheet, importing no Inkdrop API |
The split exists because the renderer is useful outside the desktop app — the website demo uses it too. Everything host-specific arrives as a prop, so one implementation serves both.
ipm install mathSee the plugin README for the syntax it supports, or the Inkdrop docs for how plugins are installed.
npm install @inkdropapp/math katexSee the package README for the API, the required stylesheet, and the peer dependencies.
Requires pnpm.
pnpm install
pnpm build # builds both packages, in dependency order
pnpm dev # watch mode
pnpm typecheck
pnpm lint
pnpm formatlint and format are configured once at the root (oxlint and
oxfmt) and cover both packages.
To develop against a live Inkdrop, build and symlink the plugin directory:
pnpm build
ipm link packages/plugin- The plugin bundles
@inkdropapp/mathrather than depending on it at runtime. The published plugin has to be self-contained: ipm installs it from the registry and its tarball excludesnode_modules. - Both stylesheets are generated at build time from
node_modules/katexand are gitignored. They share one transform (packages/math/scripts/katex-css.mjs) and differ only in where the fonts live:packages/math/styles/carries its own WOFF2 files and points at them relatively, whilepackages/plugin/styles/katex.cssuses absoluteinkdrop://math/node_modules/katex/dist/fonts/…URLs, because Inkdrop injects a plugin's stylesheet as text — a relativeurl()there would resolve against the document. - That URL scheme is why
katexstays an unbundled runtime dependency of the plugin: ipm has to install it into the directory those URLs point at.
Two independent artifacts, and order matters — publish the renderer first if a plugin release depends on renderer changes, since the plugin bundles it at build time.
pnpm --filter @inkdropapp/math publish # npm
ipm publish packages/plugin # Inkdrop plugin registryMIT
