0
0
Fork 0
mirror of https://github.com/healthchecks/healthchecks.git synced 2025-04-11 15:51:19 +00:00

The "render_docs" command checks if markdown and pygments is installed. cc:

This commit is contained in:
Pēteris Caune 2020-02-14 10:14:29 +02:00
parent 174e5a7935
commit 82d61335b0
No known key found for this signature in database
GPG key ID: E28D7679E9A9EDE2
2 changed files with 12 additions and 2 deletions
hc/front/management/commands

View file

@ -22,7 +22,7 @@ class Command(BaseCommand):
try:
from pygments import lexers
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(" pip install Pygments\n\n")
return

View file

@ -2,13 +2,23 @@ import os
from django.conf import settings
from django.core.management.base import BaseCommand
import markdown
class Command(BaseCommand):
help = "Renders Markdown to HTML"
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"]
ec = {"codehilite": {"css_class": "highlight"}}