KaTeX + coloring + interactivity to make equations explained well (prototype)
21
stars
131
commits
TypeScript
primary language
Dec 31, 2025
updated
A minimal framework for creating interactive mathematical explanations with colored, annotated equations.
Demo: https://p.migdal.pl/equations-explained-colorfully/

Inspired by:
I am grateful to Amit Patel (Red Blob Games) for valuable feedback on an early draft.
Create a markdown file with three sections:
Use \mark[classname]{formula} to annotate terms:
$$
\mark[imaginary]{i}\mark[planck]{\hbar}\mark[timederiv]{\frac{\partial\psi}{\partial t}} = ...
$$
Use [text]{.classname} to reference terms with the same color:
## Description
Multiply the [imaginary unit]{.imaginary} by [Planck constant]{.planck}...
Use ## .classname headings for detailed explanations:
## .imaginary
Indicates the quantum nature of the equation and ensures unitary time evolution.
The imaginary unit $i$ is fundamental to quantum mechanics.
## .planck
Fundamental constant connecting energy and frequency.
**Value:** $\hbar \approx 1.055 \times 10^{-34}$ J·s
\mark[label]{content} to \htmlClass{term-label}{content} for KaTeXColor schemes available: Vibrant (default), Accessible (Wong palette), High Contrast, No Color
See src/examples/ for complete examples:
new.md - Simple starter template (E = mc²)schrodinger.md - Schrödinger equationmaxwell.md - Maxwell's equationsnavier-stokes.md - Navier-Stokes equationeuler.md - Euler's identity# Install dependencies
pnpm install
# Run dev server
pnpm dev
# Build for production
pnpm build
src/examples/ (e.g., my-equation.md)src/examples/ # Equation markdown files
└── *.md # Individual equation files
src/
├── main.ts # Vue app entry point
├── App.vue # Main app layout with three-panel design
├── components/
│ ├── CentralPanel.vue # Equation display with hover interactions
│ ├── MarkdownEditor.vue # CodeJar editor with Prism highlighting
│ ├── controls/ # EquationSelector, ColorSchemeSwitcher, ExportControls
│ └── equation/ # EquationDisplay, DescriptionPanel, DefinitionPopup
├── export/ # Export formats (HTML, LaTeX, Beamer, Typst)
└── utils/ # parser.ts, colorSchemes.ts, termDom.ts
Created by Piotr Migdał
MIT
131 commits
TypeScript
56.8%
Vue
39.3%
HTML
2.0%
JavaScript
1.8%
KaTeX + coloring + interactivity to make equations explained well (prototype)
21
stars
131
commits
TypeScript
primary language
Dec 31, 2025
updated
A minimal framework for creating interactive mathematical explanations with colored, annotated equations.
Demo: https://p.migdal.pl/equations-explained-colorfully/

Inspired by:
I am grateful to Amit Patel (Red Blob Games) for valuable feedback on an early draft.
Create a markdown file with three sections:
Use \mark[classname]{formula} to annotate terms:
$$
\mark[imaginary]{i}\mark[planck]{\hbar}\mark[timederiv]{\frac{\partial\psi}{\partial t}} = ...
$$
Use [text]{.classname} to reference terms with the same color:
## Description
Multiply the [imaginary unit]{.imaginary} by [Planck constant]{.planck}...
Use ## .classname headings for detailed explanations:
## .imaginary
Indicates the quantum nature of the equation and ensures unitary time evolution.
The imaginary unit $i$ is fundamental to quantum mechanics.
## .planck
Fundamental constant connecting energy and frequency.
**Value:** $\hbar \approx 1.055 \times 10^{-34}$ J·s
\mark[label]{content} to \htmlClass{term-label}{content} for KaTeXColor schemes available: Vibrant (default), Accessible (Wong palette), High Contrast, No Color
See src/examples/ for complete examples:
new.md - Simple starter template (E = mc²)schrodinger.md - Schrödinger equationmaxwell.md - Maxwell's equationsnavier-stokes.md - Navier-Stokes equationeuler.md - Euler's identity# Install dependencies
pnpm install
# Run dev server
pnpm dev
# Build for production
pnpm build
src/examples/ (e.g., my-equation.md)src/examples/ # Equation markdown files
└── *.md # Individual equation files
src/
├── main.ts # Vue app entry point
├── App.vue # Main app layout with three-panel design
├── components/
│ ├── CentralPanel.vue # Equation display with hover interactions
│ ├── MarkdownEditor.vue # CodeJar editor with Prism highlighting
│ ├── controls/ # EquationSelector, ColorSchemeSwitcher, ExportControls
│ └── equation/ # EquationDisplay, DescriptionPanel, DefinitionPopup
├── export/ # Export formats (HTML, LaTeX, Beamer, Typst)
└── utils/ # parser.ts, colorSchemes.ts, termDom.ts
Created by Piotr Migdał
MIT
131 commits
TypeScript
56.8%
Vue
39.3%
HTML
2.0%
JavaScript
1.8%