{% extends "base_wide_page.html" %}
{% load i18n %}

{% block wide_page_content %}
<h1>{{ form.initial.terms.name|safe }}</h1>
<div id="tc-content" class="article"></div>
<form action="{% url 'tc_accept_page' %}" method="post" class="tc-accept-form">{% csrf_token %}
    {{ form.terms }}
    {{ form.returnTo }}
    <button type="submit" class="submit">{% trans "Accept" %}</button>
    <a href="{% url 'auth_logout' %}" class="sf-btn-link">{% trans "Cancel" %}</a>
</form>
{% endblock %}

{% block extra_script %}
<script type="text/javascript" src="{{MEDIA_URL}}js/editormd/lib/marked.min.js"></script>
<script type="text/javascript">
var renderer = new marked.Renderer();
// remove 'id' attribute for headings
renderer.heading = function (text, level) {
    return '<h' + level + '>' + text + '</h' + level + '>';
};
marked.setOptions({
    renderer: renderer,
    breaks: true, // keep linebreak
    smartLists: true,
    sanitize: true // Ignore any HTML that has been input
});

$('#tc-content').html(marked("{{ form.initial.terms.text|escapejs }}"));
</script>
{% endblock %}
