Markdown#
Overview#
Markdown is a widget to display markdown flavored strings. it inherits from the SepalWidget class.
from pysepal 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
/home/docs/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.10/site-packages/google/api_core/_python_version_support.py:273: FutureWarning: You are using a Python version (3.10.19) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.api_core past that date. warnings.warn(message, FutureWarning)
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 pysepal 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.