fix: preserve list context and nested CSS decoration behavior
This commit is contained in:
@@ -48,9 +48,14 @@ local function mark(items, stack)
|
||||
end
|
||||
local function list_paragraphs(list)
|
||||
for _, item in ipairs(list.content) do
|
||||
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
|
||||
target = 'list_task'
|
||||
end
|
||||
for index, block in ipairs(item) do
|
||||
if block.t == 'Para' then
|
||||
item[index] = pandoc.Div({block}, pandoc.Attr('', {}, {['custom-style']='MDHelperSourceListParagraph'}))
|
||||
item[index] = pandoc.Div({block}, pandoc.Attr('', {}, {['custom-style']='MDHelperSourceListParagraph_' .. target}))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -63,8 +68,9 @@ local function quoted_paragraphs(quote)
|
||||
end
|
||||
end
|
||||
return quote:walk({Div=function(block)
|
||||
if block.attributes['custom-style'] == 'MDHelperSourceListParagraph' then
|
||||
block.attributes['custom-style'] = 'MDHelperSourceQuotedListParagraph'
|
||||
local name = block.attributes['custom-style'] or ''
|
||||
if name:match('^MDHelperSourceListParagraph') then
|
||||
block.attributes['custom-style'] = name:gsub('^MDHelperSourceListParagraph', 'MDHelperSourceQuotedListParagraph')
|
||||
end
|
||||
return block
|
||||
end})
|
||||
|
||||
Reference in New Issue
Block a user