refactor(presets): use --katex instead of --embed-resources --mathml
Problem: `--embed-resources` with `--mathml` caused pandoc to inline all assets at compile time, adding ~15s per save for KaTeX-heavy documents. Solution: Default to `--katex`, which inserts a CDN `<script>` tag and defers rendering to the browser. Users can opt into `--embed-resources` or `--mathml` via `extra_args`.
This commit is contained in:
parent
e513fc57d1
commit
8049730803
2 changed files with 6 additions and 8 deletions
|
|
@ -224,7 +224,7 @@ M.markdown = {
|
|||
ft = 'markdown',
|
||||
cmd = { 'pandoc' },
|
||||
args = function(ctx)
|
||||
return { ctx.file, '-s', '--embed-resources', '--mathml', '-o', ctx.output }
|
||||
return { ctx.file, '-s', '--katex', '-o', ctx.output }
|
||||
end,
|
||||
output = function(ctx)
|
||||
return (ctx.file:gsub('%.md$', '.html'))
|
||||
|
|
@ -249,8 +249,7 @@ M.github = {
|
|||
'gfm',
|
||||
ctx.file,
|
||||
'-s',
|
||||
'--embed-resources',
|
||||
'--mathml',
|
||||
'--katex',
|
||||
'--css',
|
||||
'https://cdn.jsdelivr.net/gh/pixelbrackets/gfm-stylesheet@master/dist/gfm.css',
|
||||
'-o',
|
||||
|
|
|
|||
|
|
@ -294,11 +294,11 @@ describe('presets', function()
|
|||
assert.are.same({ 'pandoc' }, presets.markdown.cmd)
|
||||
end)
|
||||
|
||||
it('returns args with standalone, embed-resources, and mathml flags', function()
|
||||
it('returns args with standalone and katex flags', function()
|
||||
local args = presets.markdown.args(md_ctx)
|
||||
assert.is_table(args)
|
||||
assert.are.same(
|
||||
{ '/tmp/document.md', '-s', '--embed-resources', '--mathml', '-o', '/tmp/document.html' },
|
||||
{ '/tmp/document.md', '-s', '--katex', '-o', '/tmp/document.html' },
|
||||
args
|
||||
)
|
||||
end)
|
||||
|
|
@ -382,7 +382,7 @@ describe('presets', function()
|
|||
assert.are.same({ 'pandoc' }, presets.github.cmd)
|
||||
end)
|
||||
|
||||
it('returns args with standalone, embed-resources, mathml, and css flags', function()
|
||||
it('returns args with standalone, katex, and css flags', function()
|
||||
local args = presets.github.args(md_ctx)
|
||||
assert.is_table(args)
|
||||
assert.are.same({
|
||||
|
|
@ -390,8 +390,7 @@ describe('presets', function()
|
|||
'gfm',
|
||||
'/tmp/document.md',
|
||||
'-s',
|
||||
'--embed-resources',
|
||||
'--mathml',
|
||||
'--katex',
|
||||
'--css',
|
||||
'https://cdn.jsdelivr.net/gh/pixelbrackets/gfm-stylesheet@master/dist/gfm.css',
|
||||
'-o',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue