diff --git a/rhodecode/lib/bleach_whitelist.py b/rhodecode/lib/bleach_whitelist.py --- a/rhodecode/lib/bleach_whitelist.py +++ b/rhodecode/lib/bleach_whitelist.py @@ -60,6 +60,7 @@ markdown_tags = [ "table", "thead", "tbody", "tfoot", "tr", "th", "td", "img", "a", + "input", ] markdown_attrs = { @@ -68,7 +69,8 @@ markdown_attrs = { "a": ["href", "alt", "title", "name"], "abbr": ["title"], "acronym": ["title"], - "pre": ["lang"] + "pre": ["lang"], + "input": ["type", "disabled"] } standard_styles = [ diff --git a/rhodecode/lib/markdown_ext.py b/rhodecode/lib/markdown_ext.py --- a/rhodecode/lib/markdown_ext.py +++ b/rhodecode/lib/markdown_ext.py @@ -22,36 +22,7 @@ import re import markdown -from mdx_gfm import GithubFlavoredMarkdownExtension # noqa - - -class FlavoredCheckboxExtension(markdown.Extension): - - def extendMarkdown(self, md, md_globals): - md.preprocessors.add('checklist', - FlavoredCheckboxPreprocessor(md), 'unescape') - - -class FlavoredCheckboxPreprocessor(markdown.preprocessors.Preprocessor): - """ - Replaces occurrences of [ ] or [x] to checkbox input - """ - - pattern = re.compile(r'^([*-]) \[([ x])\]') - - def run(self, lines): - return [self._transform_line(line) for line in lines] - - def _transform_line(self, line): - return self.pattern.sub(self._replacer, line) - - def _replacer(self, match): - list_prefix, state = match.groups() - checked = '' if state == ' ' else ' checked="checked"' - return '%s ' % (list_prefix, - checked) +from mdx_gfm import GithubFlavoredMarkdownExtension # pragma: no cover class FlavoredCheckboxPostprocessor(markdown.postprocessors.Postprocessor):