comparison sat/plugins/plugin_misc_text_syntaxes.py @ 2878:a02ad4bc0a6d

plugin text syntaxes: activated useful markdown extensions: - code can now be highlighted, fenced code block can be used. - new lines are converted to hard breaks - sane lists are used - tables are available
author Goffi <goffi@goffi.org>
date Mon, 25 Mar 2019 18:40:12 +0100
parents e1207b8ad97c
children ab2696e34d29
comparison
equal deleted inserted replaced
2877:f8427bf8c072 2878:a02ad4bc0a6d
213 h.body_width = 0 # do not truncate the lines, it breaks the long URLs 213 h.body_width = 0 # do not truncate the lines, it breaks the long URLs
214 return h.handle(html) 214 return h.handle(html)
215 215
216 self.addSyntax( 216 self.addSyntax(
217 self.SYNTAX_MARKDOWN, 217 self.SYNTAX_MARKDOWN,
218 partial(markdown.markdown, extensions=[EscapeHTML()]), 218 partial(markdown.markdown,
219 extensions=[
220 EscapeHTML(),
221 u'nl2br',
222 u'codehilite',
223 u'fenced_code',
224 u'sane_lists',
225 u'tables',
226 ],
227 extension_configs = {
228 u"codehilite": {
229 u"css_class": "highlight",
230 }
231 }),
219 _html2text, 232 _html2text,
220 [TextSyntaxes.OPT_DEFAULT], 233 [TextSyntaxes.OPT_DEFAULT],
221 ) 234 )
222 except ImportError: 235 except ImportError:
223 log.warning(u"markdown or html2text not found, can't use Markdown syntax") 236 log.warning(u"markdown or html2text not found, can't use Markdown syntax")