About tile#
Overview#
TileAbout
is a widget to display markdown flavored file to describe the module. it inherits from the Tile
class. To use it create a file containing some mkd content and use it as a first argument of the tile. The content will be display as in GitHub.
In the following example we create a fake file on the fly and use it to display some text in a AboutTile
.
from sepal_ui import sepalwidgets as sw
from pathlib import Path
# correct colors for the documentation
# set to dark in SEPAL by default
import ipyvuetify as v
v.theme.dark = False
# create the widget
tmp_file = Path.home()/'tmp'/'tmp_mkd.md'
tmp_file.write_text('## It is a first section \n')
tmp_file.write_text(' Lorem ipsum')
about_tile = sw.TileAbout(tmp_file)
about_tile
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[1], line 12
9 # create the widget
10 tmp_file = Path.home()/'tmp'/'tmp_mkd.md'
---> 12 tmp_file.write_text('## It is a first section \n')
13 tmp_file.write_text(' Lorem ipsum')
15 about_tile = sw.TileAbout(tmp_file)
File ~/.asdf/installs/python/3.10.13/lib/python3.10/pathlib.py:1154, in Path.write_text(self, data, encoding, errors, newline)
1151 raise TypeError('data must be str, not %s' %
1152 data.__class__.__name__)
1153 encoding = io.text_encoding(encoding)
-> 1154 with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
1155 return f.write(data)
File ~/.asdf/installs/python/3.10.13/lib/python3.10/pathlib.py:1119, in Path.open(self, mode, buffering, encoding, errors, newline)
1117 if "b" not in mode:
1118 encoding = io.text_encoding(encoding)
-> 1119 return self._accessor.open(self, mode, buffering, encoding, errors,
1120 newline)
FileNotFoundError: [Errno 2] No such file or directory: '/home/docs/tmp/tmp_mkd.md'
Tip
The file should be starting with a level 2 header (##) as the title of the tile (“About”) is already using the level 1
Note
More information can be found here.