markdown: enable full githubFlavoredMarkdown
This commit is contained in:
parent
dfdd76ca07
commit
42ba785d95
2 changed files with 6 additions and 6 deletions
|
|
@ -22,6 +22,8 @@ import re
|
|||
|
||||
import markdown
|
||||
|
||||
from mdx_gfm import GithubFlavoredMarkdownExtension # noqa
|
||||
|
||||
|
||||
class FlavoredCheckboxExtension(markdown.Extension):
|
||||
|
||||
|
|
@ -65,8 +67,6 @@ class FlavoredCheckboxPostprocessor(markdown.postprocessors.Postprocessor):
|
|||
return html.replace(before, after)
|
||||
|
||||
|
||||
|
||||
|
||||
# Global Vars
|
||||
URLIZE_RE = '(%s)' % '|'.join([
|
||||
r'<(?:f|ht)tps?://[^>]*>',
|
||||
|
|
@ -75,6 +75,7 @@ URLIZE_RE = '(%s)' % '|'.join([
|
|||
r'[^(<\s]+\.(?:com|net|org)\b',
|
||||
])
|
||||
|
||||
|
||||
class UrlizePattern(markdown.inlinepatterns.Pattern):
|
||||
""" Return a link Element given an autolink (`http://example/com`). """
|
||||
def handleMatch(self, m):
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ from docutils.core import publish_parts
|
|||
from docutils.parsers.rst import directives
|
||||
import markdown
|
||||
|
||||
from rhodecode.lib.markdown_ext import FlavoredCheckboxExtension, UrlizeExtension
|
||||
from rhodecode.lib.markdown_ext import (
|
||||
UrlizeExtension, GithubFlavoredMarkdownExtension)
|
||||
from rhodecode.lib.utils2 import safe_unicode, md5_safe, MENTIONS_REGEX
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -147,9 +148,7 @@ class MarkupRenderer(object):
|
|||
# the safe_mode=True parameter of the markdown method.
|
||||
extensions = ['codehilite', 'extra', 'def_list', 'sane_lists']
|
||||
if flavored:
|
||||
extensions.append('nl2br')
|
||||
extensions.append(FlavoredCheckboxExtension())
|
||||
extensions.append(UrlizeExtension())
|
||||
extensions.append(GithubFlavoredMarkdownExtension())
|
||||
|
||||
if mentions:
|
||||
mention_pat = re.compile(MENTIONS_REGEX)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue