markdown_view: Markdown view

View source: R/markdown.R

markdown_viewR Documentation

Markdown view

Description

Shows Markdown text: headings, paragraphs, bold, italic, ~~strikethrough~~, ⁠inline code⁠, fenced code blocks, bullet and numbered lists, block quotes, horizontal rules, simple pipe tables and links. It is meant for help screens, release notes and dialogs; there is no HTML and the parser is not CommonMark-complete. Text is wrapped to the width of the view.

Usage

markdown_view(text, id = NULL, classes = NULL, style = NULL, scroll = TRUE)

Arguments

text

Markdown source (a character vector is joined with newlines).

id

Optional identifier.

classes

Optional classes.

style

A style().

scroll

Wrap the view in a scrollable container?

Details

With scroll = TRUE (the default) the view is placed in a scroll_view() that fills its parent; use scroll = FALSE for short text inside your own layout.

Value

A scroll_view() containing a MarkdownView (or the MarkdownView itself with scroll = FALSE). Change the text with ⁠$set_markdown()⁠; the MarkdownView is the first child of the scroll view.

Examples

md <- markdown_view("# Title\n\nSome *emphasis* and `code`.\n\n- one\n- two",
                    scroll = FALSE)
render_widget(md, 40, 8)$to_text()

termr documentation built on Oct. 21, 2026, 5:13 p.m.