Changes migrating from v2 to v3
Closed this issue · 2 comments
I updated from 2.x to 3.x and I noticed there are other changes with respect to the upgrade guide, no big deal but worth to tell you :)
- abbr(self, key, definition)
+ abbr(self, text: str, title: str)
- task_list_item(self, text: str, level: int, checked: bool)
+ task_list_item(self, text: str, checked: bool)
I'm building a custom renderer, and the output is not textual, but rather a tree of components... FWIW is a Plotly Dash renderer, so I needed to migrate other parts of my code as my renderer doesn't play well with "".join
functions and similar.
So I needed to override the render_tokens
method, in the other version I changed the finalize
method though:
def render_tokens(self, tokens, state):
- return ''.join(self.iter_tokens(tokens, state))
+ return list(self.iter_tokens(tokens, state))
And in the image(self, alt: str, url: str, title: Optional[str] = None)
method I noticed that alt
it's actually a List[str]
.. easy to fix but I wanted to know what to expect for the alt
argument.
Moreover if you have other advices for implementing a non-textual renderer I'd be happy :)
Thanks for the great work with Mistune!!
The way you subclass render and change render_tokens is correct.
I've upgraded the documentation, close this issue.