Skip to content

Commit

Permalink
fix(toc): only capture first detached modifier (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas authored Jan 12, 2025
1 parent bed58f8 commit 399832e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lua/neorg/modules/core/qol/toc/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 399832e

Please sign in to comment.