mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add warning when content is not found and markdown is not installed
This commit is contained in:
parent
994758aa07
commit
39fb2c8a98
2 changed files with 21 additions and 4 deletions
|
|
@ -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
|
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``.
|
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.
|
Markdown format, you will need to explicitly install the Markdown library.
|
||||||
You can do so by typing the following command, prepending ``sudo`` if
|
Pelican will attempt to check this for you, so you should also see an error
|
||||||
permissions require it::
|
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
|
pip install markdown
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ from pelican import signals
|
||||||
from pelican.generators import (ArticlesGenerator, PagesGenerator,
|
from pelican.generators import (ArticlesGenerator, PagesGenerator,
|
||||||
SourceFileGenerator, StaticGenerator,
|
SourceFileGenerator, StaticGenerator,
|
||||||
TemplatePagesGenerator)
|
TemplatePagesGenerator)
|
||||||
from pelican.readers import Readers
|
from pelican.readers import Markdown, MarkdownReader, Readers
|
||||||
from pelican.settings import read_settings
|
from pelican.settings import read_settings
|
||||||
from pelican.utils import (clean_output_dir, file_watcher,
|
from pelican.utils import (clean_output_dir, file_watcher,
|
||||||
folder_watcher, maybe_pluralize)
|
folder_watcher, maybe_pluralize)
|
||||||
|
|
@ -401,6 +401,21 @@ def main():
|
||||||
pelican.ignore_files),
|
pelican.ignore_files),
|
||||||
'settings': file_watcher(args.settings)}
|
'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", [])
|
old_static = settings.get("STATIC_PATHS", [])
|
||||||
for static_path in old_static:
|
for static_path in old_static:
|
||||||
# use a prefix to avoid possible overriding of standard watchers
|
# use a prefix to avoid possible overriding of standard watchers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue