Skip to content

Markdown

Added in version 0.11.0

A widget to display a Markdown document.

  • Focusable
  • Container

Tip

See MarkdownViewer for a widget that adds additional features such as a Table of Contents.

Example

The following example displays Markdown from a string.

MarkdownExampleApp Markdown • Typography emphasisstronginline code etc. • Headers • Lists • Syntax highlighted code blocks • Tables and more ▂▂ Quotes I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past, I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.

from textual.app import App, ComposeResult
from textual.widgets import Markdown

EXAMPLE_MARKDOWN = """\
## Markdown

- Typography *emphasis*, **strong**, `inline code` etc.    
- Headers    
- Lists    
- Syntax highlighted code blocks
- Tables and more

## Quotes