From d1662303956dedde92bc0f94163b5d36fe32d0d9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 28 2016 07:12:18 +0000 Subject: When rendering markdown file use the same code path as when rendering comments This allows the same features, extensions as well as security measures. --- diff --git a/pagure/doc_utils.py b/pagure/doc_utils.py index 8eaa0d1..6ea748f 100644 --- a/pagure/doc_utils.py +++ b/pagure/doc_utils.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ - (c) 2014 - Copyright Red Hat Inc + (c) 2014-2016 - Copyright Red Hat Inc Authors: Ralph Bean @@ -16,6 +16,8 @@ import markupsafe import markdown import textwrap +import pagure.lib + def modify_rst(rst, view_file_url=None): """ Downgrade some of our rst directives if docutils is too old. """ @@ -99,7 +101,7 @@ def convert_readme(content, ext, view_file_url=None): safe = True output = convert_doc(content.decode('utf-8'), view_file_url) elif ext and ext in ['.mk', '.md', '.markdown']: - output = markdown.markdown(content.decode('utf-8')) + output = pagure.lib.text2markdown(content.decode('utf-8')) safe = True elif not ext or (ext and ext in ['.text', '.txt']): safe = True