forked from GithubBackups/healthchecks
The "render_docs" command checks if markdown and pygments is installed. cc: #329
This commit is contained in:
parent
174e5a7935
commit
82d61335b0
@ -22,7 +22,7 @@ class Command(BaseCommand):
|
|||||||
try:
|
try:
|
||||||
from pygments import lexers
|
from pygments import lexers
|
||||||
except ImportError:
|
except ImportError:
|
||||||
self.stdout.write("This command requires Pygments package.")
|
self.stdout.write("This command requires the Pygments package.")
|
||||||
self.stdout.write("Please install it with:\n\n")
|
self.stdout.write("Please install it with:\n\n")
|
||||||
self.stdout.write(" pip install Pygments\n\n")
|
self.stdout.write(" pip install Pygments\n\n")
|
||||||
return
|
return
|
||||||
|
@ -2,13 +2,23 @@ import os
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
import markdown
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Renders Markdown to HTML"
|
help = "Renders Markdown to HTML"
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
try:
|
||||||
|
import markdown
|
||||||
|
|
||||||
|
# We use pygments for highlighting code samples
|
||||||
|
import pygments
|
||||||
|
except ImportError as e:
|
||||||
|
self.stdout.write(f"This command requires the {e.name} package.")
|
||||||
|
self.stdout.write("Please install it with:\n\n")
|
||||||
|
self.stdout.write(f" pip install {e.name}\n\n")
|
||||||
|
return
|
||||||
|
|
||||||
extensions = ["fenced_code", "codehilite", "tables"]
|
extensions = ["fenced_code", "codehilite", "tables"]
|
||||||
ec = {"codehilite": {"css_class": "highlight"}}
|
ec = {"codehilite": {"css_class": "highlight"}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user