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: #329
This commit is contained in:
parent
174e5a7935
commit
82d61335b0
2 changed files with 12 additions and 2 deletions
hc/front/management/commands
|
@ -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
|
||||
|
|
|
@ -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"}}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue