RFD 0002Document view
Catalog
RFD 0002
ideationmdx0002.mdx

MDX Authoring

Reference examples for authoring Markdown, MDX components, Mermaid diagrams, and math in this repo.

Authors
Ian Cleary
Updated
Apr 21, 2026, 12:00 AM

Please see the following link Markdown Basic Syntax on common markdown elements and how to create them.

Additionally, see the raw code of this document for the raw text file that generates the following examples, expanding upon the above link with Github Flavored Markdown and Math equation support via Katex, specifically the guide on Katex's Supported Functions.

Github Flavored Markdown

Autolink literals

www.example.com, https://example.com, and contact@example.com.

Footnote

A note1

Strikethrough

one or two tildes.

Table

abcd

Tasklist

  • to do
  • done

Math and Equations

This uses Katex syntax

Friis Transmission Equation, for example, where the following markdown code is used to generate

P_r = P_t + G_t + G_r + 20 * \log_{10} \left( \frac{\lambda}{4 \pi d} \right)

Use triple backticks and the "math" string to indicate language after the top set of three backticks

Pr=Pt+Gt+Gr+20log10(λ4πd)P_r = P_t + G_t + G_r + 20 * \log_{10} \left( \frac{\lambda}{4 \pi d} \right)

where:

  • PrP_r = received power (dBm)
  • PtP_t = transmitted power (dBm)
  • GtG_t = gain of transmitting antenna (dBi)
  • GrG_r = gain of receiving antenna (dBi)
  • λλ = wavelength of signal (m)
  • dd = distance between antennas (m)
  • \ starts a Katex primitive, with {} being inputs/arguments into that primitive, where `f

Extended equation examples

The sections below consolidate the former standalone equation fixture into this primary MDX authoring reference so math authoring lives in one place.

This RFD serves as a rendering stress-test and reference page for KaTeX-backed LaTeX equations in the MDX pipeline. It includes high-signal examples across mechanics, electromagnetism, waves, thermodynamics, quantum mechanics, and relativity.

Kinematics and Rotation

For constant acceleration motion, the displacement equation is

s=ut+12at2s = ut + \frac{1}{2}at^2

and the velocity is

v=u+atv = u + at

The average speed over a displacement is

vˉ=ΔxΔt\bar v = \frac{\Delta x}{\Delta t}

For circular motion:

ω=dθdt,at=v2r,ar=v2r\omega = \frac{d\theta}{dt}, \quad a_t = \frac{v^2}{r}, \quad a_r = \frac{v^2}{r}

Angular relations use radians:

θ=sr,v=ωr,T=2πLg\theta = \frac{s}{r}, \quad v = \omega r, \quad T = 2\pi\sqrt{\frac{L}{g}}

Newtonian Dynamics

Newton’s second law:

F=ma\sum \vec F = m\vec a

Work and kinetic energy:

W=Fds,ΔK=Wnet=12mv212mv02W = \int \vec F \cdot d\vec s, \qquad \Delta K = W_{\mathrm{net}} = \frac{1}{2}mv^2 - \frac{1}{2}mv_0^2

Instantaneous power is

P=dWdt=FvP = \frac{dW}{dt} = \vec F \cdot \vec v

Momentum conservation for a closed system:

pi=pf\sum \vec p_i = \sum \vec p_f

Rotational analogs:

τ=Iα,L=Iω,Krot=12Iω2\tau = I\alpha, \quad L = I\omega, \quad K_\mathrm{rot}=\frac{1}{2}I\omega^2

Classical Gravity

Newton’s law of gravitation:

F=Gm1m2r2F = G\frac{m_1 m_2}{r^2}

Potential energy near Earth’s surface:

U=mghU = mgh

Keplerian orbital relation:

T2=4π2GMa3T^2 = \frac{4\pi^2}{GM}a^3

Escape velocity:

vesc=2GMrv_\mathrm{esc}=\sqrt{\frac{2GM}{r}}

Electromagnetism

Gauss’s law in integral form:

EdA=Qencε0\oiint \vec E\cdot d\vec A = \frac{Q_\mathrm{enc}}{\varepsilon_0}

Faraday’s law of induction:

Ed=dΦBdt\oint \vec E\cdot d\vec \ell = -\frac{d\Phi_B}{dt}

Ampère–Maxwell law:

Bd=μ0Ienc+μ0ε0dΦEdt\oint \vec B\cdot d\vec \ell = \mu_0 I_\mathrm{enc} + \mu_0\varepsilon_0\frac{d\Phi_E}{dt}

Lorentz force on a charge:

F=q(E+v×B)\vec F = q(\vec E + \vec v \times \vec B)

Electromagnetic wave energy density:

u=12(ε0E2+B2μ0)u = \frac{1}{2}\left(\varepsilon_0 E^2 + \frac{B^2}{\mu_0}\right)

Wave Optics and Radiation

Phase velocity and index of refraction:

vp=fλ,vp=cnv_p = f\lambda, \qquad v_p = \frac{c}{n}

Double-slit constructive interference:

dsinθ=mλ,  mZd\sin\theta = m\lambda, \; m\in\mathbb Z

Single-slit diffraction minima:

asinθ=mλ,  m0a\sin\theta = m\lambda, \; m\neq 0

Thin-lens equation:

1f=1do+1di\frac{1}{f} = \frac{1}{d_o} + \frac{1}{d_i}

Gaussian beam waist scaling:

w(z)=w01+(zzR)2,zR=πw02λ w(z)=w_0\sqrt{1+\left(\frac{z}{z_R}\right)^2}, \qquad z_R=\frac{\pi w_0^2}{\lambda}

Thermodynamics and Statistical Physics

Ideal gas law:

PV=nRT=NkBTPV = nRT = Nk_B T

First law:

dU=δQδWdU = \delta Q - \delta W

Isentropic ideal-gas relation:

PVγ=constantPV^\gamma = \text{constant}

Boltzmann relation:

S=kBlnΩ,E=32NkBTS = k_B\ln\Omega, \qquad \langle E\rangle = \frac{3}{2}Nk_B T

Stefan–Boltzmann radiant flux:

j=σT4j^\star = \sigma T^4

Quantum and Atomic Physics

Einstein’s mass-energy relation:

E=mc2E=mc^2

Planck relation:

E=hν,ν=cλE = h\nu, \qquad \nu = \frac{c}{\lambda}

de Broglie relation:

λ=hp\lambda = \frac{h}{p}

Photoelectric threshold:

Kmax=hνϕK_\mathrm{max} = h\nu - \phi

Schrödinger equation:

[22m2+V(r)]ψ(r)=Eψ(r)\left[-\frac{\hbar^2}{2m}\nabla^2 + V(\mathbf r)\right]\psi(\mathbf r)=E\psi(\mathbf r)

Wave-packet spread:

σx(t)=σx01+(t2mσx02)2\sigma_x(t)=\sigma_{x0}\sqrt{1+\left(\frac{\hbar t}{2m\sigma_{x0}^2}\right)^2}

Compton shift:

Δλ=hmec(1cosθ)\Delta\lambda = \frac{h}{m_e c}(1-\cos\theta)

Relativity

Minkowski metric line element:

ds2=c2dt2+dx2+dy2+dz2ds^2 = -c^2dt^2 + dx^2 + dy^2 + dz^2

Lorentz factor:

γ=11v2/c2\gamma = \frac{1}{\sqrt{1-v^2/c^2}}

Time dilation:

Δt=γΔt0\Delta t = \gamma \Delta t_0

Length contraction:

L=L0γL = \frac{L_0}{\gamma}

Energy–momentum relation:

E2=(pc)2+(mc2)2E^2 = (pc)^2 + (mc^2)^2

Useful Identities

Euler’s identity:

eiπ+1=0e^{i\pi}+1=0

Binomial theorem snippet:

(a+b)2=a2+2ab+b2(a+b)^2 = a^2+2ab+b^2

Fourier-style transform (generic form):

limx0sinxx=1,F(ω)=f(t)eiωtdt\lim_{x\to 0}\frac{\sin x}{x}=1, \qquad F(\omega)=\int_{-\infty}^{\infty}f(t)e^{-i\omega t}\,dt

Additional Checks

Inline formulas for rapid validation:

  • E=ρ/ε0\nabla \cdot \vec E = \rho/\varepsilon_0
  • Bd=μ0I+μ0ε0dΦEdt\oint \vec B \cdot d\vec\ell = \mu_0 I + \mu_0\varepsilon_0\,\frac{d\Phi_E}{dt}
  • v=drdt\vec v = \frac{d\vec r}{dt}
  • α{\alpha}, β{\beta}, γ{\gamma} are useful typography checks.

Rendered-Equation Checklist

Use these cases to quickly verify the full KaTeX render stack:

  • Inline vector and operator notation

    • (×E)=0\nabla \cdot (\nabla \times \vec E)=0
    • n^(A×B)=ABsinθ\hat{\mathbf n} \cdot (\vec A \times \vec B)=|\vec A||\vec B|\sin\theta
  • Block fractions, roots, and absolute values

    • 11+x2\left|\frac{1}{1+x^2}\right|
    • intabf(x)dxintcdg(x)dx=langlefranglelanglegrangle\frac{\\int_a^b f(x)\,dx}{\\int_c^d g(x)\,dx} = \frac{\\langle f\\rangle}{\\langle g\\rangle}
  • Alignment and brace-heavy display math

    • E=ρε0B=0×E=Bt×B=μ0J+μ0ε0Et\begin{aligned} \nabla \cdot \vec E &= \frac{\rho}{\varepsilon_0}\\ \nabla \cdot \vec B &= 0\\ \nabla \times \vec E &= -\frac{\partial \vec B}{\partial t}\\ \nabla \times \vec B &= \mu_0\vec J + \mu_0\varepsilon_0\frac{\partial \vec E}{\partial t} \end{aligned}
  • Matrices and bold symbols

    • R(θ)=(cosθsinθsinθcosθ)\mathbf R(\theta)= \begin{pmatrix} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{pmatrix}
  • Piecewise functions and limiting cases

    • sgn(x)={1,x<00,x=01,x>0\operatorname{sgn}(x)= \begin{cases} -1, & x<0\\ 0, & x=0\\ 1, & x>0 \end{cases}
  • Summation and products with limits

    • n=11n2=π26\sum_{n=1}^{\infty}\frac{1}{n^2} = \frac{\pi^2}{6}
    • k=1nk=n!\prod_{k=1}^{n} k = n!

Mermaid diagrams

The sections below consolidate the former standalone Mermaid fixture into this primary MDX authoring reference so diagram authoring also lives here.

This RFD is a rendering fixture and authoring reference for Mermaid diagrams inside MDX content.

Usage

Use the Mermaid MDX component and pass the diagram definition through the chart prop. Add an optional size prop when you want a wider rendered panel for denser diagrams.

MDX
<Mermaid
title="Document review workflow"
chart={`flowchart TD
Draft[Draft] --> Review{Review ok?}
Review -->|Yes| Publish[Publish]
Review -->|No| Revise[Revise]
Revise --> Review`}
/>

Document review workflow

Document review workflow
Document review workflow

Authoring notes

  • Keep diagrams focused on one state machine, flow, or architecture slice.
  • Prefer a short title so the wrapper header reads well in the document body.
  • Use size="wide" or size="full" when a denser diagram needs more horizontal room; the panel will widen and scroll instead of shrinking the content too aggressively.
  • Mermaid diagrams are precompiled to static SVG during the dev/build pipeline, so deployed pages only render the generated SVG output.

Bytefield diagrams

This same RFD also serves as a rendering fixture and authoring reference for byte field diagrams inside MDX content.

Usage

Use the Bytefield MDX component and pass the diagram definition through the spec prop. Add an optional size prop when you want a wider rendered panel for bit- or field-dense layouts.

MDX
<Bytefield
title="CCSDS space packet primary header"
size="wide"
spec={`(def boxes-per-row 16)
(draw-column-headers)
(draw-box "Version" {:span 3})
(draw-box "T" {:span 1})
(draw-box "SH" {:span 1})
(draw-box "APID" {:span 11})`}
/>

CCSDS space packet primary header

CCSDS space packet primary header
CCSDS space packet primary header
Scroll horizontally for the full diagram

Field legend: T = packet type, SH = secondary header flag, APID = application process identifier.

Bytefield authoring notes

  • Keep field names concise so multi-row layouts stay legible.
  • Use size="wide" or size="full" for 32-bit and denser protocol headers that should preserve readable labels.
  • Prefer byte- and bit-aligned spans in the diagram source so the output stays structurally obvious to readers.
  • Bytefield diagrams are precompiled to static SVG during the dev/build pipeline, so deployed pages only render the generated SVG output.

Footnotes

  1. Big note.

External References

RFD 0002 · MDX Authoring