Markdown
Renders markdown text
@solara.component
def Markdown(md_text: str, unsafe_solara_execute=False, style: Union[str, Dict, None] = None, md_parser: Optional["markdown.Markdown"] = 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 renderunsafe_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.md_parser
: A markdown object to use for rendering. If not provided, a markdown object will be created.
Example
Input text
Renders like
Large
Smaller
List items
* item 1
* item 2
Code highlight support
code = "formatted" and "supports highlighting"
Mermaid support!
See Mermaid docs