<commit_before>from django import template

register = template.Library()


def is_in_group(user, group_name):
    """
    Check if a user in a group named ``group_name``.

    :param user User:
        The auth.User object
    :param group_name str:
        The name of the group
    :returns: bool
    """
    return user.groups.filter(name__exact=group_name).exists()


register.filter('is_in_group', is_in_group)<commit_msg>added template tag to convert markdown in a string<commit_after>from django import template
from django.utils.safestring import mark_safe
from markdown import markdown

register = template.Library()


def is_in_group(user, group_name):
    """
    Check if a user in a group named ``group_name``.

    :param user User:
        The auth.User object
    :param group_name str:
        The name of the group
    :returns: bool
    """
    return user.groups.filter(name__exact=group_name).exists()


def handle_markdown(value):
    md = markdown(
        value,
        [
            'markdown.extensions.fenced_code',
            'codehilite',
        ]
    )
    return mark_safe(md)

register.filter('is_in_group', is_in_group)
register.filter('handle_markdown', handle_markdown)
{'fraction_non_alphanumeric': 0.0935430463576159, 'fraction_numerical': 0.0, 'mean_word_length': 3.1404109589041096, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7571995', 'n_tokens_mistral': 374, 'n_tokens_neox': 361, 'n_words': 102}