-- assets/table-header-bold.lua local function bold_blocks(blocks) local out = {} for _, blk in ipairs(blocks) do if blk.t == "Plain" then table.insert(out, pandoc.Plain({ pandoc.Strong(blk.content) })) elseif blk.t == "Para" then table.insert(out, pandoc.Para({ pandoc.Strong(blk.content) })) else table.insert(out, blk) end end return out end function Table(tbl) -- 1) Bold header if tbl.head and tbl.head.rows then for _, row in ipairs(tbl.head.rows) do for _, cell in ipairs(row.cells or {}) do cell.contents = bold_blocks(cell.contents or {}) end end end -- 2) Bold các ô bắt đầu bằng "Chủ đề" if tbl.bodies then for _, body in ipairs(tbl.bodies) do if body.body and body.body.rows then for _, row in ipairs(body.body.rows) do for _, cell in ipairs(row.cells or {}) do local txt = pandoc.utils.stringify(cell) if txt:match("^[%s]*[Cc][Hh][Uu][^ ]*[ ]*[Dd][Ee][Ee]") then cell.contents = bold_blocks(cell.contents or {}) end end end end end end return tbl end