Do not allow custom HTML in Markdown.

This commit is contained in:
Martin Mahner 2018-04-05 21:22:47 +02:00
parent 76e8ddf3ea
commit 46fbe577c5

View file

@ -67,13 +67,15 @@ class PlainTextHighlighter(Highlighter):
class MarkdownHighlighter(PlainTextHighlighter): class MarkdownHighlighter(PlainTextHighlighter):
"""Markdown""" """Markdown"""
def highlight(self, code_string, lexer_name=None):
import misaka
extensions = ('tables', 'fenced-code', 'footnotes', 'autolink,', extensions = ('tables', 'fenced-code', 'footnotes', 'autolink,',
'strikethrough', 'underline', 'quote', 'superscript', 'strikethrough', 'underline', 'quote', 'superscript',
'math') 'math')
return mark_safe(misaka.html(code_string, extensions=extensions)) render_flags = ('skip-html',)
def highlight(self, code_string, lexer_name=None):
import misaka
return mark_safe(misaka.html(code_string, extensions=self.extensions,
render_flags=self.render_flags))
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------