Skip to content

Commit

Permalink
fix(parser-inline): Fixed label range for reference links
Browse files Browse the repository at this point in the history
Ref: #177
  • Loading branch information
OXY2DEV committed Jan 12, 2025
1 parent acc23a0 commit f03b10e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/markview/parsers/markdown_inline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit f03b10e

Please sign in to comment.