From 399832e5437de0cea5efb1d5428de03adc42cc79 Mon Sep 17 00:00:00 2001 From: Ben Lubas <56943754+benlubas@users.noreply.github.com> Date: Sun, 12 Jan 2025 14:02:51 -0500 Subject: [PATCH] fix(toc): only capture first detached modifier (#1631) --- lua/neorg/modules/core/qol/toc/module.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lua/neorg/modules/core/qol/toc/module.lua b/lua/neorg/modules/core/qol/toc/module.lua index cf1f7e4db..21fbc1d6f 100644 --- a/lua/neorg/modules/core/qol/toc/module.lua +++ b/lua/neorg/modules/core/qol/toc/module.lua @@ -268,17 +268,21 @@ module.public = { local start_lines = { offset = offset } ui_data.start_lines = start_lines + ---@type vim.treesitter.Query toc_query = toc_query or utils.ts_parse_query( "norg", - [[ - ( - [(heading1_prefix)(heading2_prefix)(heading3_prefix)(heading4_prefix)(heading5_prefix)(heading6_prefix)]@prefix - . - state: (detached_modifier_extension (_)@modifier)? - . - title: (paragraph_segment)@title - )]] + [[ ( + [(heading1_prefix) + (heading2_prefix) + (heading3_prefix) + (heading4_prefix) + (heading5_prefix) + (heading6_prefix) + ] @prefix + state: (detached_modifier_extension . (_)@modifier)? + title: (paragraph_segment) @title + ) ]] ) local norg_root = module.required["core.integrations.treesitter"].get_document_root(norg_buffer)