Skip to content

canonical editor and empty lines in equations cause parsing errors #14331

Open

Description

@jtlandis

System details

RStudio Edition :  Desktop
RStudio Version :  2023.12.1+402
OS Version      :  MacOS Big Sur (11.7.4)
R Version       :  4.3.2

Steps to reproduce the problem

  • Create Rstudio Project
  • Set visual Rmarkdown settings:
    • MarkdownCanonical: Yes

or include

---
editor:
  markdown:
    canonical: true
---

Create a formula within a .qmd document like so:


$$

w_t =
\begin{cases}
\log(y_t) &\text{if }\,\, \lambda = 0;\\
(y_t^\lambda - 1)/\lambda& \text{otherwise.}
\end{cases}

$$

Note the empty liens between dollar signs and the first part of the equation are crucial for reproducing error. Upon saving, the document parses to the following .qmd


\$\$

w_t =

```{=tex}
\begin{cases}
\log(y_t) &\text{if }\,\, \lambda = 0;\\
(y_t^\lambda - 1)/\lambda& \text{otherwise.}
\end{cases}
```
\$\$

Describe the problem in detail

This seems to happen only when there is an empty line within equations and a canonical: true editor.

Note: if no empty lines are within the equation block, then the .qmd file parses correctly.

Describe the behavior you expected

I would expect that saving the document does not incorrectly parse the equation block. Unfortunately, this prevents the document from being rendered either.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on Feb 26, 2024
  2. ronblum commented on Mar 4, 2024

    @ronblum
    Contributor

    @jtlandis Thank you for raising the issue!

    QA: Try to reproduce this on MacOS first.

  3. self-assigned this
    on Mar 4, 2024
  4. added
    visual markdown
    and removed
    new
    on Mar 4, 2024
  5. removed their assignment
    on Mar 12, 2024
  6. ronblum commented on Mar 14, 2024

    @ronblum
    Contributor

    I can also reproduce this in RStudio Desktop 2022.07.2+576 and 2024.04.0-daily+573 on MacOS 14.4. It also happens if you start in source mode, then switch to visual mode, and occurs both in Quarto and R Markdown documents.

  7. removed their assignment
    on Mar 14, 2024
  8. ronblum commented on Mar 18, 2024

    @ronblum
    Contributor

    @ronblum Find out if this is an issue on the Quarto end.

  9. self-assigned this
    on Mar 18, 2024
  10. ronblum commented on Mar 18, 2024

    @ronblum
    Contributor

    This occurs in R Markdown as well, not just Quarto, so it appears to be a visual editor issue.

  11. added this to the Product Backlog milestone on Mar 27, 2024
  12. removed their assignment
    on Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugvisual markdown

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions