text function allows you to display formatted text or Markdown in your application. It’s perfect for creating titles, headers, paragraphs, and more using the power of Markdown syntax. It also allows you to display mathematical functions with latex syntax (via katex).
Parameters
markdown_str(str): The string containing text or Markdown to be rendered.size(float): (Optional) The width of the component in a row. Defaults to1.0(full row). See the Layout Guide for details.
Returns
strcontaining the inputmarkdown_str.
Usage Example
Here’s an example of how to use thetext function:
Markdown Support
Thetext function supports the full range of Markdown syntax, including:
-
Headers:
#for H1,##for H2, and so on. -
Emphasis:
*italic*,**bold**,~~strikethrough~~. -
Lists:
- Unordered:
- Item 1,- Item 2 - Ordered:
1. Item 1,2. Item 2
- Unordered:
-
Links:
[Link text](https://example.com) -
Code blocks:
-
LaTeX:
- Display an inline equation:
text("$E=mc^2$") - Display a block equation:
text("\n\n$$\\int_0^1 x^2 \\, dx = \\frac{1}{3}$$")
- Display an inline equation:
- And more!