lookatme.widgets.codeblock module¶
This module defines an urwid Widget that renders a codeblock
-
class
lookatme.widgets.codeblock.
CodeBlock
(source: str, lang: str = 'text', style_name: str = 'monokai', line_numbers: bool = False, start_line_number: int = 1, hl_lines: Optional[List[range]] = None, default_fg: Optional[str] = None, bg_override: Optional[str] = None)[source]¶ Bases:
urwid.container.Pile
-
class
lookatme.widgets.codeblock.
StyleCache
(default_fg: Optional[str] = None, bg_override: Optional[str] = None)[source]¶ Bases:
object
Caches the highlight styles for loaded pygments syntax highlighting styles.
-
get_style
(style_name: str) → lookatme.widgets.codeblock.SyntaxHlStyle[source]¶ Return the highlight style for the specified pygments style name. If the style name isn’t found, the “text” style will be used instead.
-
-
class
lookatme.widgets.codeblock.
SyntaxHlStyle
(name: str, styles: Dict[str, lookatme.widgets.smart_attr_spec.SmartAttrSpec], pygments_style: pygments.style.StyleMeta, default_fg: str, bg_override: Optional[str] = None)[source]¶ Bases:
object
Stores urwid styles for each token type for a specific pygments syntax highlighting style.