Browse Source

Fix md_inline_extension for Pelican 3.7+ (#875)

Bruno Macabeus 7 years ago
parent
commit
4cd3569949
1 changed files with 4 additions and 1 deletions
  1. 4 1
      md_inline_extension/inline.py

+ 4 - 1
md_inline_extension/inline.py

@@ -41,7 +41,10 @@ def inline_markdown_extension(pelicanobj, config):
 
     # Instantiate Markdown extension and append it to the current extensions
     try:
-        pelicanobj.settings['MD_EXTENSIONS'].append(PelicanInlineMarkdownExtension(config))
+        if isinstance(pelicanobj.settings.get('MD_EXTENSIONS'), list):  # pelican 3.6.3 and earlier
+            pelicanobj.settings['MD_EXTENSIONS'].append(PelicanInlineMarkdownExtension(config))
+        else:
+            pelicanobj.settings['MARKDOWN'].setdefault('extensions', []).append(PelicanInlineMarkdownExtension(config))
     except:
         sys.excepthook(*sys.exc_info())
         sys.stderr.write("\nError - the pelican Markdown extension failed to configure. Inline Markdown extension is non-functional.\n")