doc: cleanup

This commit is contained in:
Barrett Ruth 2026-03-06 13:47:53 -05:00
parent f600bc74d1
commit 5f07cdafa6
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
3 changed files with 148 additions and 4 deletions

View file

@ -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,
},

91
test_math.html Normal file
View file

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>test_math</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/pixelbrackets/gfm-stylesheet@master/dist/gfm.css" />
<script defer=""
src="https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.js"></script>
<script>document.addEventListener("DOMContentLoaded", function () {
var mathElements = document.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}}});
</script>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css" />
</head>
<body>
<h1 id="math-rendering-test">Math Rendering Test</h1>
<h2 id="inline-math">Inline Math</h2>
<p>The quadratic formula is <span class="math inline">x = \frac{-b \pm
\sqrt{b^2 - 4ac}}{2a}</span> and Euler's identity is <span
class="math inline">e^{i\pi} + 1 = 0</span>.</p>
<h2 id="display-math">Display Math</h2>
<p><span class="math display">\int_{-\infty}^{\infty} e^{-x^2} \, dx =
\sqrt{\pi}</span></p>
<p><span class="math display">\sum_{n=0}^{\infty} \frac{x^n}{n!} =
e^x</span></p>
<h2 id="matrices">Matrices</h2>
<p><span class="math display">\begin{pmatrix} a &amp; b \\ c &amp; d
\end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax
+ by \\ cx + dy \end{pmatrix}</span></p>
<h2 id="aligned-equations">Aligned Equations</h2>
<p><span class="math display">\begin{aligned}
\nabla \cdot \mathbf{E} &amp;= \frac{\rho}{\varepsilon_0} \\
\nabla \cdot \mathbf{B} &amp;= 0 \\
\nabla \times \mathbf{E} &amp;= -\frac{\partial \mathbf{B}}{\partial t}
\\
\nabla \times \mathbf{B} &amp;= \mu_0 \mathbf{J} + \mu_0 \varepsilon_0
\frac{\partial \mathbf{E}}{\partial t}
\end{aligned}</span></p>
<h2 id="fractions-and-nested-expressions">Fractions and Nested
Expressions</h2>
<p><span class="math display">\cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 +
\cfrac{1}{1 + \cdots}}}}</span></p>
<p><span class="math display">\binom{n}{k} =
\frac{n!}{k!(n-k)!}</span></p>
<h2 id="limits-and-calculus">Limits and Calculus</h2>
<p><span class="math display">\lim_{n \to \infty} \left(1 +
\frac{1}{n}\right)^n = e</span></p>
<p><span class="math display">\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}</span></p>
<h2 id="greek-and-symbols">Greek and Symbols</h2>
<p><span class="math display">\Gamma(z) = \int_0^{\infty} t^{z-1} e^{-t}
\, dt, \quad \Re(z) &gt; 0</span></p>
<p><span class="math display">\mathcal{L}\{f(t)\} = \int_0^{\infty} f(t)
e^{-st} \, dt</span></p>
<h2 id="cases">Cases</h2>
<p><span class="math display">|x| = \begin{cases} x &amp; \text{if } x
\geq 0 \\ -x &amp; \text{if } x &lt; 0 \end{cases}</span></p>
<script>(function(){var es=new EventSource("http://localhost:33395/__live/events");es.addEventListener("reload",function(){location.reload();});})()</script>
</body>
</html>

46
test_math.md Normal file
View file

@ -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}$$