Markdown

Introduction

The Markdown widget allows you to easily add and style your text using Markdown syntax. By using Markdown, you can add headings, lists, links, images, and more to enhance the presentation of your text content.

Function signature

Markdown(
    content="",
    height=300,
    widget_id=None,
)
Markdown preview

Parameters

Parameters
Type
Description

content

str

Markdown content text

height

Union[int, Literal["fit-content"]]

Widget height

show_border

bool

Display border around Markdown content

widget_id

str

ID of the widget

content

Determine input Markdown content.

type: str

default value: ""

content

height

Determine Widget height.

type: int

default value: 300

show_border

Determine Widget height.

type: bool

default value: True

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

set_content(content: str)

Set Markdown data.

get_content()

Return Markdown data.

get_height()

Return Markdown height.

set_height(height: int)

Set Markdown height.

Mini App Example

You can find this example in our Github repository:

supervisely-ecosystem/ui-widgets-demos/text-elements/005_markdown/src/main.py

Import libraries

Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

Initialize Button widgets, we will use

Initialize Markdown widget

Create app layout

Prepare a layout for the app using Card widget with the content parameter and place widget that we've just created in the Container widget.

Create app using layout

Create an app object with the layout parameter.

Handle button clicks

layout

Last updated

Was this helpful?