Browse Source

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

pull/340/head
Pēteris Caune 5 years ago
parent
commit
82d61335b0
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 12 additions and 2 deletions
  1. +1
    -1
      hc/front/management/commands/pygmentize.py
  2. +11
    -1
      hc/front/management/commands/render_docs.py

+ 1
- 1
hc/front/management/commands/pygmentize.py 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


+ 11
- 1
hc/front/management/commands/render_docs.py 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"}}


Loading…
Cancel
Save