import panflute


class EmptyTableError(Exception):
    pass


def ast_to_markdown(ast):
    """convert panflute AST to Markdown"""
    return panflute.convert_text(
        ast,
        input_format='panflute',
        output_format='markdown'
    )


def table_for_pprint(table: panflute.Table):
    '''represent panflute Table in a dict structure for pprint

    >>> pprint(table_for_pprint(table), sort_dicts=False, compact=False, width=-1)

    Note:

    Each HeadRow, BodyRow, FootRow, Cell also has ica not shown here.

    TableBody has RowHeadColumns int
    '''
    return {
        'Table': (table.identifier, table.classes, table.attributes),
        'Caption': (tuple(short_caption) if (short_caption := table.caption.short_caption) else None, tuple(table.caption.content)),
        'specs': table.colspec,
        'TableHead': [list(row.content) for row in table.head.content],
        'TableBody': [list(row.content) for row in table.content[0].content],
        'TableFoot': [list(row.content) for row in table.foot.content],
    }

@@ -246,16 +246,549 @@
     )%0A%0A%0A
+def parse_markdown_codeblock(text: str) -%3E dict:%0A    '''parse markdown CodeBlock just as %60panflute.yaml_filter%60 would%0A%0A    useful for development to obtain the objects that the filter%0A    would see after passed to %60panflute.yaml_filter%60%0A%0A    :param str text: must be a single codeblock of class table in markdown%0A    '''%0A%0A    def function(**kwargs):%0A        return kwargs%0A%0A    doc = panflute.convert_text(text, standalone=True)%0A    return panflute.yaml_filter(doc.content%5B0%5D, doc, tag='table', function=function, strict_yaml=True)%0A%0A%0A
 def tabl

add parse_markdown_codeblock