diff --git a/docs/faq.rst b/docs/faq.rst index f75e4e6c..ace6a44f 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -69,10 +69,12 @@ I want to use Markdown, but I got an error. If you try to generate Markdown content without first installing the Markdown library, may see a message that says ``No valid files found in content``. -Markdown is not a hard dependency for Pelican, so if you have content in +Markdown is not a required dependency for Pelican, so if you have content in Markdown format, you will need to explicitly install the Markdown library. -You can do so by typing the following command, prepending ``sudo`` if -permissions require it:: +Pelican will attempt to check this for you, so you should also see an error +message that says ``It appears you do not have the "markdown" package +installed``. You can do so by typing the following command, prepending +``sudo`` if permissions require it:: pip install markdown diff --git a/pelican/__init__.py b/pelican/__init__.py index f676c33f..5a5b082f 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -19,7 +19,7 @@ from pelican import signals from pelican.generators import (ArticlesGenerator, PagesGenerator, SourceFileGenerator, StaticGenerator, TemplatePagesGenerator) -from pelican.readers import Readers +from pelican.readers import Markdown, MarkdownReader, Readers from pelican.settings import read_settings from pelican.utils import (clean_output_dir, file_watcher, folder_watcher, maybe_pluralize) @@ -401,6 +401,21 @@ def main(): pelican.ignore_files), 'settings': file_watcher(args.settings)} + # check to see if user is attempting to process markdown without the + # dependency installed + markdown_files = folder_watcher( + pelican.path, + MarkdownReader.file_extensions, + pelican.ignore_files + ) + + if Markdown is False and next(markdown_files) is not None: + logger.warning( + 'It appears you have Markdown content but do not have the ' + '"markdown" package installed, which is required for ' + 'processing Markdown-based content.' + ) + old_static = settings.get("STATIC_PATHS", []) for static_path in old_static: # use a prefix to avoid possible overriding of standard watchers