Spaces:
Running
Running
File size: 632 Bytes
8886757 3d048a0 8886757 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import mesop as me
from web_components import markedjs_component
from web_components import copy_to_clipboard_component
@me.component
def markdown(text: str, has_copy_to_clipboard: bool = False):
with me.box(style=me.Style(position="relative")):
if has_copy_to_clipboard:
with me.box(style=me.Style(position="absolute", right=0)):
with copy_to_clipboard_component(text=text):
with me.content_button(
type="icon",
style=me.Style(cursor="pointer", background=me.theme_var("surface-container-low")),
):
me.icon("content_copy")
markedjs_component(text)
|