01

Study Companion

AstroMDXKaTeXTypeScriptComponent library

An Astro framework where a university course is authored as data, not as a website.

Stack Astro 6 · MDX · KaTeX · TypeScript
A course is 3 files + a content/ folder
Components 39, in scope by name
Pinned at v4.2.0, one of 12 tags
Search Pagefind, built into dist/

19 lines of a real course

An excerpt of content/sections/02-eksempler.mdx from the framework's demo course, copied out of the repository unchanged, and under it what those 19 lines are worth. Not a screenshot and not a reconstruction: the same file, put through the pipeline the integration configures for every course. Open the solution.

content/sections/02-eksempler.mdx
<Example title="Brytning ved vann–luft">
Lys treffer en vannflate fra vann ($n_1 = 1{,}33$) mot luft ($n_2 = 1{,}00$) med
innfallsvinkel $\theta_1 = 40^\circ$. Finn brytningsvinkelen.

<Solution>
Snells lov løst for $\theta_2$ gir

<Formula tex="\sin\theta_2 = \frac{n_1}{n_2}\sin\theta_1 = 1{,}33 \cdot \sin 40^\circ \approx 0{,}855" />

slik at $\theta_2 = \arcsin(0{,}855) \approx 58{,}7^\circ$.

<Answer>$\theta_2 \approx 59^\circ$</Answer>
</Solution>
</Example>

<SelfCheck question="Hva skjer med brytningsvinkelen når innfallsvinkelen nærmer seg grensevinkelen?">
Den nærmer seg $90^\circ$ — lyset bøyes mer og mer langs flaten, og ved
grensevinkelen oppstår totalrefleksjon.
</SelfCheck>

Built by the framework

Regneeksempel Brytning ved vann–luft

Lys treffer en vannflate fra vann (n1=1,33n_1 = 1{,}33) mot luft (n2=1,00n_2 = 1{,}00) med innfallsvinkel θ1=40∘\theta_1 = 40^\circ. Finn brytningsvinkelen.

Vis løsning Skjul løsning

Snells lov løst for θ2\theta_2 gir

sin⁡θ2=n1n2sin⁡θ1=1,33⋅sin⁡40∘≈0,855\displaystyle \sin\theta_2 = \frac{n_1}{n_2}\sin\theta_1 = 1{,}33 \cdot \sin 40^\circ \approx 0{,}855

slik at θ2=arcsin⁡(0,855)≈58,7∘\theta_2 = \arcsin(0{,}855) \approx 58{,}7^\circ.

Svar
θ2≈59∘\theta_2 \approx 59^\circ

Hva skjer med brytningsvinkelen når innfallsvinkelen nærmer seg grensevinkelen?

Vis svar Skjul svar

Den nærmer seg 90∘90^\circ — lyset bøyes mer og mer langs flaten, og ved grensevinkelen oppstår totalrefleksjon.

Six courses, one design. The framework owns everything a guide looks like; a course owns its material and a version number.

The framework

Design, schema and page wiring. 39 components, in scope by name. Six injected routes, the MDX and KaTeX pipeline, and a Pagefind index built into dist/.

A course

package.json, astro.config.mjs, and a one-line content.config.ts. Then course.yaml and content/sections/NN-slug.mdx. No pages, no CSS.

Two decisions

Pinned, not tracked

A course depends on github:MartinSA04/StudyCompanion#v4.2.0, never a branch, so a guide that built in September still builds in June. course.yaml declares a schemaVersion the loader checks, which makes old content meeting a new framework an error with two numbers in it. Four breaking releases so far, across twelve tags.

This page pins that same tag and imports the framework the way a course does. The type, the colour, the panels and the code block above all come out of the package.

The courses

Each is its own site and its own repository, built from this framework.