Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
454030ad78 fix(compiler): do not auto-open on one-shot compile
Problem: auto-open fired on :Preview compile, which is a one-shot
build. Users compiling to check for errors or rebuild with the viewer
already open got an unexpected browser/viewer window.

Solution: gate auto-open on not opts.oneshot so it only fires during
toggle/watch mode, where opening the viewer on first compile is the
intended behaviour.
2026-03-04 14:51:14 -05:00
a2ef9a828f fix(presets): add --failure-level ERROR to asciidoctor args
Problem: asciidoctor exits 0 even when it encounters ERROR-level
messages, so the compiler treats every run as a success and never
invokes error_parser. Errors are silently embedded as visible text
in the HTML output instead of surfacing as diagnostics.

Solution: pass --failure-level ERROR so asciidoctor exits non-zero
on errors, which triggers error_parser and surfaces diagnostics.
2026-03-04 14:48:12 -05:00
3 changed files with 4 additions and 2 deletions

View file

@ -162,6 +162,7 @@ function M.compile(bufnr, name, provider, ctx, opts)
if
provider.open
and not opts.oneshot
and not opened[bufnr]
and output_file ~= ''
and vim.uv.fs_stat(output_file)
@ -240,6 +241,7 @@ function M.compile(bufnr, name, provider, ctx, opts)
end
if
provider.open
and not opts.oneshot
and not opened[bufnr]
and output_file ~= ''
and vim.uv.fs_stat(output_file)

View file

@ -246,7 +246,7 @@ M.asciidoctor = {
ft = 'asciidoc',
cmd = { 'asciidoctor' },
args = function(ctx)
return { ctx.file, '-o', ctx.output }
return { '--failure-level', 'ERROR', ctx.file, '-o', ctx.output }
end,
output = function(ctx)
return (ctx.file:gsub('%.adoc$', '.html'))

View file

@ -467,7 +467,7 @@ describe('presets', function()
it('returns args with file and output', function()
assert.are.same(
{ '/tmp/document.adoc', '-o', '/tmp/document.html' },
{ '--failure-level', 'ERROR', '/tmp/document.adoc', '-o', '/tmp/document.html' },
presets.asciidoctor.args(adoc_ctx)
)
end)