Closed nschloe closed 11 months ago
I'd like to parse a table and render it back to markdown. The MarkdownRenderer() can't do it, and gfm.render() renders to HTML.
MarkdownRenderer()
gfm.render()
from marko.md_renderer import MarkdownRenderer from marko.ext.gfm import gfm text = """ | a | | :--: | | b | """ doc = gfm.parse(text) print(MarkdownRenderer().render(doc)) print() print(gfm.render(doc))
ab <table> <thead> <tr> <th align="center">a</th> </tr> </thead> <tbody> <tr> <td align="center">b</td> </tr> </tbody></table>
Use the regular Markdown parser:
md = marko.Markdown(renderer=MarkdownRenderer) print(md.convert(text), end="")
I'd like to parse a table and render it back to markdown. The
MarkdownRenderer()
can't do it, andgfm.render()
renders to HTML.