Closed sciencectn closed 6 months ago
Seems like these lines might have something to do with it:
https://github.com/frostming/marko/blob/625f8a4373720d806286c7c8735ac4027e9dbd57/marko/renderer.py#L62-L63
They set the root_node
to any Element
but it seems like it should only be set to a Document
.
Here's a workaround which is to set root_node
manually:
import marko
import marko.md_renderer
doc = marko.parse("[link](http://bouncingdvdlogo.com/)")
link = doc.children[0].children[0]
renderer = marko.md_renderer.MarkdownRenderer()
renderer.root_node=doc
renderer.render(link)
Maybe we could throw an error if render_link
is called and the root_node
isn't set? Then drop these lines so root_node
stays None
then functions aren't tempted to access it. I tried dropping those lines, the tests still pass.
I'm trying to turn some selected
Link
elements back into text. ButMarkdownRenderer
gives an error. Here's an example:and the output: