Skip to content

Commit 918aa9d

Browse files
staredclaude
andcommitted
Add GitHub Actions workflow for GitHub Pages deployment
Set up automatic deployment to GitHub Pages on push to main branch. Fix TypeScript compilation errors and configure Vite for GitHub Pages hosting. - Add GitHub Actions workflow (.github/workflows/deploy.yml) - Build with pnpm on Node 22 - Deploy to GitHub Pages using artifacts - Add vite.config.ts with base URL for GitHub Pages - Move content.md to public/ folder for static serving - Fix TypeScript errors: - Add optional chaining for parsedContent in main.ts - Prefix unused match parameters with underscore in parser.ts - Add .astro/ to .gitignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent db37573 commit 918aa9d

File tree

6 files changed

+118
-3
lines changed

6 files changed

+118
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 10.19.0
29+
30+
- name: Setup Node
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 22
34+
cache: 'pnpm'
35+
36+
- name: Install dependencies
37+
run: pnpm install
38+
39+
- name: Build
40+
run: pnpm build
41+
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: ./dist
46+
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
runs-on: ubuntu-latest
52+
needs: build
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pnpm-lock.yaml
44

55
# Build outputs
66
dist/
7+
.astro/
78
*.local
89

910
# Editor directories and files

public/content.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Interactive Schrödinger Equation
2+
3+
## Equation
4+
5+
$$
6+
\mark[imaginary]{i}\mark[planck]{\hbar}\mark[timederiv]{\frac{\partial\psi}{\partial t}} = \mark[kinetic]{-\frac{\hbar^2}{2m}}\mark[spatial]{\frac{\partial^2\psi}{\partial x^2}} + \mark[potential]{V(x)}\mark[wavefunction]{\psi}
7+
$$
8+
9+
## Description
10+
11+
To understand how a quantum system evolves, multiply the [imaginary unit]{.imaginary} by [Planck constant]{.planck} by [how the wave changes]{.timederiv}. This equals the [energy from motion]{.kinetic} of [how curved the wave is]{.spatial}, plus the [energy from position]{.potential} acting on [the quantum wave]{.wavefunction}.
12+
13+
## .imaginary
14+
15+
Indicates the quantum nature of the equation and ensures unitary time evolution. The imaginary unit $i$ is fundamental to quantum mechanics, distinguishing it from classical physics.
16+
17+
## .planck
18+
19+
Fundamental constant connecting energy and frequency.
20+
21+
**Value:** $\hbar \approx 1.055 \times 10^{-34}$ J·s
22+
23+
This reduced Planck constant sets the scale for quantum effects.
24+
25+
## .timederiv
26+
27+
Rate of change of the wavefunction with respect to time.
28+
29+
This derivative tells us how the quantum state evolves as time progresses.
30+
31+
## .kinetic
32+
33+
Kinetic energy operator coefficient, where $m$ is the particle mass.
34+
35+
The factor $-\frac{\hbar^2}{2m}$ appears in the kinetic energy term of the Hamiltonian.
36+
37+
## .spatial
38+
39+
Second derivative describing spatial curvature of the wavefunction (Laplacian).
40+
41+
Higher curvature corresponds to higher kinetic energy, reflecting the wave-like nature of quantum particles.
42+
43+
## .potential
44+
45+
External potential energy as a function of position.
46+
47+
$V(x)$ represents forces acting on the particle, such as electromagnetic fields or gravitational wells.
48+
49+
## .wavefunction
50+
51+
Complex-valued quantum state describing the particle.
52+
53+
The wavefunction $\psi$ contains all information about the quantum system's state. Its absolute square gives the probability density.

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function setupHoverEffects() {
8080

8181
// Extract class name (e.g., "term-imaginary" -> "imaginary")
8282
const className = termClass.replace('term-', '');
83-
const definition = parsedContent.definitions.get(className);
83+
const definition = parsedContent?.definitions.get(className);
8484

8585
if (!definition) return;
8686

src/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function parseContent(markdown: string): ParsedContent {
4545
// Parse equation content
4646
if (inEquation) {
4747
// Convert \mark[class]{latex} to \htmlClass{term-class}{latex}
48-
const converted = line.replace(/\\mark\[([^\]]+)\]\{/g, (match, className) => {
48+
const converted = line.replace(/\\mark\[([^\]]+)\]\{/g, (_match, className) => {
4949
const termClass = `term-${className}`;
5050
if (!seenTerms.has(className)) {
5151
termOrder.push(className);
@@ -79,7 +79,7 @@ export function parseContent(markdown: string): ParsedContent {
7979
// Parse description content
8080
if (inDescription && line.trim() && !line.startsWith('#')) {
8181
// Convert [text]{.class} to <span class="term-class">text</span>
82-
const converted = line.replace(/\[([^\]]+)\]\{\.([^\}]+)\}/g, (match, text, className) => {
82+
const converted = line.replace(/\[([^\]]+)\]\{\.([^\}]+)\}/g, (_match, text, className) => {
8383
const termClass = `term-${className}`;
8484
if (!seenTerms.has(className)) {
8585
termOrder.push(className);

vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from 'vite';
2+
3+
export default defineConfig({
4+
base: '/equations-explained-colorfully/',
5+
});

0 commit comments

Comments
 (0)