1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
"""
Make mistletoe easier to import.
"""
__version__ = "1.4.0"
__all__ = ['html_renderer', 'ast_renderer', 'block_token', 'block_tokenizer',
'span_token', 'span_tokenizer']
from mistletoe.block_token import Document
from mistletoe.html_renderer import HtmlRenderer
# import the old name for backwards compatibility:
from mistletoe.html_renderer import HTMLRenderer # noqa: F401
def markdown(iterable, renderer=HtmlRenderer):
"""
Converts markdown input to the output supported by the given renderer.
If no renderer is supplied, ``HtmlRenderer`` is used.
Note that extra token types supported by the given renderer
are automatically (and temporarily) added to the parsing process.
"""
with renderer() as renderer:
return renderer.render(Document(iterable))
|