Skip to content

Commit

Permalink
fix(export.markdown): fix incorrect reset of ordered list item count (n…
Browse files Browse the repository at this point in the history
  • Loading branch information
ALVAROPING1 authored and Furkan Sahin committed May 15, 2024
1 parent b2e240d commit defccd4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lua/neorg/modules/core/export/markdown/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ local function unordered_list_prefix(level)
end

local function ordered_list_prefix(level)
return function(_, _, state)
return function(_, node, state)
state.ordered_list_level[level] = state.ordered_list_level[level] + 1
state.weak_indent = ((level - 1) * 4) + 3 + (tostring(state.ordered_list_level[level]):len() - 1)

for i = level + 1, 6 do
state.ordered_list_level[i] = 0
local parent = node:parent()
local prev_node = parent:prev_named_sibling()
-- If the previous node from the current parent (`ordered_list`) isn't another ordered
-- list node, the list was split and the current count should be restarted
if prev_node == nil or prev_node:type() ~= parent:type() then
state.ordered_list_level[level] = 1
end

return {
Expand Down

0 comments on commit defccd4

Please sign in to comment.