From 338910d52d16c04f50986743dbdb6c7dd14d2a76 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Fri, 29 May 2020 16:00:59 -0400 Subject: [PATCH] Switch from mistune to cmarkgfm (#1414) * Switch from mistune to cmarkgfm * Starts work on #1317 * Update markdown test to be commonmark compliant --- CTFd/utils/__init__.py | 4 ++-- requirements.txt | 2 +- tests/test_views.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CTFd/utils/__init__.py b/CTFd/utils/__init__.py index e3a3e696..6dba72e8 100644 --- a/CTFd/utils/__init__.py +++ b/CTFd/utils/__init__.py @@ -1,4 +1,4 @@ -import mistune +import cmarkgfm import six from flask import current_app as app @@ -13,7 +13,7 @@ else: text_type = str binary_type = bytes -markdown = mistune.Markdown() +markdown = cmarkgfm.github_flavored_markdown_to_html def get_app_config(key, default=None): diff --git a/requirements.txt b/requirements.txt index 0ffc196b..0a935f32 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ requests>=2.20.0 PyMySQL==0.9.3 gunicorn==19.10.0 dataset==1.1.2 -mistune==0.8.4 +cmarkgfm==0.4.2 netaddr==0.7.19 redis==3.3.11 gevent==1.4.0 diff --git a/tests/test_views.py b/tests/test_views.py index dff92e2c..09e4afb9 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -154,7 +154,7 @@ def test_pages_routing_and_rendering(): """Test that pages are routing and rendering""" app = create_ctfd() with app.app_context(): - html = """##The quick brown fox jumped over the lazy dog""" + html = """## The quick brown fox jumped over the lazy dog""" route = "test" title = "Test" gen_page(app.db, title, route, html)