def md_table(table, *, padding=DEFAULT_PADDING, divider='<STR_LIT:|>', header_div='<STR_LIT:->'):
table = normalize_cols(table)<EOL>table = pad_cells(table)<EOL>header = table[<NUM_LIT:0>]<EOL>body = table[<NUM_LIT:1>:]<EOL>col_widths = [len(cell) for cell in header]<EOL>horiz = horiz_div(col_widths, header_div, divider, padding)<EOL>header = add_dividers(header, divider, padding)<EOL>body = [add_dividers(row, divider, padding) for row in body]<EOL>table = [header, horiz]<EOL>table.extend(body)<EOL>table = [row.rstrip() for row in table]<EOL>return '<STR_LIT:\n>'.join(table)<EOL>
Convert a 2D array of items into a Markdown table.

padding: the number of padding spaces on either side of each divider
divider: the vertical divider to place between columns
header_div: the horizontal divider to place between the header row and
    body cells