From bcd8050b990a5ab65f5403e8f8bf39187ff88054 Mon Sep 17 00:00:00 2001 From: benlubas Date: Fri, 24 May 2024 22:02:54 -0600 Subject: [PATCH] fix(latex-renderer): handle broken latex --- .../modules/core/latex/renderer/module.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/neorg/modules/core/latex/renderer/module.lua b/lua/neorg/modules/core/latex/renderer/module.lua index 343dafa99..052ec4e6f 100644 --- a/lua/neorg/modules/core/latex/renderer/module.lua +++ b/lua/neorg/modules/core/latex/renderer/module.lua @@ -403,13 +403,16 @@ local function render_latex() render_timer = nil if not running_proc then - running_proc = nio.run(function() - nio.scheduler() - module.public.async_latex_renderer(buf) - end, function() - module.public.render_inline_math(module.private.latex_images[buf] or {}, buf) - running_proc = nil - end) + running_proc = nio.run( + function() + nio.scheduler() + module.public.async_latex_renderer(buf) + end, + vim.schedule_wrap(function() + module.public.render_inline_math(module.private.latex_images[buf] or {}, buf) + running_proc = nil + end) + ) end end) end