rstudio / pagedown

Paginate the HTML Output of R Markdown with CSS for Print
https://pagedown.rbind.io
Other
889 stars 129 forks source link

:::concise doesn't play nice with chrome_print #303

Open simeond opened 1 year ago

simeond commented 1 year ago

When I add a concise fence to a pagedown resume, it seems to conflict with chrome_print. See below for a reproducible example.

It works fine in infinite moon reader, but with chrome_print it breaks the page. Everything seemed to work fine last year (I don't update my cv too often)

---
title: "Lijia Yu's resume"
author: Lijia Yu
date: "`r Sys.Date()`"
output:
  pagedown::html_resume:
    # set it to true for a self-contained HTML page but it'll take longer to render
    self_contained: false
# uncomment this line to produce HTML and PDF in RStudio:
knit: pagedown::chrome_print
---

# Main

## Lijia Yu {#title}

### Currently searching for a PhD student position

Please note that this is a *real* resume, and I'm really looking for a PhD student position at the moment. I made this resume because Yihui asked me if I'd like to test the **pagedown** package with my resume. If you are interested in my background and skills, please feel free to contact me.

## Education {data-icon="graduation-cap"}

### Beijing University of Chemical Technology

B.S. in Information and Computing Sciences

Beijing, China

2010

Thesis: Dyadic wavelet and its application in edge detection

::: concise
- get dyadic wavelet
- apply to edge detection
- insert into thesis
- bob is your uncle.
:::
cderv commented 1 year ago

but with chrome_print it breaks the page.

What is the breakage ?

This is what I got in PDF by chrome_print() image

it seems fine compated to the HTML

image

Did I miss something or just can't reproduce ?

Using pagedown 0.20.1 and Chrome browser Version 108.0.5359.125

simeond commented 1 year ago

that's really odd. I still get two pages with chrome_print() but one with infinite moon reader (see below). I'm using chrome 108.0.5359.124 and pagedown 0.20.0

chrome_print_cv.pdf

Screenshot 2023-01-05 at 17 10 36
cderv commented 1 year ago

Can you share a reprex as a full github repo maybe so that I could clone and reproduce ? Or a zip file ?

It seems copy pasting from github is not enough. Maybe a config, or some versions differences.

Sharing session info could help know we are on the same page;

Can you try pagedown the dev version just in case ?

simeond commented 1 year ago

Thanks Christophe.

I've created a repo here and added the session info. I'm still getting the same problem even after upgraded to the new dev version of pagedown

https://github.com/simeond/pagedown_cv_test

cderv commented 1 year ago

Thanks a lot.

I can't reproduce on Windows after cloning the repo on rstudio daily version.

Details ```` ==> pagedown::chrome_print('C:/Users/chris/Documents/DEV_OTHER/ISSUES/pagedown/pagedown_cv_test/pagedown_print_test.Rmd', encoding = 'UTF-8'); ++ Activating rlang global_entrace ++ Setting QUARTO_PYTHON Using the browser "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" Trying to find headless Chrome in 20 attempts Headless Chrome found at attempt 1 Browser version: HeadlessChrome/108.0.5359.125 |......................................................................| 100% inline R code fragments "C:/Users/chris/scoop/apps/rstudio-daily/current/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS pagedown_print_test.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash-implicit_figures --output pagedown_print_test.html --lua-filter "C:\Users\chris\AppData\Local\R\win-library\4.2\bookdown\rmarkdown\lua\custom-environment.lua" --lua-filter "C:\Users\chris\AppData\Local\R\win-library\4.2\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\chris\AppData\Local\R\win-library\4.2\rmarkdown\rmarkdown\lua\latex-div.lua" --wrap preserve --metadata newpage_html_class="page-break-after" --standalone --section-divs --template "C:\Users\chris\AppData\Local\R\win-library\4.2\pagedown\resources\html\resume.html" --highlight-style pygments "--mathjax=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\chris\AppData\Local\Temp\RtmpiAn464\rmarkdown-str1092872642fc8.html" DEBUG (from custom-environment.lua): Div classes -> id:1 val:concise DEBUG (from custom-environment.lua): Not a bookdown supported custom class nil Serving the directory C:\Users\chris\Documents\DEV_OTHER\ISSUES\pagedown\pagedown_cv_test at http://127.0.0.1:4951/pagedown_print_test.html Rendered 1 pages in 62.5 milliseconds. Receiving PDF from a stream stream chunk received stream chunk received No more stream chunk to read closing stream Output created: pagedown_print_test.pdf Closing websocket connection Closing browser Cleaning browser working directory Closing local webserver ````

It seems you are working on Mac. @yihui could try to on your side to see if you can reproduce ? Thanks

yihui commented 1 year ago

I can't reproduce on my macOS with exactly the same version of Google Chrome.

> xfun::session_info('pagedown')
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.6.2, RStudio 2022.12.0.353

Comparing with @simeond's session info, my R version is higher and OS version is lower, but they shouldn't matter.

@simeond If you open the web page in your Chrome and print it via Cmd + P, do you get one or two pages?

servr::httd(initpath = 'pagedown_print_test.html')
simeond commented 1 year ago

If I use servr::httd(initpath = 'pagedown_print_test.html') and then print cmd+P, I get two pages, as before.

It shows correctly within the Rstudio window. It is only when I open in chrome, that I get the problem. And, strangely, chrome doesn’t show any of the ::concise information at all in html (an empty second page under education), but it does show it with cmd+p, but two pages.

Odd.


Simeon Duckworth 0797 991 7242

From: Yihui Xie @.> Date: Friday, 6 January 2023 at 14:43 To: rstudio/pagedown @.> Cc: simeon duckworth @.>, Mention @.> Subject: Re: [rstudio/pagedown] :::concise doesn't play nice with chrome_print (Issue #303)

I can't reproduce on my macOS with exactly the same version of Google Chrome.

xfun::session_info('pagedown')

R version 4.2.2 (2022-10-31)

Platform: x86_64-apple-darwin17.0 (64-bit)

Running under: macOS Monterey 12.6.2, RStudio 2022.12.0.353

Comparing with @simeondhttps://github.com/simeond's session info, my R version is higher and OS version is lower, but they shouldn't matter.

@simeondhttps://github.com/simeond If you open the web page in your Chrome and print it via Cmd + P, do you get one or two pages?

servr::httd(initpath = 'pagedown_print_test.html')

— Reply to this email directly, view it on GitHubhttps://github.com/rstudio/pagedown/issues/303#issuecomment-1373724495, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYPI3T3XPADDEZ5EX3H34DWRAVP3ANCNFSM6AAAAAATNAVB6Q. You are receiving this because you were mentioned.Message ID: @.***>