Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styler malforms text in Visual Markdown mode #9079

Open
4 tasks done
Tracked by #14639
jthomasmock opened this issue Mar 9, 2021 · 0 comments
Open
4 tasks done
Tracked by #14639

styler malforms text in Visual Markdown mode #9079

jthomasmock opened this issue Mar 9, 2021 · 0 comments
Labels
bug reproducible rstudioapi visual markdown For bugs related to the new visual editor mode added for RMarkdown docs in the 1.4 release.
Milestone

Comments

@jthomasmock
Copy link
Contributor

jthomasmock commented Mar 9, 2021

Hi @kevinushey I originally opened the issue in {styler}, and have moved it to here at Lorenz' request.

r-lib/styler#740 (comment)

I have copied the bulk of that post below. I can reproduce interactively, and have included a GIF of the behavior.


System details

RStudio Edition :  Desktop
RStudio Version : 1.4.1103
OS Version      : x86_64-apple-darwin17.0 (64-bit), macOS Catalina 10.15.7
R Version       : 4.1

Steps to reproduce the problem

Problem: In Visual Markdown mode, styling the active selection in a code-chunk appears to correctly style the code, but malforms it on the plain-text side.

Switching back into plain-text mode, the code will be "fixed", but if you "undo" you can see there is an intermediate format that is completely malformed and has lost some characters. Undo a second time will revert back to the original, unstyled format.

Reprex below, and note this works fine in non-visual editor mode.

---
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```



Use the `styler` package to "style" the code.
Code intentionally awkwardly formatted and of sufficient length as an example.

```{r}
mpg %>%     filter(cyl   %in%c(4 , 6,     8))%>%slice_sample(n=30) %>% mutate(hwy_mpl = hwy/2.352)
```

Environment:

## Packages of interest
styler V: 1.3.2
rstudioapi V: 0.13

Quick recording
Reprex-recording

Describe the problem in detail

Problem: In Visual Markdown mode, styling the active selection in a code-chunk appears to correctly style the code, but malforms it on the plain-text side temporarily which persists unless swapping back and forth between plain text and visual mode.

Describe the behavior you expected

Expected that styling the code would organize the code according to the style guide, and that the code would be able to run even in Visual Markdown mode.

  • 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 a 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.
@ronblum ronblum added bug reproducible visual markdown For bugs related to the new visual editor mode added for RMarkdown docs in the 1.4 release. labels Mar 10, 2021
@mikebessuille mikebessuille added this to the 1.7 (1H 2022) milestone May 3, 2021
@jjallaire jjallaire modified the milestones: Elsbeth Geranium, 2023 Sep 2, 2022
@ronblum ronblum modified the milestones: Backlog-2, Later Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reproducible rstudioapi visual markdown For bugs related to the new visual editor mode added for RMarkdown docs in the 1.4 release.
Projects
None yet
Development

No branches or pull requests

5 participants