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
Avoid Markdown 2.6 deprecations #1638
Conversation
'css_class':'highlight' | ||
} | ||
self._md = Markdown(extensions=self.extensions, | ||
extension_configs=extension_configs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will surprise too many unweary users. If they want some other css_class
, they will have had something else in MD_EXTENSIONS
anyway.
Hey, gonna pile on this: wasn't headerid part of extra before it now got About the config thing, Can we not just blindly overwrite or correct settings? Would be better to use our deprecation functions somehow and warn the user that we are changing his settings to the now correct ones. |
Apparently I was wrong and extra never included headerid |
What about a code like this: settings.py 'MD_EXTENSIONS': [
'codehilite-INTERNAL-ONLY', # something that would never have been entered by a user
'markdown.extensions.extra'
], readers.py if 'codehilite-INTERNAL-ONLY' in self.extensions:
... # correct the plugin name
... # set the default css_class setting as above I wouldn't know how to use the deprecation machinery here, nor how it applies. |
It's probably better to expose 'MD_EXTENSIONS': [
'markdown.extensions.codehilite'
'markdown.extensions.extra'
],
'MD_EXTENSION_CONFIGS' : {'markdown.extensions.codehilite' : {'css_class': 'highlight' }}, and the user defined config will MD_EXTENSION_CONFIGS = {'markdown.extensions.meta': {'yaml': True}} to turn on YAML processing. Besides that, |
~~So then when Markdown decides to break its API with 3.0, wrap everything once again to provide backwards compatibility? I'm against it. The |
944bea2
to
f048000
Compare
@@ -39,184 +39,186 @@ Here is a list of settings for Pelican: | |||
Basic settings | |||
============== | |||
|
|||
=============================================================================== ===================================================================== | |||
Setting name (followed by default value, if any) What does it do? | |||
=============================================================================== ===================================================================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git diff --ignore-space-change
shows the true changes here.
ae9880f
to
499014a
Compare
How about now? 😅 |
@justinmayer Ah, sorry, I somehow missed the last commit. @kernc Looks mostly OK. Use of EDIT: On second look, that |
Am I the only one who is against introducing setting deprectiation in readers.py? |
@kernc any update on this? Can you move the depreciation into the appropriate section? @justinmayer might want to tag this to keep track of it for soonish release |
@ingwinlu: Tagged. Thanks! |
bfd31b8
to
c08866e
Compare
hey @kernc good to see you are still on board with this. some food for thought:
there also appears quite some ws in this commit, is that really necessary (in the doc)? |
c08866e
to
33580b4
Compare
@ingwinlu I agree with your considerations, will implement asap. Re table whitespace: the default value string should get pretty long. Should I put the default value in the right-hand column instead? |
@kernc: I think putting the default value in the right-hand column for this particular setting might indeed make sense, obviating the need to adjust the spacing for the entire table. |
Hi @kernc. Just following up on this PR. Any chance you might be able to get it ready for merge as noted above? |
95d1617
to
2b18a3f
Compare
@justinmayer sorry, thanks. 😳 @ingwinlu How would I "reduce the configs and replace them with a single dict"? Isn't that exactly the opposite of what @avaris recommended? I also did (almost) drop the eval? Is it better now or is it still unsafe? |
As proposed by in getpelican#1638 (comment)
@@ -50,7 +50,8 @@ Take a look at the Markdown reader:: | |||
def read(self, source_path): | |||
"""Parse content and metadata of markdown files""" | |||
text = pelican_open(source_path) | |||
md = Markdown(extensions = ['meta', 'codehilite']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be updated as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. 😅
711be33
to
e9259d3
Compare
As proposed by in getpelican#1638 (comment)
Why are we hard-quitting after a misconfiguration that doesn't have any major effect? I seriously disagree with that. It should be treated same as any other misconfiguration: ignore and fall back to default with a warning. |
e9259d3
to
7e58d58
Compare
As proposed by in getpelican#1638
7e58d58
to
3ef99c9
Compare
As proposed by in getpelican#1638
3ef99c9
to
d7c3a39
Compare
As proposed by in getpelican#1638
That's exactly why I asked, thanks. |
logger.warning('The format of the MD_EXTENSIONS setting has ' | ||
'changed. It should now be a dict mapping ' | ||
'fully-qualified extension names to their ' | ||
'configurations. Falling back to the default') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing tailing '.'
other than the comments in the code, this looks good to me now. if you want to get rid of coveralls warning you might need to add a test for the warning issued when md_extensions is still a list. see other tests that look for logged messages. |
As proposed by in getpelican#1638
d7c3a39
to
73d2a75
Compare
As proposed by in getpelican#1638
You're a nitpicker, aren't you. 😛 |
I would love not have to have to correct you. Squash is still missing, after that we are good to go @justinmayer |
@kernc: As Winlu suggested, would you be so kind as to squash your commits? Many thanks for patiently working with us to get this ready for merge. (^_^) |
12bd1a6
to
090ffdd
Compare
Oh, no problem at all. |
* Make MD_EXTENSIONS setting a dict and add tests for this change; * Short extension names ('extra', 'meta') are deprecated https://pythonhosted.org/Markdown/release-2.6.html#shortened-extension-names-deprecated * Extension config as part of extension name is deprecated https://pythonhosted.org/Markdown/release-2.6.html#extension-configuration-as-part-of-extension-name-deprecated
090ffdd
to
510961b
Compare
Avoid Markdown 2.6 deprecations
https://pythonhosted.org/Markdown/release-2.6.html#shortened-extension-names-deprecated
https://pythonhosted.org/Markdown/release-2.6.html#extension-configuration-as-part-of-extension-name-deprecated
The
MD_EXTENSIONS
documentation indocs/settings.rst
hasn't been touched, so it still shows the old value.