In my Rmd, I would like to produce multiple format outputs (HTML, pdf). I would like some pagebreak after some sections in a pdf while vertical whitespace in case of HTML. Is it possible to detect and conditionally set something in the Rmd to create whitespace in HTML output and pagebreak in case of a pdf when they are rendered?
I am not sure what you mean by vertical whitespace exactly. However, here are some resource about what could be useful.
You can easily insert content based on the output format. See
Conditionnal asis engine can be useful too
About pagebreak, know there is a special usage of \pagebreak that will create a pagebreak in PDF and in HTML. For HTML, the pagebreak will appear when printing the webpage (see doc)
Also, you could be interested in pagedown which allow you to create PDF content from HTML, and the HTML view is paginated as the PDF will be.