-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add katex math rendering to markdown and mdsvex
move code from root layout to demo layout add DemoNav.svelte
- Loading branch information
Showing
10 changed files
with
112 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
<script lang="ts"> | ||
import { name } from '$root/package.json' | ||
import DemoNav from '$site/DemoNav.svelte' | ||
</script> | ||
|
||
<h1> | ||
<img src="favicon.svg" alt={name} height="50" width="50" /> Examples | ||
</h1> | ||
|
||
<DemoNav /> | ||
|
||
<main> | ||
<slot /> | ||
</main> | ||
|
||
<style> | ||
h1 { | ||
text-align: center; | ||
display: flex; | ||
place-content: center; | ||
place-items: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Bohr Atoms | ||
|
||
<main> | ||
|
||
This solar-system-like visualization of the elements is known as the Bohr model. It was proposed by Niels Bohr in 1913. It should not be viewed as an accurate picture of reality. Quantum mechanics has shown that electrons are really unlocalized wave functions still centered around the nucleus but with much more complicated shapes determined by their quantum numbers $n$, $l$, $m$ and $s$. | ||
|
||
- $n$ is the shell number | ||
- $l$ is the orbital angular number | ||
- $m$ is the magnetic moment number | ||
- $s$ is the spin | ||
|
||
In fact this 2d visualization is a simplification even of the incorrect Bohr model in which electrons really orbit in 3d around the nucleus. Yet this animation gives an intuitive understanding of how electrons are placed into shells and how electron energies decrease with increasing shell number. To be precise, the radius of electron orbitals increases with the square of the shell number (shown here as linear due to page width constraints). Meanwhile, the 'kinetic energy' of the electrons decreases linearly with shell number. The orbital period $T$ is proportional $Z^2 / n^3$, where $Z$ is the atomic number. Shown here is $\sqrt(T) / Z$ (the root of the period scaled by atomic number) as else inner-shell electrons of large atoms would be invisibly fast. | ||
|
||
</main> | ||
<style> | ||
h2 { | ||
text-align: center; | ||
} | ||
p { | ||
text-align: justify; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script lang="ts"> | ||
import { page } from '$app/stores' | ||
const routes = Object.keys( | ||
// eslint-disable-next-line @typescript-eslint/quotes | ||
import.meta.glob('/src/routes/\\(demos\\)/*/+page*.{svx,md,svelte}') | ||
).map((filename) => filename.split(`/`)[4]) | ||
if (routes.length < 3) { | ||
throw new Error(`Too few demo routes found: ${routes.length}`) | ||
} | ||
$: is_current = (path: string) => { | ||
if (path === $page.url.pathname) return `page` | ||
if (path !== `/` && $page.url.pathname.includes(path)) return `page` | ||
return undefined | ||
} | ||
</script> | ||
|
||
<nav> | ||
{#each routes as href, idx} | ||
{#if idx > 0}<strong>•</strong>{/if} | ||
<a {href} aria-current={is_current(href)}>{href}</a> | ||
{/each} | ||
</nav> | ||
|
||
<style> | ||
nav { | ||
display: flex; | ||
gap: 1em 1ex; | ||
place-content: center; | ||
margin: 1em auto 3em; | ||
max-width: 45em; | ||
flex-wrap: wrap; | ||
} | ||
nav > a { | ||
padding: 0 4pt; | ||
background-color: rgba(255, 255, 255, 0.1); | ||
border-radius: 3pt; | ||
transition: 0.2s; | ||
} | ||
nav > a[aria-current='page'] { | ||
color: mediumseagreen; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters