Skip to content

Markdown viewer

MarkdownViewer

Bases: VerticalScroll

A Markdown viewer widget.

document: Markdown property

The Markdown document object.

table_of_contents: MarkdownTableOfContents property

The Table of Contents widget

__init__(markdown=None, *, show_table_of_contents=True, name=None, id=None, classes=None, parser_factory=None)

Create a Markdown Viewer object.

Parameters:

Name Type Description Default
markdown str | None

String containing Markdown, or None to leave blank. Defaults to None.

None
show_table_of_contents bool

Show a Table of COntents in a sidebar. Defaults to True.

True
name str | None

The name of the widget.

None
id str | None

The ID of the widget in the DOM.

None
classes str | None

The CSS classes of the widget.

None
parser_factory Callable[[], MarkdownIt] | None

A factory function to return a configured MarkdownIt instance. If None, a "gfm-like" parser is used.

None

back() async

Go back one level in the history.

forward() async

Go forward one level in the history.

go(location) async

Navigate to a new document path.