##// END OF EJS Templates
markdown: enable full githubFlavoredMarkdown
marcink -
r317:2f438a3b default
parent child Browse files
Show More
@@ -22,6 +22,8 b' import re'
22
22
23 import markdown
23 import markdown
24
24
25 from mdx_gfm import GithubFlavoredMarkdownExtension # noqa
26
25
27
26 class FlavoredCheckboxExtension(markdown.Extension):
28 class FlavoredCheckboxExtension(markdown.Extension):
27
29
@@ -65,8 +67,6 b' class FlavoredCheckboxPostprocessor(mark'
65 return html.replace(before, after)
67 return html.replace(before, after)
66
68
67
69
68
69
70 # Global Vars
70 # Global Vars
71 URLIZE_RE = '(%s)' % '|'.join([
71 URLIZE_RE = '(%s)' % '|'.join([
72 r'<(?:f|ht)tps?://[^>]*>',
72 r'<(?:f|ht)tps?://[^>]*>',
@@ -75,6 +75,7 b" URLIZE_RE = '(%s)' % '|'.join(["
75 r'[^(<\s]+\.(?:com|net|org)\b',
75 r'[^(<\s]+\.(?:com|net|org)\b',
76 ])
76 ])
77
77
78
78 class UrlizePattern(markdown.inlinepatterns.Pattern):
79 class UrlizePattern(markdown.inlinepatterns.Pattern):
79 """ Return a link Element given an autolink (`http://example/com`). """
80 """ Return a link Element given an autolink (`http://example/com`). """
80 def handleMatch(self, m):
81 def handleMatch(self, m):
@@ -33,7 +33,8 b' from docutils.core import publish_parts'
33 from docutils.parsers.rst import directives
33 from docutils.parsers.rst import directives
34 import markdown
34 import markdown
35
35
36 from rhodecode.lib.markdown_ext import FlavoredCheckboxExtension, UrlizeExtension
36 from rhodecode.lib.markdown_ext import (
37 UrlizeExtension, GithubFlavoredMarkdownExtension)
37 from rhodecode.lib.utils2 import safe_unicode, md5_safe, MENTIONS_REGEX
38 from rhodecode.lib.utils2 import safe_unicode, md5_safe, MENTIONS_REGEX
38
39
39 log = logging.getLogger(__name__)
40 log = logging.getLogger(__name__)
@@ -147,9 +148,7 b' class MarkupRenderer(object):'
147 # the safe_mode=True parameter of the markdown method.
148 # the safe_mode=True parameter of the markdown method.
148 extensions = ['codehilite', 'extra', 'def_list', 'sane_lists']
149 extensions = ['codehilite', 'extra', 'def_list', 'sane_lists']
149 if flavored:
150 if flavored:
150 extensions.append('nl2br')
151 extensions.append(GithubFlavoredMarkdownExtension())
151 extensions.append(FlavoredCheckboxExtension())
152 extensions.append(UrlizeExtension())
153
152
154 if mentions:
153 if mentions:
155 mention_pat = re.compile(MENTIONS_REGEX)
154 mention_pat = re.compile(MENTIONS_REGEX)
General Comments 0
You need to be logged in to leave comments. Login now