rstudio / rmarkdown

Dynamic Documents for R
https://rmarkdown.rstudio.com
GNU General Public License v3.0
2.88k stars 975 forks source link

Enhancement Request: Allow for Themes in RNotebooks #864

Closed jeff-mettel closed 8 years ago

jeff-mettel commented 8 years ago

Background The fantastic RNotebooks functionality automatically creates a .html file from an RMarkdown document. This HTML file can be shared with R programmers and non R-programmers alike, and include both raw code as well as an general narrative around the analysis being performed.

@yihui 's site describes how RMarkdown can be augmented to produce documents with an aesthetically pleasing theme.

Problem It does not appear that RNotesbooks support this usage of themes.

Request RNotebooks provide a tremendous methodology for dissemination of analytics. Ensuring they support themes in the generation of HTML output would be a fantastic addition.

yihui commented 8 years ago

Just a minor correction: that was not my site, but @yixuan's :)

jjallaire commented 8 years ago

You can use the "theme" option as described by @yixuan in his post.

He goes on to describe how to create a more lightweight document that's still attractive. If your goal is lightweight though then html_notebook is anything but that (as it includes all code and output).

Hopefully what you are looking for is taken care of by the "theme" option (most of the bootswatch themes are supported: https://bootswatch.com/)

On Thu, Nov 10, 2016 at 9:06 AM, digital-dharma notifications@github.com wrote:

Background The fantastic RNotebooks http://rmarkdown.rstudio.com/r_notebooks.html functionality automatically creates a .html file from an RMarkdown document. This HTML file can be shared with R programmers and non R-programmers alike, and include both raw code as well as an general narrative around the analysis being performed.

@yihui https://github.com/yihui 's site http://statr.me/2016/08/creating-pretty-documents-with-the-prettydoc-package/ describes how RMarkdown can be augmented to produce documents with an aesthetically pleasing theme.

Problem It does not appear that RNotesbooks support this usage of themes.

Request RNotebooks provide a tremendous methodology for dissemination of analytics. Ensuring they support themes in the generation of HTML output would be a fantastic addition.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rstudio/rmarkdown/issues/864, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGXx78ukLXvbEC3LsDTWUObYFZsDx7Tks5q8yTOgaJpZM4Kusk1 .

yixuan commented 8 years ago

Yeah, prettydoc::html_pretty is a special version of rmarkdown::html_document to produce lightweight HTML. If you want to use html_notebook then you should look at the theme option provided by html_notebook as JJ suggested.

jeff-mettel commented 8 years ago

Thanks @jjallaire @yixuan for the rapid response. I may be misunderstanding what is possible.

In your site, you provide the following YAML header:

---
title: Nineteen Years Later
author: Harry Potter
date: July 31, 2016
output:
  rmarkdown::html_document:
    theme: lumen
---

If I create a RNotebook with this header however, it seems to consider itself a Knitr document and the 'Preview Notebook' button disappears.

Essentially, what I am looking for is a way to ensure that the HTML generated automatically by RNotebooks respects whatever theme is provided in the header (And the bootswatch themes described on the site are great).

Is this possible?

yixuan commented 8 years ago

Oh I see. Look at this line:

rmarkdown::html_document:

This is why the preview button disappears. You should change it to

---
title: Nineteen Years Later
author: Harry Potter
date: July 31, 2016
output:
  html_notebook:
    theme: lumen
---

But remember that the options of the theme parameter should take from

Themes provided by the prettydoc package have not yet been supported.

jeff-mettel commented 8 years ago

@yixuan - You nailed it, that was the problem. Thanks to everyone for all their help!

github-actions[bot] commented 4 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.