frostming / marko

A markdown parser with high extensibility.

Home Page:https://marko-py.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tables in AST Results

cytwill opened this issue · comments

I found that markdown tables are not included in the current AST elements. So I am wondering if this extension would be implemented recently?

table element is not included in standard commonmark but in the github flavored markdown, try this:

from marko.ext.gfm import GFM
from marko import Markdown
from marko.ast_renderer import ASTRenderer

markdown = Markdown(renderer=ASTRenderer)
markdown._extra_elements.extend(GFM.elements)
markdown.convert(text)

Sure, thanks for answering!