<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals


import markdown

from django import template
from django.template.defaultfilters import stringfilter
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe

register = template.Library()


@register.filter(is_safe=True, name='markdown')
@stringfilter
def my_markdown(value):
    extensions = ["nl2br", "extra", "codehilite", "headerid(level=2)", "sane_lists"]

    return mark_safe(markdown.markdown(force_unicode(value),
                                       extensions,
                                       safe_mode=True,
                                       enable_attributes=False))
<commit_msg>Make markdown unsafe and let django make it safe after<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals


import markdown

from django import template
from django.template.defaultfilters import stringfilter
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe

register = template.Library()


@register.filter(is_safe=False, name='markdown')
@stringfilter
def my_markdown(value):
    extensions = ["nl2br", "extra", "codehilite", "headerid(level=2)", "sane_lists"]

    return mark_safe(markdown.markdown(force_unicode(value),
                                       extensions,
                                       safe_mode=False,
                                       enable_attributes=False))

{'fraction_non_alphanumeric': 0.08975217682518419, 'fraction_numerical': 0.004018754186202277, 'mean_word_length': 2.772727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5382008', 'n_tokens_mistral': 403, 'n_tokens_neox': 376, 'n_words': 95}