mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Avoid Markdown 2.6 deprecations; make MD_EXTENSIONS a dict
* 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
This commit is contained in:
parent
a2852da3e7
commit
510961bbb9
6 changed files with 51 additions and 15 deletions
|
|
@ -246,9 +246,8 @@ class MarkdownReader(BaseReader):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MarkdownReader, self).__init__(*args, **kwargs)
|
||||
self.extensions = list(self.settings['MD_EXTENSIONS'])
|
||||
if 'meta' not in self.extensions:
|
||||
self.extensions.append('meta')
|
||||
self.extensions = self.settings['MD_EXTENSIONS']
|
||||
self.extensions.setdefault('markdown.extensions.meta', {})
|
||||
self._source_path = None
|
||||
|
||||
def _parse_metadata(self, meta):
|
||||
|
|
@ -284,7 +283,8 @@ class MarkdownReader(BaseReader):
|
|||
"""Parse content and metadata of markdown files"""
|
||||
|
||||
self._source_path = source_path
|
||||
self._md = Markdown(extensions=self.extensions)
|
||||
self._md = Markdown(extensions=self.extensions.keys(),
|
||||
extension_configs=self.extensions)
|
||||
with pelican_open(source_path) as text:
|
||||
content = self._md.convert(text)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue