1
0
Fork 0
forked from github/pelican

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:
Kernc 2015-11-08 23:08:03 +01:00
commit 510961bbb9
6 changed files with 51 additions and 15 deletions

View file

@ -207,3 +207,19 @@ class TestPelican(LoggedTestCase):
count=2,
msg="Writing .*",
level=logging.INFO)
def test_md_extensions_list_deprecation(self):
"""Test that a warning is issued if MD_EXTENSIONS is a list"""
settings = read_settings(path=None, override={
'PATH': INPUT_PATH,
'OUTPUT_PATH': self.temp_path,
'CACHE_PATH': self.temp_cache,
'MD_EXTENSIONS': ['meta'],
})
pelican = Pelican(settings=settings)
mute(True)(pelican.run)()
self.assertIsInstance(pelican.settings['MD_EXTENSIONS'], dict)
self.assertLogCountEqual(
count=1,
msg="The format of the MD_EXTENSIONS setting has changed",
level=logging.WARNING)

View file

@ -471,7 +471,12 @@ class MdReaderTest(ReaderTest):
# expected
page = self.read_file(
path='article_with_markdown_markup_extensions.md',
MD_EXTENSIONS=['toc', 'codehilite', 'extra'])
MD_EXTENSIONS={
'markdown.extensions.toc': {},
'markdown.extensions.codehilite': {},
'markdown.extensions.extra': {}
}
)
expected = ('<div class="toc">\n'
'<ul>\n'
'<li><a href="#level1">Level1</a><ul>\n'