From 5f07cdafa6a3eaf6926066705e35daf6b83a583a Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 6 Mar 2026 13:47:53 -0500 Subject: [PATCH] doc: cleanup --- doc/preview.txt | 15 +++++--- test_math.html | 91 +++++++++++++++++++++++++++++++++++++++++++++++++ test_math.md | 46 +++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 test_math.html create mode 100644 test_math.md diff --git a/doc/preview.txt b/doc/preview.txt index 3912a41..ed3c13e 100644 --- a/doc/preview.txt +++ b/doc/preview.txt @@ -202,15 +202,22 @@ fonts from a CDN at runtime. Pandoc's `--embed-resources` cannot inline these dynamic dependencies, so math fails to render in the output. To use KaTeX or MathJax instead, override `args` to drop `--embed-resources` -(the output will require internet access): >lua +(the output will require internet access). For example, to work with +github-flavored markdown (gfm): >lua vim.g.preview = { github = { args = function(ctx) return { - '-f', 'gfm', ctx.file, '-s', '--katex', - '--css', 'https://cdn.jsdelivr.net/gh/pixelbrackets/gfm-stylesheet@master/dist/gfm.css', - '-o', ctx.output, + '-f', + 'gfm', + ctx.file, + '-s', + '--katex', + '--css', + 'https://cdn.jsdelivr.net/gh/pixelbrackets/gfm-stylesheet@master/dist/gfm.css', + '-o', + ctx.output, } end, }, diff --git a/test_math.html b/test_math.html new file mode 100644 index 0000000..f21d65a --- /dev/null +++ b/test_math.html @@ -0,0 +1,91 @@ + + + + + + + test_math + + + + + + + +

Math Rendering Test

+

Inline Math

+

The quadratic formula is x = \frac{-b \pm +\sqrt{b^2 - 4ac}}{2a} and Euler's identity is e^{i\pi} + 1 = 0.

+

Display Math

+

\int_{-\infty}^{\infty} e^{-x^2} \, dx = +\sqrt{\pi}

+

\sum_{n=0}^{\infty} \frac{x^n}{n!} = +e^x

+

Matrices

+

\begin{pmatrix} a & b \\ c & d +\end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax ++ by \\ cx + dy \end{pmatrix}

+

Aligned Equations

+

\begin{aligned} +\nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} \\ +\nabla \cdot \mathbf{B} &= 0 \\ +\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} +\\ +\nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \varepsilon_0 +\frac{\partial \mathbf{E}}{\partial t} +\end{aligned}

+

Fractions and Nested +Expressions

+

\cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 + +\cfrac{1}{1 + \cdots}}}}

+

\binom{n}{k} = +\frac{n!}{k!(n-k)!}

+

Limits and Calculus

+

\lim_{n \to \infty} \left(1 + +\frac{1}{n}\right)^n = e

+

\oint_{\partial \Sigma} \mathbf{B} \cdot +d\boldsymbol{\ell} = \mu_0 \iint_{\Sigma} \mathbf{J} \cdot d\mathbf{S} + +\mu_0 \varepsilon_0 \frac{d}{dt} \iint_{\Sigma} \mathbf{E} \cdot +d\mathbf{S}

+

Greek and Symbols

+

\Gamma(z) = \int_0^{\infty} t^{z-1} e^{-t} +\, dt, \quad \Re(z) > 0

+

\mathcal{L}\{f(t)\} = \int_0^{\infty} f(t) +e^{-st} \, dt

+

Cases

+

|x| = \begin{cases} x & \text{if } x +\geq 0 \\ -x & \text{if } x < 0 \end{cases}

+ + + diff --git a/test_math.md b/test_math.md new file mode 100644 index 0000000..b89bf87 --- /dev/null +++ b/test_math.md @@ -0,0 +1,46 @@ +# Math Rendering Test + +## Inline Math + +The quadratic formula is $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$ and Euler's identity is $e^{i\pi} + 1 = 0$. + +## Display Math + +$$\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}$$ + +$$\sum_{n=0}^{\infty} \frac{x^n}{n!} = e^x$$ + +## Matrices + +$$\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}$$ + +## Aligned Equations + +$$\begin{aligned} +\nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} \\ +\nabla \cdot \mathbf{B} &= 0 \\ +\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\ +\nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t} +\end{aligned}$$ + +## Fractions and Nested Expressions + +$$\cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 + \cdots}}}}$$ + +$$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$ + +## Limits and Calculus + +$$\lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n = e$$ + +$$\oint_{\partial \Sigma} \mathbf{B} \cdot d\boldsymbol{\ell} = \mu_0 \iint_{\Sigma} \mathbf{J} \cdot d\mathbf{S} + \mu_0 \varepsilon_0 \frac{d}{dt} \iint_{\Sigma} \mathbf{E} \cdot d\mathbf{S}$$ + +## Greek and Symbols + +$$\Gamma(z) = \int_0^{\infty} t^{z-1} e^{-t} \, dt, \quad \Re(z) > 0$$ + +$$\mathcal{L}\{f(t)\} = \int_0^{\infty} f(t) e^{-st} \, dt$$ + +## Cases + +$$|x| = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$$