How to use the lookatme.render.pygments.render_text function in lookatme

To help you get started, we’ve selected a few lookatme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github d0c-s4vage / lookatme / lookatme / render / markdown_inline.py View on Github external
def codespan(text, old_styles):
    res = pygments_render.render_text(" " + text + " ", plain=True)
    return res
github d0c-s4vage / lookatme / lookatme / render / markdown_block.py View on Github external
def render_code(token, body, stack, loop):
    """Renders a code block using the Pygments library.

    See :any:`lookatme.tui.SlideRenderer.do_render` for additional argument and
    return value descriptions.
    """
    lang = token.get("lang", "text") or "text"
    text = token["text"]
    res = pygments_render.render_text(text, lang=lang)

    return [
        urwid.Divider(),
        res,
        urwid.Divider(),
    ]