From a541e8c49a4f46c64fa559d3cd64cb0678766023 Mon Sep 17 00:00:00 2001 From: Luckas Date: Mon, 8 Apr 2024 12:14:26 +0300 Subject: [PATCH] fix: empty src attribute (#75) --- lua/nvim-devdocs/transpiler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-devdocs/transpiler.lua b/lua/nvim-devdocs/transpiler.lua index b5d04e8..25d98c7 100644 --- a/lua/nvim-devdocs/transpiler.lua +++ b/lua/nvim-devdocs/transpiler.lua @@ -289,7 +289,7 @@ function transpiler:eval(node) if tag_name == "a" then result = string.format("[%s](%s)", result, attributes.href) - elseif tag_name == "img" and string.match(attributes.src, "^data:") then + elseif tag_name == "img" and string.match(attributes.src or "", "^data:") then result = string.format("![%s](%s)\n", attributes.alt, "data:inline_image") elseif tag_name == "img" then result = string.format("![%s](%s)\n", attributes.alt, attributes.src)