diff --git a/comment/conf/defaults.py b/comment/conf/defaults.py index 1482d66..49ce476 100644 --- a/comment/conf/defaults.py +++ b/comment/conf/defaults.py @@ -39,3 +39,7 @@ COMMENT_ALLOW_BLOCKING_USERS = False COMMENT_ALLOW_MODERATOR_TO_BLOCK = False COMMENT_RESPONSE_FOR_BLOCKED_USER = 'You cannot perform this action at the moment! Contact the admin for more details' + +COMMENT_ALLOW_MARKDOWN = False +COMMENT_MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code'] +COMMENT_MARKDOWN_EXTENSION_CONFIG = {} diff --git a/comment/context.py b/comment/context.py index 7bd04dc..f231522 100644 --- a/comment/context.py +++ b/comment/context.py @@ -56,5 +56,6 @@ def __call__(self): 'is_translation_allowed': settings.COMMENT_ALLOW_TRANSLATION, 'is_subscription_allowed': settings.COMMENT_ALLOW_SUBSCRIPTION, 'is_blocking_allowed': settings.COMMENT_ALLOW_BLOCKING_USERS, - 'oauth': self.is_oauth() + 'oauth': self.is_oauth(), + 'render_markdown': settings.COMMENT_ALLOW_MARKDOWN, } diff --git a/comment/templates/comment/comments/comment_content.html b/comment/templates/comment/comments/comment_content.html index e2287cf..66b4cda 100644 --- a/comment/templates/comment/comments/comment_content.html +++ b/comment/templates/comment/comments/comment_content.html @@ -3,7 +3,11 @@
{% block comment_content %} - {% render_content comment %} + {% if render_markdown %} + {% render_content comment markdown=True %} + {% else %} + {% render_content comment markdown=False %} + {% endif %} {% endblock comment_content %} {% get_username_for_comment comment as username %}