From f03b10ed82c228b28af3e71bc5bdf5f6a5573a0e Mon Sep 17 00:00:00 2001 From: Shawon Date: Sun, 12 Jan 2025 10:22:27 +0600 Subject: [PATCH] fix(parser-inline): Fixed label range for reference links Ref: #177 --- lua/markview/parsers/markdown_inline.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/markview/parsers/markdown_inline.lua b/lua/markview/parsers/markdown_inline.lua index 78d847e..102e6a1 100644 --- a/lua/markview/parsers/markdown_inline.lua +++ b/lua/markview/parsers/markdown_inline.lua @@ -363,7 +363,7 @@ inline.reference_link = function (buffer, TSNode, text, range) local link_label; for child in TSNode:iter_children() do - if child:type() == "image_description" then + if child:type() == "link_text" then link_label = vim.treesitter.get_node_text(child, buffer):gsub("[%[%]%(%)]", ""); range.label = { child:range() }; elseif child:type() == "link_label" or child:type() == "link_destination" then @@ -372,7 +372,7 @@ inline.reference_link = function (buffer, TSNode, text, range) end end - range.label = range.label or { range.row_start, range.col_start + 2, range.row_end, range.col_end - 3 }; + range.label = range.label or { range.row_start, range.col_start + 1, range.row_end, range.col_end - 3 }; inline.insert({ class = "inline_link_hyperlink",