refactor(presets): add reload field, remove synctex field

Problem: the synctex field only handled PDF forward search and left
HTML live-preview and typst watch mode unsupported.

Solution: add reload = function(ctx) returning { 'typst', 'watch',
ctx.file } to typst (long-running watch mode), reload = true to
markdown and github (SSE push after each pandoc compile), and remove
synctex = true from latex (the -synctex=1 arg in latex.args remains
for .synctex.gz generation).
This commit is contained in:
Barrett Ruth 2026-03-03 16:23:41 -05:00
parent 6c1609cba8
commit 6757c05dd2
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 27 additions and 0 deletions

View file

@ -37,6 +37,18 @@ describe('presets', function()
assert.is_true(presets.typst.open)
end)
it('has reload as a function', function()
assert.is_function(presets.typst.reload)
end)
it('reload returns typst watch command', function()
local result = presets.typst.reload(ctx)
assert.is_table(result)
assert.are.equal('typst', result[1])
assert.are.equal('watch', result[2])
assert.are.equal(ctx.file, result[3])
end)
it('parses errors from stderr', function()
local stderr = table.concat({
'main.typ:5:23: error: unexpected token',
@ -84,6 +96,7 @@ describe('presets', function()
assert.are.same({
'-pdf',
'-interaction=nonstopmode',
'-synctex=1',
'-pdflatex=pdflatex -file-line-error -interaction=nonstopmode %O %S',
'/tmp/document.tex',
}, args)
@ -186,6 +199,10 @@ describe('presets', function()
assert.is_true(presets.markdown.open)
end)
it('has reload enabled for SSE', function()
assert.is_true(presets.markdown.reload)
end)
it('parses YAML metadata errors with multiline message', function()
local output = table.concat({
'Error parsing YAML metadata at "/tmp/test.md" (line 1, column 1):',
@ -290,6 +307,10 @@ describe('presets', function()
assert.is_true(presets.github.open)
end)
it('has reload enabled for SSE', function()
assert.is_true(presets.github.reload)
end)
it('parses YAML metadata errors with multiline message', function()
local output = table.concat({
'Error parsing YAML metadata at "/tmp/test.md" (line 1, column 1):',