Merge branch 'support_markdown_notes' into 'master'

Support markdown notes

See merge request bestuur/kers!11
This commit is contained in:
flynn 2020-08-04 14:18:15 +02:00
commit 030fff8b06
6 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,3 @@
from django import template
register = template.Library()

View file

@ -1,5 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load events_extras %}
{% block title %}Events{% endblock %} {% block title %}Events{% endblock %}
{% block content %} {% block content %}
@ -18,7 +20,7 @@
<p>Verantwoordelijke: {{ x.event.responsible_person.username }}</p> <p>Verantwoordelijke: {{ x.event.responsible_person.username }}</p>
{% if x.event.note %} {% if x.event.note %}
<p>Beschrijving: {{ x.event.note }}</p> <p>Beschrijving: {{ x.event.note|markdown_to_html }}</p>
{% endif %} {% endif %}
<ul> <ul>

View file

View file

@ -0,0 +1,10 @@
from django.utils.safestring import mark_safe
from markdown import markdown
from events import register
@register.filter(name='markdown_to_html', needs_autoescape=False)
def markdown_to_html(value):
result = markdown(value, extensions=['codehilite'])
return mark_safe(result)

View file

@ -10,7 +10,9 @@ django-timezone-field==4.0
future==0.18.2 future==0.18.2
idna==2.10 idna==2.10
kombu==4.6.11 kombu==4.6.11
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>