Commits

Owen Nelson  committed 6f65394

refs #3 adds management command to output pygments css

  • Participants
  • Parent commits 12670f8

Comments (0)

Files changed (3)

File mdown/management/__init__.py

Empty file added.

File mdown/management/commands/__init__.py

Empty file added.

File mdown/management/commands/pygments_styles.py

+from django.core.management.base import BaseCommand, CommandError
+
+from pygments.styles import get_all_styles
+from pygments.formatters import HtmlFormatter
+
+class Command(BaseCommand):
+
+    def handle(self, scheme=None, **options):
+        if not scheme:
+            print """
+Usage: ./manage.py pygments_styles <scheme_name>
+Available color schemes:
+""" + '\n'.join(["  %s" % name for name in get_all_styles()])
+        else:
+            assert(scheme in list(get_all_styles()))
+            print HtmlFormatter(style=scheme).get_style_defs('.codehilite')