Exploring RStudio’s Visual Markdown Editor

[This article was first published on RStudio | Open source & professional software for data science teams on RStudio, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

RStudio 1.4 was released in January 2021 and switched to calendar-based versioning as of 2021.09. Starting with 1.4, the IDE includes a visual markdown editor that works on any markdown-based document, such as .md or .Rmd files. Visual editing mode provides a better experience when writing reports and analyses. You can see changes in real-time and preview what your document looks like without re-knitting.

In addition, the visual markdown editor provides extensive support for citations, scientific and technical writing features, outline navigation, and more.

In this blog post, we’d like to show how to use the visual markdown editor and highlight some features that you should know.

Get Started With the Visual Markdown Editor

To switch into the visual mode for a markdown document:

  • In RStudio v2022.02, click the “Visual” button located on the left side of the editor toolbar.
  • In earlier versions, click the compass icon located on the right side of the editor toolbar.

Alternatively, use the + + F4 keyboard shortcut.

Switching into the visual markdown editor mode

You can customize various editor settings. Go to Tools -> Global Options -> R Markdown -> Visual to choose your options, such as:

  • Whether your new documents use the visual markdown editor by default.
  • Whether the document outline shows by default.
  • How to wrap text in the document.
RStudio options in the visual editing mode dialogue box
Editor options

Create Content in the Visual Markdown Editor

How to embed rich media

Once in visual editing mode, you can paste rich content (tables, images, some formatting, etc.) into a document and match it in the source document.

Dragging and dropping an image into a document in visual editing mode

How to use keyboard and markdown shortcuts

The visual mode supports both standard keyboard shortcuts (e.g., + B for bold) and markdown syntax.

Italicizing and bolding text with markdown and keyboard shortcuts

Here are some commonly used shortcuts:

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

Check out more on the Editing Shortcuts page of the Visual R Markdown site.

How to use the catch-all shortcut to insert anything

You can also use the catch-all + / shortcut to insert headings, comments, symbols, and more.


How to use the editor toolbar

The editor toolbar includes buttons for common commands to edit formatting or insert content.

Inserting a table using the editor toolbar

Edit content in visual editing mode

The visual markdown editor also provides efficient tools to edit and customize content.

How to edit a table’s rows, columns, and alignment

Right-click on a table in your document. You can set the alignment, add or delete rows and columns, add a header, and more.

Adding a row and aligning a column

How to change an image’s height, width, and aspect ratio

Once you have an image in your document, you can edit the size and aspect ratio with the visual markdown editor. Click on the image and a small window will appear. Edit the numbers to change the height, width, and aspect ratio.


Learn More

The visual markdown editor has many other features for efficient report writing.

To leave a comment for the author, please follow the link and comment on their blog: RStudio | Open source & professional software for data science teams on RStudio.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)