From 7173490ddef37db944ea8909a6dd1b10e133d506 Mon Sep 17 00:00:00 2001 From: Maxime Bloch Date: Tue, 4 Aug 2020 04:27:30 +0200 Subject: [PATCH] Add code highlighting --- events/templatetags/events_extras.py | 3 +-- requirements.txt | 1 + templates/base.html | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/events/templatetags/events_extras.py b/events/templatetags/events_extras.py index 969723c..abfae11 100644 --- a/events/templatetags/events_extras.py +++ b/events/templatetags/events_extras.py @@ -1,4 +1,3 @@ -from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from markdown import markdown @@ -7,5 +6,5 @@ from events import register @register.filter(name='markdown_to_html', needs_autoescape=False) def markdown_to_html(value): - result = markdown(value) + result = markdown(value, extensions=['codehilite']) return mark_safe(result) diff --git a/requirements.txt b/requirements.txt index 5c8998a..b2455cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ idna==2.10 kombu==4.6.11 markdown==3.2.2 mysqlclient==2.0.1 +Pygments>=2.3.1 python-crontab==2.5.1 python-dateutil==2.8.1 pytz==2020.1 diff --git a/templates/base.html b/templates/base.html index 86a3c95..798cd50 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,6 +6,7 @@ {% block title %}{% endblock %} – KeRS + {% block styles %}{% endblock %}