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