-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mistune 2.0 upgrading guide? #290
Comments
I get the same error, but about |
Render I think is replaced with HTMLRenderer. Also I found escape_link is also missing. I am more worried about how to disable the include directive. I am processing user supplied For the time being I am keeping Roundup pinned to 0.8.4 version of mistune. |
Instead of directly instantiating and using HTMLRenderer, you should instead use mistune.create_markdown. escape_link functionality is now implemented directly by the html renderer: https://github.com/lepture/mistune/blob/v2.0.2/mistune/renderers.py#L116 If you were just using escape_link to filter urls by scheme, you can do this with python's built-in urllib. from urllib.parse import urlparse
# python 2: from urlparse import urlparse
SAFE_SCHEMES = ['http', 'https', 'ftp']
def is_safe_url(url):
scheme = urlparse(url)[0]
return scheme in SAFE_SCHEMES
The include directive is only enabled if you explicitly enable it. You can check what plugins are enabled by default by reading the definition of Or, you can just call |
I generate my own renderer (see below), I assume my renderer class gets instantiated and passed in
Under 0.8.4 I was setting:
A safe scheme filter is safer though. Note that I add the
My class overrides autolink and link methods. The class is passed to markdown as:
Ok. I'll try to work with it sometime this week. Thanks. |
Here is how @fmigneault upgraded to Mistune 2.0 common-workflow-language/schema_salad@4733227#diff-73bac5f09290fd54add4e5397028f1f1d02a787c8f445a92cb578ead12582953 |
Congratulations on your release!
Any advice for updating to Mistune 2.0 from 0.8.x?
The text was updated successfully, but these errors were encountered: