You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update README: add inspirations and improve clarity
Added inspiration credits:
- BetterExplained's colorized equations
- Stuart Riffle's Fourier transform visualization (2011)
Improvements:
- More concise features list highlighting key capabilities
- Simplified "How It Works" section
- Updated file structure and examples to reflect current codebase
- Clearer instructions for creating new equations
- Removed redundant content
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Inspired by the concept of [explorable explanations](https://p.migdal.pl/blog/2024/05/science-games-explorable-explanations/), this framework makes mathematical equations more accessible through color-coding and interactive hover effects.
7
+
**Inspired by:**
8
+
-[Explorable explanations](https://p.migdal.pl/blog/2024/05/science-games-explorable-explanations/) as a learning medium
Colors are automatically assigned based on the order terms appear in the document:
62
-
63
-
```typescript
64
-
colorSchemes= {
65
-
vibrant: ['#8b5cf6', '#10b981', '#ec4899', ...],
66
-
accessible: ['#0072B2', '#E69F00', '#009E73', ...], // Wong palette
67
-
contrast: ['#0066CC', '#FF6600', '#9933CC', ...],
68
-
nocolor: ['#000000', '#000000', '#000000', ...]
69
-
}
70
-
```
71
-
72
-
The first term gets `colors[0]`, second gets `colors[1]`, etc.
73
-
74
62
## How It Works
75
63
76
-
1.**Parse** markdowncontent to extract:
77
-
- LaTeX equation (converting `\mark` to `\htmlClass`)
78
-
- Description text (converting `{.class}` to `<span>`)
79
-
- Definitions from heading sections
64
+
1.**Parse** markdown: Convert `\mark[label]{content}` to `\htmlClass{term-label}{content}` for KaTeX
65
+
2.**Render** equation using KaTeX, description and definitions as HTML
66
+
3.**Color** terms based on order of appearance in equation (first term → first color, etc.)
67
+
4.**Interact**: Hover over colored terms to see definitions, click to lock
80
68
81
-
2.**Render**using KaTeX for math and HTML for text
69
+
**Color schemes available:**Vibrant (default), Accessible (Wong palette), High Contrast, No Color
82
70
83
-
3.**Color** terms dynamically using CSS variables:
84
-
-`.imaginary` → `--color-imaginary` → `colors[0]`
85
-
-`.planck` → `--color-planck` → `colors[1]`
71
+
## Examples
86
72
87
-
4.**Interact** with hover effects showing definitions
88
-
89
-
## Example
90
-
91
-
See [content.md](content.md) for a complete example (Schrödinger equation).
73
+
See `public/examples/` for complete examples:
74
+
-`new.md` - Simple starter template (E = mc²)
75
+
-`schrodinger.md` - Schrödinger equation
76
+
-`maxwell.md` - Maxwell's equations
77
+
-`navier-stokes.md` - Navier-Stokes equation
78
+
-`euler.md` - Euler's identity
92
79
93
80
## Usage
94
81
@@ -103,36 +90,36 @@ pnpm dev
103
90
pnpm build
104
91
```
105
92
106
-
## Creating New Interactive Equations
107
-
108
-
1. Create a new markdown file following the format above
109
-
2. Update `loadContent('/your-file.md')` in `main.ts`
110
-
3. Adjust color scheme arrays if you need more/fewer colors
93
+
## Creating New Equations
111
94
112
-
## Design Philosophy
95
+
1. Create a markdown file in `public/examples/` (e.g., `my-equation.md`)
96
+
2. Add entry to `public/examples/equations.json`:
97
+
```json
98
+
{
99
+
"id": "my-equation",
100
+
"title": "My Equation",
101
+
"category": "Physics",
102
+
"file": "my-equation.md"
103
+
}
104
+
```
105
+
3. Use the in-browser editor to refine your equation interactively
113
106
114
-
-**Minimal syntax**: Natural markdown with simple annotations
115
-
-**Separation of concerns**: Content (markdown) separate from styling (CSS) and logic (TypeScript)
116
-
-**Accessibility**: Multiple color schemes including color-blind friendly options
117
-
-**Tufte-inspired**: Clean, minimal design focusing on content
118
-
119
-
## File Structure
107
+
## Key Files
120
108
121
109
```
122
-
├── content.md # Equation content in markdown
123
-
├── src/
124
-
│ ├── main.ts # Main application logic
125
-
│ ├── parser.ts # Markdown parser
126
-
│ └── style.css # Styles
127
-
├── index.html # HTML entry point
128
-
└── README.md # This file
110
+
public/examples/ # Equation markdown files
111
+
├── equations.json # List of available equations
112
+
└── *.md # Individual equation files
113
+
src/
114
+
├── main.ts # Main app logic & editor
115
+
├── parser.ts # Markdown → KaTeX/HTML parser
116
+
├── prism-custom.ts # Syntax highlighting for editor
117
+
└── style.css # Tufte-inspired minimal styles
129
118
```
130
119
131
120
## Author
132
121
133
-
Created by [Piotr Migdał](https://p.migdal.pl).
134
-
135
-
For more on interactive explanations and science communication, see: [Science, games, and explorable explanations](https://p.migdal.pl/blog/2024/05/science-games-explorable-explanations/).
0 commit comments