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

import markdown as markdown_library


register = template.Library()


@register.filter(is_safe=True)
@stringfilter
def markdown(value):
    """<https://www.dominicrodger.com/2013/01/16/django-markdown/>"""
    extensions = ["nl2br", ]

    return mark_safe(
        markdown_library.markdown(
            force_unicode(value),
            extensions,
            safe_mode=True,
            enable_attributes=False
        )
    )<commit_msg>Use "force_text", not "force_unicode".<commit_after>from django import template
from django.template.defaultfilters import stringfilter
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe

import markdown as markdown_library


register = template.Library()


@register.filter(is_safe=True)
@stringfilter
def markdown(value):
    """<https://www.dominicrodger.com/2013/01/16/django-markdown/>"""
    extensions = ["nl2br", ]

    return mark_safe(
        markdown_library.markdown(
            force_text(value),
            extensions,
            safe_mode=True,
            enable_attributes=False
        )
    )
{'fraction_non_alphanumeric': 0.09604957397366383, 'fraction_numerical': 0.013942680092951201, 'mean_word_length': 3.3796610169491523, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5378324', 'n_tokens_mistral': 385, 'n_tokens_neox': 358, 'n_words': 75}