Markdown
Renders markdown text
@solara.component
def Markdown(md_text: str, unsafe_solara_execute=False, style: Union[str, Dict, None] = None):
...
Renders markdown using https://python-markdown.github.io/
Math rendering is done using Latex syntax, using https://katex.org/.
Examples
Basic
import solara
@solara.component
def Page():
return solara.Markdown(r'''
# This is a title
## This is a subtitle
This is a markdown text, **bold** and *italic* text is supported.
## Math
Also, $x^2$ is rendered as math.
Or multiline math:
$$
\int_0^1 x^2 dx = \frac{1}{3}
$$
''')
This is a title
This is a subtitle
This is a markdown text, bold and italic text is supported.
Math
Also, x2 is rendered as math.
Or multiline math:
∫01x2dx=31
Live output
Arguments
md_text
: The markdown text to render unsafe_solara_execute
: If True, code marked with language "solara" will be executed. This is potentially unsafe
if the markdown text can come from user input and should only be used for trusted markdown. style
: A string or dict of css styles to apply to the rendered markdown.