Open kingclowndean opened 4 years ago
I'm planning to address this in the next major version.
For now you have to re-implement the paragraph rendering method yourself. See code below for an example.
import misaka as m import re import houdini as h
class CustomHTMLRenderer(m.HtmlRenderer): def paragraph(self, content): _prefix_re = re.compile(r'^\s*(!{1,4})\s+')
CLASSES = { 1: 'note', 2: 'info', 3: 'tip', 4: 'warning', } match = _prefix_re.match(content) if match is None: return '<p>' + content + '</p>\n' else: length = len(match.group(1)) value = CLASSES[length] return '<p class="' + value + '">' + content[length+1:] + '</p>\n'
if name == 'main': rndr = CustomHTMLRenderer(flags=('escape',)) md = m.Markdown(rndr) print(md(""" some text
!!!! some more text """))
I'm planning to address this in the next major version.
For now you have to re-implement the paragraph rendering method yourself. See code below for an example.
import misaka as m import re import houdini as h
class CustomHTMLRenderer(m.HtmlRenderer): def paragraph(self, content): _prefix_re = re.compile(r'^\s*(!{1,4})\s+')
if name == 'main': rndr = CustomHTMLRenderer(flags=('escape',)) md = m.Markdown(rndr) print(md(""" some text
!!!! some more text """))