From d5e02b0823aba8a6b0ca33998dca2ae809569fac Mon Sep 17 00:00:00 2001 From: Lambtho Date: Sun, 17 Apr 2022 20:39:51 +0200 Subject: [PATCH] fix: media links issue, closes #91 --- lua/taglinks/taglinks.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/taglinks/taglinks.lua b/lua/taglinks/taglinks.lua index 042357e..b27a7cc 100644 --- a/lua/taglinks/taglinks.lua +++ b/lua/taglinks/taglinks.lua @@ -9,6 +9,7 @@ M.is_tag_or_link_at = function(line, col, opts) and line:sub(1, 4) == "tags" local seen_bracket = false + local seen_parenthesis = false local cannot_be_tag = false while col >= 1 do @@ -20,8 +21,17 @@ M.is_tag_or_link_at = function(line, col, opts) end end + if seen_parenthesis then + -- Media link, currently identified by not link nor tag + if char == "]" then + return nil, nil + end + end + if char == "[" then seen_bracket = true + elseif char == "(" then + seen_parenthesis = true end if is_tagline == true then