diff --git a/lua/neorg/modules/core/integrations/treesitter/module.lua b/lua/neorg/modules/core/integrations/treesitter/module.lua index f15c1f943..aec306aa8 100644 --- a/lua/neorg/modules/core/integrations/treesitter/module.lua +++ b/lua/neorg/modules/core/integrations/treesitter/module.lua @@ -386,7 +386,10 @@ module.public = { end, --- Given a node this function will break down the AST elements and return the corresponding text for certain nodes -- @Param tag_node (userdata/treesitter node) - a node of type tag/carryover_tag - get_tag_info = function(tag_node) + get_tag_info = function(tag_node, strict) + if strict == nil then + strict = true + end if not tag_node or not vim.tbl_contains( @@ -429,13 +432,17 @@ module.public = { for i, line in ipairs(content) do if i == 1 then if content_start_column < start_column then - log.error( - string.format( - "Unable to query information about tag on line %d: content is indented less than tag start!", - start_row + 1 + if strict then + log.error( + string.format( + "Unable to query information about tag on line %d: content is indented less than tag start!", + start_row + 1 + ) ) - ) - return nil + return nil + else + start_column = content_start_column + end end content[i] = string.rep(" ", content_start_column - start_column) .. line else diff --git a/lua/neorg/modules/core/tangle/module.lua b/lua/neorg/modules/core/tangle/module.lua index 3147126ab..228b281d6 100644 --- a/lua/neorg/modules/core/tangle/module.lua +++ b/lua/neorg/modules/core/tangle/module.lua @@ -275,7 +275,7 @@ module.public = { local capture = query.captures[id] if capture == "tag" then - local parsed_tag = treesitter.get_tag_info(node) + local parsed_tag = treesitter.get_tag_info(node, false) if parsed_tag then local declared_filetype = parsed_tag.parameters[1]