← writing

Runnable blocks, a field guide

Every interactive piece this blog supports, in one place. Rust you can run, shaders you can edit, and LaTeX.

Oct 1, 2026Rust · WGSL · GLSL · KaTeX

This post doubles as a template. Copy the bits you need into a new .mdx file.

Rust you can run

Edit the code and hit run (or Ctrl/Cmd+Enter). It compiles on the official Rust Playground, so the standard library and the playground’s popular crates are available.

dot.rs rust 2021, debugplayground

WGSL on WebGPU

Write mainImage, return a color. The uniform u carries resolution, time, mouse, and the current site theme’s colors, so the shader follows the theme switcher. Try pressing T.

rings.wgsl webgpu, edits apply live

GLSL on WebGL2

Shadertoy conventions, so most single-pass Shadertoy shaders paste straight in. iBg, iAccent, and iAccent2 are the theme’s colors.

plasma.glsl webgl2, edits apply live

LaTeX

Inline math goes between single dollars, like n⋅l=cos⁡θ\mathbf{n} \cdot \mathbf{l} = \cos\theta. Display math goes between double dollars:

Lo(x,ωo)=∫Ωfr(x,ωi,ωo) Li(x,ωi) (ωi⋅n) dωiL_o(\mathbf{x}, \omega_o) = \int_{\Omega} f_r(\mathbf{x}, \omega_i, \omega_o)\, L_i(\mathbf{x}, \omega_i)\, (\omega_i \cdot \mathbf{n})\, d\omega_i

Plain code blocks

Fenced blocks get syntax highlighting that follows the theme, too.

#[repr(C)]
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
struct Uniforms { view_proj: [[f32; 4]; 4], time: f32, _pad: [f32; 3] }