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

quarto_preview does not open right windows in RStudio IDE. #214

Open
cderv opened this issue Sep 26, 2024 · 9 comments
Open

quarto_preview does not open right windows in RStudio IDE. #214

cderv opened this issue Sep 26, 2024 · 9 comments

Comments

@cderv
Copy link
Collaborator

cderv commented Sep 26, 2024

I'm on quarto 1.4.4 and somehow I am still getting this error: (edit: similar to #167)

> options(browser=\(url) cat(paste0(url, "\n")))
> quarto::quarto_preview("report.qmd")


processing file: report.qmd
1/29                   
2/29 [unnamed-chunk-1] 
3/29                   
4/29 [unnamed-chunk-2] 
5/29                   
6/29 [unnamed-chunk-3] 
7/29                   
8/29 [unnamed-chunk-4] 
9/29                   
10/29 [unnamed-chunk-5] 
11/29                   
12/29 [unnamed-chunk-6] 
13/29                   
14/29 [unnamed-chunk-7] 
15/29                   
16/29 [unnamed-chunk-8] 
17/29                   
18/29 [unnamed-chunk-9] 
19/29                   
20/29 [unnamed-chunk-10]
21/29                   
22/29 [unnamed-chunk-11]
23/29                   
24/29 [unnamed-chunk-12]
25/29                   
26/29 [unnamed-chunk-13]
27/29                   
28/29 [unnamed-chunk-14]
29/29                   
output file: report.knit.md

pandoc 
  to: revealjs
  output-file: report.html
  standalone: true
  wrap: none
  default-image-extension: png
  html-math-method:
    method: mathjax
    url: >-
      https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=T
eX-AMS_HTML-full
  slide-level: 2
  
metadata
  link-citations: true
  width: 1050
  height: 700
  margin: 0.1
  center: false
  navigationMode: linear
  controlsLayout: edges
  controlsTutorial: false
  hash: true
  history: true
  hashOneBasedIndex: false
  fragmentInURL: false
  transition: none
  backgroundTransition: none
  pdfSeparateFragments: false
  lang: en
  auto-stretch: true
  editor: visual
  ...
  date: today
  
Output created: report.html

Watching files for changes
Browse at http://localhost:3345/report.html
Stop the preview with quarto_preview_stop()http://localhost:3345
> 

Originally posted by @idavydov in #167 (comment)

@cderv
Copy link
Collaborator Author

cderv commented Sep 26, 2024

@idavydov usually we expect some reproducible example to help understand encountered issue.

Please can you share more about your context ?

  • Is report.qmd part of a project for example ?

Also as much details as possible is welcome so that the minimum interpretation from me is required. This helps quickly solve problem.

Thank you !

@idavydov
Copy link

thanks, @cderv for creating a new issue. here's the minimal reproducible example which I found so far.

_quarto.yml

project:
 type: default
 

format:
 html:
    toc: true
    toc-depth: 2
    number-sections: true

editor: visual

execute: 
  cache: false

report.qmd

---
format:
  html
---

## hello

to reproduce the issue one could run:

> quarto::quarto_preview("report.qmd")
pandoc 
  to: html
  output-file: report.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  toc: true
  toc-depth: 2
  number-sections: true
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  editor: visual
  
Output created: report.html

Watching files for changes
Browse at http://localhost:7022/report.html
Stop the preview with quarto_preview_stop()> GET: / (404: Not Found)

@idavydov
Copy link

quarto version: 1.5.57

sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] quarto_1.4.4   nvimcom_0.9.49

loaded via a namespace (and not attached):
 [1] digest_0.6.35     later_1.3.2       fastmap_1.1.1     xfun_0.43         knitr_1.46        htmltools_0.5.8.1 rmarkdown_2.26    ps_1.7.6         
 [9] cli_3.6.2         processx_3.8.4    compiler_4.3.3    rstudioapi_0.16.0 tools_4.3.3       evaluate_0.23     yaml_2.3.8        Rcpp_1.0.12      
[17] rlang_1.1.3       jsonlite_1.8.8   

@cderv
Copy link
Collaborator Author

cderv commented Sep 27, 2024

I can't reproduce right now

> quarto::quarto_preview("report.qmd")
pandoc 
  to: html
  output-file: report.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  toc: true
  toc-depth: 2
  number-sections: true
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  editor: visual
  
Output created: report.html

Watching files for changes
Browse at http://localhost:5156/report.html
Stop the preview with quarto_preview_stop()

It opens correctly in IDE.

This is also with CRAN version 1.4.4 🤔

So I am a bit puzzled

@idavydov
Copy link

Hi @cderv , just to double check, there are both files (qmd and yml) in the directory you are running, correct?

I tried from two locations: locally on my mac and on linux via ssh. Same results.

Maybe it has something to do with the IDE? I got these results just by calling the R REPL.

@cderv
Copy link
Collaborator Author

cderv commented Sep 27, 2024

Maybe it has something to do with the IDE? I got these results just by calling the R REPL.

I'll try this ! I was assuming work RStudio IDE.

@cderv
Copy link
Collaborator Author

cderv commented Sep 30, 2024

I still can't reproduce. I opened my Terminal, ran R to get the R console and then

> packageVersion("quarto")
[1] '1.4.4'
> quarto::quarto_preview("report.qmd")
pandoc
  to: html
  output-file: report.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png

metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: Report

Output created: report.html

Watching files for changes
Browse at http://localhost:4665/report.html

And it opens the browser in the correct window

Same in R Gui

@idavydov
Copy link

idavydov commented Sep 30, 2024

just so this doesn't get lost: the bug only reproduces when there's report.qmd as well as _quarto.yml in the directory. with report.qmd alone it works fine.

I just managed to reproduce this in a docker image. I created the two files in ~/x/, installed quarto from CRAN and ran:

> options(browser=function(url) cat(paste0("\nurl: ", url, "\n")))
> quarto::quarto_preview("report.qmd")
pandoc 
  to: html
  output-file: report.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  toc: true
  toc-depth: 2
  number-sections: true
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  editor: visual
  
Output created: report.html

Watching files for changes
Browse at http://localhost:5046/report.html
Stop the preview with quarto_preview_stop()
url: http://localhost:5046
> packageVersion("quarto")
[1] ‘1.4.4’

@cderv
Copy link
Collaborator Author

cderv commented Sep 30, 2024

Oh thanks for the docker image ! This will definitely help understand what is happening. I am really puzzled by this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants