Markdown#

Overview#

Markdown is a widget to display markdown flavored strings. it inherits from the SepalWidget class.

from sepal_ui import sepalwidgets as sw

# correct colors for the documentation
# set to dark in SEPAL by default
import ipyvuetify as v
v.theme.dark = False

str_ = """
**I am a title**
I am some regular text
"""

mkd = sw.Markdown(str_)
mkd

Warning

  • No tabulation must be applied in the multi-line str.

  • Don’t forget to escape the “`” character, it will be interpreted as code mark

Include multi-line markdown in the translation tool#

If you want to use the translation tool AND create multi-line markdown text you should consider the following method

in en.json use a list in your key with each element of the list corresponding to a line:

{
    "_comment": "component/message/en.json",
    "multiline_key": [
        "this is",
        " a multiline",
        "key"
    ]
}

Then In your notebook you can call the key in a markdown widget and display it as multi-line text:

from sepal_ui import sepalwidgets as sw

# correct colors for the documentation
# set to dark in SEPAL by default
import ipyvuetify as v
v.theme.dark = False

multiline_key = [
    "this is",
    " a multiline",
    "key"
]

mkd = sw.Markdown('  \n'.join(multiline_key))
mkd

Tip

line break in markdown need to be set with 2 blank space to be interpreted.

Note

More information can be found here.