From 872a8edd714127bc38cd2ec04b5752fa48fa8266 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 6 Mar 2026 13:23:31 -0500 Subject: [PATCH] fix(presets): add `--mathml` to `markdown` and `github` pandoc args Problem: pandoc's default HTML math renderer cannot handle most TeX and dumps raw LaTeX source into the output. `--mathjax` and `--katex` are incompatible with `--embed-resources` because pandoc cannot inline dynamically-loaded JavaScript modules and fonts. Solution: add `--mathml` to both `markdown` and `github` preset args. MathML is rendered natively by all modern browsers with no external dependencies, making it the only math option compatible with self-contained HTML output. --- lua/preview/presets.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/preview/presets.lua b/lua/preview/presets.lua index d4b03cc..1f333bf 100644 --- a/lua/preview/presets.lua +++ b/lua/preview/presets.lua @@ -224,7 +224,7 @@ M.markdown = { ft = 'markdown', cmd = { 'pandoc' }, args = function(ctx) - return { ctx.file, '-s', '--embed-resources', '-o', ctx.output } + return { ctx.file, '-s', '--embed-resources', '--mathml', '-o', ctx.output } end, output = function(ctx) return (ctx.file:gsub('%.md$', '.html')) @@ -250,6 +250,7 @@ M.github = { ctx.file, '-s', '--embed-resources', + '--mathml', '--css', 'https://cdn.jsdelivr.net/gh/pixelbrackets/gfm-stylesheet@master/dist/gfm.css', '-o',