Add code highlighting

This commit is contained in:
Maxime Bloch 2020-08-04 04:27:30 +02:00
parent 47897d4317
commit 7173490dde
3 changed files with 3 additions and 2 deletions

View file

@ -1,4 +1,3 @@
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from markdown import markdown from markdown import markdown
@ -7,5 +6,5 @@ from events import register
@register.filter(name='markdown_to_html', needs_autoescape=False) @register.filter(name='markdown_to_html', needs_autoescape=False)
def markdown_to_html(value): def markdown_to_html(value):
result = markdown(value) result = markdown(value, extensions=['codehilite'])
return mark_safe(result) return mark_safe(result)

View file

@ -12,6 +12,7 @@ idna==2.10
kombu==4.6.11 kombu==4.6.11
markdown==3.2.2 markdown==3.2.2
mysqlclient==2.0.1 mysqlclient==2.0.1
Pygments>=2.3.1
python-crontab==2.5.1 python-crontab==2.5.1
python-dateutil==2.8.1 python-dateutil==2.8.1
pytz==2020.1 pytz==2020.1

View file

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width"/> <meta name="viewport" content="width=device-width"/>
<title>{% block title %}{% endblock %} KeRS</title> <title>{% block title %}{% endblock %} KeRS</title>
<link rel="stylesheet" type="text/css" href="{% static 'main.css' %}"/> <link rel="stylesheet" type="text/css" href="{% static 'main.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'dracula.css' %}"/>
{% block styles %}{% endblock %} {% block styles %}{% endblock %}
</head> </head>
<body> <body>