Skip to content

RecursionError when rendering inlineHTML to markdown with GFM extension #221

@wilko77

Description

@wilko77

I created this example code:

import marko
from marko.md_renderer import MarkdownRenderer
from marko.ext.gfm import GFM

markdown_text = "Press **<Enter>**"
md = marko.Markdown(extensions=[GFM], renderer=MarkdownRenderer)
ast = md.parse(markdown_text)
print(md.render(ast))

I get:

File "/Users/******/temp/m_env/lib/python3.10/site-packages/marko/helpers.py", line 168, in super_render
    return getattr(super(type(r), r), self.name)(element)
  [Previous line repeated 980 more times]
  File "/Users/******/temp/m_env/lib/python3.10/site-packages/marko/helpers.py", line 182, in __get__
    if isinstance(obj, types):
RecursionError: maximum recursion depth exceeded in __instancecheck__

The offending element in the AST is the InlineHTML node around the '<Enter>' bit.
Also, the error doesn't happen without the GFM extension. Somehow, the interplay of the GFM render mixin and the MarkdownRenderer doesn't work out in this case.
I'd really like to use the GFM extension though to render tables and fancy stuff like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions