Visual R Markdown

Overview

RStudio v1.4 includes a new visual markdown editing mode. Highlights of visual mode include:

  • Visual editing for all of Pandoc markdown, including tables, divs/spans, definition lists, attributes, etc.

  • Extensive support for citations, including integration with Zotero and the ability to insert citations from DOIs or searches of PubMed, Crossref, and DataCite.

  • Scientific and technical writing features, including cross-references, footnotes, equations, code execution, and embedded LaTeX.

  • Writing productivity features, including real time spell-checking and outline navigation.

  • Tight integration with source editing (editing location and undo/redo state are preserved when switching between modes).

  • Rich keyboard support. In addition to traditional shortcuts, you can use markdown expressions (e.g. ##, **bold**, etc.) for formatting. If you don’t remember all of the keyboard shortcuts, you can also use the catch-all ⌘ / shortcut to insert anything.

Getting Started

Visual markdown editing is available in RStudio v1.4 or higher. You can download the latest version of RStudio here: https://rstudio.com/products/rstudio/download/.

Markdown documents can be edited in either source or visual mode. To switch into visual mode for a given document, use the button at the top-right of the document toolbar (or alternatively the ⌘⇧ F4 keyboard shortcut):

Note that you can switch between source and visual mode at any time (editing location and undo/redo state will be preserved when you switch).

Using the Editor

Keyboard Shortcuts

There are keyboard shortcuts for all basic editing tasks. Visual mode supports both traditional keyboard shortcuts (e.g. ⌘ B for bold) as well as markdown shortcuts (using markdown syntax directly). For example, enclose **bold** text in asterisks or type ## and press space to create a second level heading. Here are some of the most commonly used shortcuts:

Command Keyboard Shortcut Markdown Shortcut
Bold ⌘ B **bold**
Italic ⌘ I *italic*
Code ⌘ D `code`
Link ⌘ K <href>
Heading 1 ⌥⌘ 1 #
Heading 2 ⌥⌘ 2 ##
Heading 3 ⌥⌘ 3 ###
R Code Chunk ⌥⌘ I ```{r}

See the editing shortcuts article for a complete list of all shortcuts.

Insert Anything

You can also use the catch-all ⌘ / shortcut to insert just about anything. Just execute the shortcut then type what you want to insert. For example:

If you are at the beginning of a line (as displayed above), you can also enter plain / to invoke the shortcut.

Editor Toolbar

The editor toolbar includes buttons for the most commonly used formatting commands:

Additional commands are available on the Format, Insert, and Table menus:

Format Insert Table

Learning More

Check out the following articles to learn more about visual markdown editing:

  • Citations covers citing other works and managing bibliographies, as well as integration with Zotero (an open source reference management tool).

  • Technical Writing covers features commonly used in scientific and technical writing, including cross-references, footnotes, equations, embedded code, and LaTeX.

  • Content Editing provides more depth on visual editor support for tables, lists, pandoc attributes, comments, symbols/emojis, etc.

  • Markdown Formats describes how the visual editor parses and writes markdown, and also includes some tips for usage with Bookdown and Hugo.

  • Editing Shortcuts documents the two types of shortcuts you can use with the editor: standard keyboard shortcuts and markdown shortcuts.

  • Editor Options enumerates the various ways you can configure the behavior of the editor (font size, display width, markdown output, etc.).

  • Additional Topics discusses various other features including using CSS within HTML documents.

Thanks for trying out the visual editor! If you encounter problems or want to suggest features, please let us know at https://github.com/rstudio/rstudio/issues/new/choose.