Learn R Programming

quarto (version 1.0)

quarto_preview: Quarto Preview

Description

Render and preview a Quarto document. Automatically re-renders the document when the source file changes. Automatically reloads the browser when document resources (e.g. CSS) change.

Usage

quarto_preview(
  file,
  render = TRUE,
  port = "auto",
  host = "127.0.0.1",
  browse = TRUE
)

quarto_preview_stop()

Arguments

file

Quarto document to preview.

render

Automatically re-render the document when it changes.

port

Port to listen on (defaults to 4848)

host

Hostname to bind to (defaults to 127.0.0.1)

browse

Open a browser to preview the content. Defaults to using the RStudio Viewer when running within RStudio.Pass a function (e.g. utils::browseURL to override this behavior).

Details

Pass render = FALSE to prevent re-rendering when the source file changes (note that even when this option is provided the document will be rendered once before previewing).

Examples

Run this code
# NOT RUN {
# Preview a document
quarto_preview("document.qmd")

# Stop any running preview
quarto_preview_stop()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab