pagedown icon indicating copy to clipboard operation
pagedown copied to clipboard

code_folding?

Open ignacio82 opened this issue 7 years ago • 2 comments

Is there any plan to add a code_folding option to pagedown::html_paged: ? I tried the following but it did not work as expected:

output:
  pagedown::html_paged:
    theme: default
    code_folding: hide
    toc: false
    # change to true for a self-contained document, but it'll be a litte slower for Pandoc to render
    self_contained: true

ignacio82 avatar Mar 26 '19 12:03 ignacio82

Sorry, but no. The main goal of pagedown is for printing. You cannot fold code on paper, so it is unlikely that we will support code-folding in pagedown.

yihui avatar Mar 26 '19 14:03 yihui

I agree: the goal of pagedown is to paginate a document using web technologies. The main difference with a html document is that pages have a limited available height (a web page has no vertical constraint).

pagedown::html_paged() uses Paged.js as a rendering engine. Once rendered, we cannot change the content height without breaking the document. The main problem is that the current implementation of code_folding in rmarkdown::html_document() modifies the content height.

With respect to this constraint on the content height, it is possible to add some interactivity to a paged html document: the reader could interact with the content before printing it. The main risk is that the printed content differs from one user to the other depending on the actions performed on the paged html document (this might lead to a reproducibility issue). However, I recognize that interacting with a paged document before printing it can be really fun and creative.

RLesur avatar Mar 26 '19 22:03 RLesur