ui.markdown

ui.markdown(text, *, render_func=None, **kwargs)

Convert a string of markdown to ui.HTML.

Parameters

text : str

A string of text containing markdown.

render_func : Optional[Callable[[str], str]] = None

A function (with at least 1 argument) which accepts a string of markdown and returns a string of HTML. By default, a customized instance of the markdown_id.main.MarkdownIt class (which supports Github-flavored markdown) from the markdown-it package is used.

****kwargs** : object = {}

Additional keyword arguments passed to the render_func.

Returns

: HTML

An HTML string of the rendered markdown.

Examples

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file: app.py
from shiny import App, Inputs, Outputs, Session, ui

ui_app = ui.page_fluid(
    ui.markdown(
        """
        # Hello World

        This is **markdown** and here is some `code`:

        ```python
        print('Hello world!')
        ```
        """
    )
)


def server(input: Inputs, output: Outputs, session: Session):
    pass


app = App(ui_app, server)