fix: retain conflicting saves and preserve list content in Word

This commit is contained in:
2026-11-05 11:57:06 +08:00
parent e605c2f8d3
commit b3a0907e1a
11 changed files with 283 additions and 27 deletions
@@ -48,6 +48,12 @@ local function mark(items, stack)
end
local function list_paragraphs(list)
for _, item in ipairs(list.content) do
-- Word numbers paragraphs, not tables. Give a table-first item its own
-- empty numbered paragraph; its following text remains a continuation.
if item[1] and item[1].t == 'Table' then
item:insert(1, pandoc.Div({pandoc.Para({pandoc.Str('\u{200b}')})},
pandoc.Attr('', {}, {['custom-style']='MDHelperSourceTableMarker'})))
end
local target = list.t == 'OrderedList' and 'list_ordered' or 'list_bullet'
local text = pandoc.utils.stringify(item[1] or {})
if text:match('^%[[ xX]%]') or text:sub(1, #'☐') == '☐' or text:sub(1, #'☒') == '☒' or text:sub(1, #'☑') == '☑' then