shiny.ui.markdown#

shiny.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]]) – 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 MarkdownIt class (which supports Github-flavored markdown) from the markdown-it package is used.

  • **kwargs – Additional keyword arguments passed to the render_func.

Return type

An ui.HTML() string of the rendered markdown.

Note

Use ui.include_markdown() instead if you want to include local images (or other files) in the markdown.

See also

ui.include_markdown()

Example

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
from shiny import *

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)