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

Should r.rmarkdownRender command learn how to respect keep_html? #3736

Open
JosiahParry opened this issue Jun 29, 2024 · 3 comments
Open

Should r.rmarkdownRender command learn how to respect keep_html? #3736

JosiahParry opened this issue Jun 29, 2024 · 3 comments
Labels
enhancement New feature or request lang: r support
Milestone

Comments

@JosiahParry
Copy link

Positron Version:

Positron Version: 2024.06.1 (Universal) build 27
Code - OSS Version: 1.90.0
Commit: a893e5b
Date: 2024-06-26T02:08:06.673Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.4.0

^ as an aside, consider creating a command prompt to do this for you. Zed does this which makes reporting issues much easier. This is cumbersome and makes me less likely to submit bug reports

Steps to reproduce the issue:

  1. Create an Rmd document
  2. Click the play button select Render document with R Markdown
  3. watch an html file be created

Note that the documentation says:

"When you call rmarkdown::render directly from the command line the preview file is written alongside the generated .md file. However, when you render from within RStudio using the Knit button the preview HTML is written to a temporary directory and then automatically displayed by RStudio."

This does not happen in positron

Source: https://rmarkdown.rstudio.com/github_document_format.html

What did you expect to happen?

Preview file to not be created in my working directory. I do not want to have to modify the yaml front matter to avoid this.

Were there any error messages in the output or Developer Tools console?

@JosiahParry JosiahParry added the bug Something isn't working label Jun 29, 2024
@juliasilge
Copy link
Contributor

I may be missing something, but can you explain a bit more in detail about the output front matter vs. rendering in the working directory? I am not understanding the connection.

As a side note, we changed behavior in the Quarto extension in quarto-dev/quarto#435 so that when you preview a file in an R package, the HTML does get written to a temp directory. Can you give me a little more detail on whether you are in an R package or not?

@juliasilge juliasilge added the area: quarto Issues related to Quarto category. label Jul 1, 2024
@JosiahParry
Copy link
Author

Screen Recording 2024-07-01 at 12 11 19

When you run rmarkdown::render() it creates a preview file which is written to your working directory. This is the default behavior of rmarkdown::render() though I never knew this until using it in positron. When running in RStudio this preview file is written to a temporary directory and previewed:

However, when you render from within RStudio using the Knit button the preview HTML is written to a temporary directory and then automatically displayed by RStudio.

Neither of these things happen in Positron.

My desired experience would be to be able to knit and only the output file is created without a preview html file.

@juliasilge juliasilge changed the title Render document with R Markdown partially ignores output front matter Provide HTML preview in temp directory for r.rmarkdownRender command Jul 1, 2024
@juliasilge juliasilge added lang: r enhancement New feature or request and removed bug Something isn't working area: quarto Issues related to Quarto category. labels Jul 1, 2024
@juliasilge juliasilge changed the title Provide HTML preview in temp directory for r.rmarkdownRender command Should r.rmarkdownRender command set html_preview = FALSE? Jul 1, 2024
@juliasilge
Copy link
Contributor

OK gotcha, I have updated the title to be more clear what the feature request is here. Right now the r.rmarkdownRender command does use the default behavior of rmarkdown::render(). What I think you are asking for is the equivalent of wanting to do:

rmarkdown::render(output_options = list(html_preview = FALSE))

We could set that in the command itself, or look for a way to have it as an arg.

FWIW, this behavior is exactly as defined for github_document: https://rmarkdown.rstudio.com/docs/reference/github_document.html

It's arguable that we are doing the right thing here.

As a workaround, you can do:

output: 
  github_document:
    html_preview: FALSE

@juliasilge juliasilge changed the title Should r.rmarkdownRender command set html_preview = FALSE? Should r.rmarkdownRender command learn how to respect keep_html? Jul 5, 2024
@juliasilge juliasilge added this to the Future milestone Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lang: r support
Projects
None yet
Development

No branches or pull requests

3 participants