Skip to content

Commit 399832e

Browse files
authored
fix(toc): only capture first detached modifier (#1631)
1 parent bed58f8 commit 399832e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lua/neorg/modules/core/qol/toc/module.lua

+12-8
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,21 @@ module.public = {
268268
local start_lines = { offset = offset }
269269
ui_data.start_lines = start_lines
270270

271+
---@type vim.treesitter.Query
271272
toc_query = toc_query
272273
or utils.ts_parse_query(
273274
"norg",
274-
[[
275-
(
276-
[(heading1_prefix)(heading2_prefix)(heading3_prefix)(heading4_prefix)(heading5_prefix)(heading6_prefix)]@prefix
277-
.
278-
state: (detached_modifier_extension (_)@modifier)?
279-
.
280-
title: (paragraph_segment)@title
281-
)]]
275+
[[ (
276+
[(heading1_prefix)
277+
(heading2_prefix)
278+
(heading3_prefix)
279+
(heading4_prefix)
280+
(heading5_prefix)
281+
(heading6_prefix)
282+
] @prefix
283+
state: (detached_modifier_extension . (_)@modifier)?
284+
title: (paragraph_segment) @title
285+
) ]]
282286
)
283287

284288
local norg_root = module.required["core.integrations.treesitter"].get_document_root(norg_buffer)

0 commit comments

Comments
 (0)