compose.block_text

compose.block_text(text, align='left')

Create a block of text (supports Markdown).

Parameters

text : str

Plain text or Markdown. Markdown will be converted to HTML.

align : Literal['left', 'center', 'right', 'justify'] = 'left'

Text alignment. Default is "left".

Returns

: Block

A block containing the formatted text.

Examples

from nbmail.compose import block_text

# Simple text
block = block_text("Hello world")

print(1+1)

# Markdown text
block = block_text("This is **bold** and this is *italic*")

# Centered text
block = block_text("Centered content", align="center")
2