Skip to content

Cross-reference does not work in preview when specify output as bookdown::html_document2 #779

@Fred-Wu

Description

@Fred-Wu

Cross-referencing for images or tables via \@ref(tab:xxx) looks like working only under, say, bookdown::html_document2.
However, previewing the output by clicking "Open Preview to the Site" does not render cross-reference properly.

For example:

---
title: "R Notebook"
output:
  bookdown::html_document2: default
---
{r table1}
knitr::kable(mtcars[1:5, 1:5], caption = "The mtcars data.")

`mtcar` data is shown in Table \@ref(tab:table1).

The vscode-R preview results in
image

The correct one with rmarkdown::render or Ctrl + Shift + K results in
image

The current keybinding to open preview is Ctrl + Shift + V, is it possible to change it to render and open the preview with Ctrl + Shift + K, just like in RStudio?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions