Text Widgets#

class CodeWidget(code: Optional[str] = None, language: Optional[str] = None, line_numbers: bool = False, **kwargs)[source]#

Bases: Block

A widget to display code with syntax highlighting if a language is supplied.

Keyword Arguments:
  • code – the code to be displayed

  • language – the language of the code

  • line_numbers – if True, show line numbers

block: str = 'wildewidgets_highlight_container'#

block is the official wildewidgets name of the block; it can’t be changed by constructor kwargs

code: str = ''#

The code to be displayed

language: Optional[str] = None#

The programming language for the code

line_numbers: bool = False#

If True, show line numbers

class HTMLWidget(*args, **kwargs)[source]#

Bases: TemplateWidget

A widget to display raw HTML.

Parameters:
  • html (str) – the HTML to render.

  • css_class (str, optional) – any classes to add to the widget

template_name: Optional[str] = 'wildewidgets/html_widget.html'#

The name of the template to use to render this widget

class MarkdownWidget(*args, **kwargs)[source]#

Bases: TemplateWidget

A widget to display markdown as HTML.

Parameters:
  • text (str) – the markdown to render as HTML.

  • css_class (str, optional) – any classes to add to the widget

template_name: Optional[str] = 'wildewidgets/markdown_widget.html'#

The name of the template to use to render this widget

class StringBlock(text: str, **kwargs)[source]#

Bases: Block

A basic widget that displays a string.

Deprecated since version 0.14.0: Use wildewidgets.widgets.base.Block directly instead. It works exactly like StringBlock

Parameters:

text – the text to display.

blocks: List[Union[str, Widget]]#

The internal list of blocks that are this block’s content

class TagBlock(text: str, color: str = 'secondary', **kwargs)[source]#

Bases: Block

A basic widget that displays a colored tag.

Parameters:
  • text – the text to display.

  • color – the bootstrap color class.

block: str = 'badge'#

block is the official wildewidgets name of the block; it can’t be changed by constructor kwargs

class TimeStamp(*blocks, tag: Optional[str] = None, name: Optional[str] = None, modifier: Optional[str] = None, css_class: Optional[str] = None, css_id: Optional[str] = None, empty: Optional[bool] = None, script: Optional[str] = None, attributes: Optional[Dict[str, str]] = None, data_attributes: Optional[Dict[str, str]] = None, aria_attributes: Optional[Dict[str, str]] = None)[source]#

Bases: Block

A basic widget that displays a timestamp.

Parameters:

text – the text to display.

blocks: List[Union[str, Widget]]#

The internal list of blocks that are this block’s content

css_class: str = 'fw-light'#

A string of CSS classes to apply to this block

tag: str = 'small'#

The name of the HTML element to use as our tag, e.g. div