You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey. I would like to modify source markdown text for further rerendering it to markdown with mdformat.renderer.MDRenderer, but see no way of achiving it.
Now i'm converting tokens to SyntaxTree to traverse it with tree.walk and find all the nodes needed to drop.
After saving them in a list i deleted them like del tree.children[1].remove(nodes_to_drop[0]).
After all, tried to convert the modified tree print(MDRenderer().render(tree.to_tokens(), {}, {})) and got the error
inline_node = node.children[0]
IndexError: list index out of range
What is a proper way to delete a token, node or etc?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey. I would like to modify source markdown text for further rerendering it to markdown with
mdformat.renderer.MDRenderer
, but see no way of achiving it.SyntaxTree
to traverse it withtree.walk
and find all the nodes needed to drop.del tree.children[1].remove(nodes_to_drop[0])
.print(MDRenderer().render(tree.to_tokens(), {}, {}))
and got the errorWhat is a proper way to delete a token, node or etc?
Beta Was this translation helpful? Give feedback.
All reactions