Thanks Yihui and Jeff.

I've retrieved the default CSS file and made a tweak to it (changing a
header 1 size just to test it) and saved it to the same local directory as
my .Rmd file using the name 'mymarkdown.css' for testing.

I've added:
options(rstudio.markdownToHTML =
  function(inputFile, outputFile) {
    require(markdown)
    markdownToHTML(inputFile, outputFile, stylesheet='mymarkdown.css')
  }
)

to the top of my testfile.Rmd file so that my file now looks like:

options(rstudio.markdownToHTML =
  function(inputFile, outputFile) {
    require(markdown)
    markdownToHTML(inputFile, outputFile, stylesheet='mymarkdown.css')
  }
)

Title
========================================================

This is an R Markdown document. Markdown is a simple formatting syntax for
authoring web pages (click the **Help** toolbar button for more details on
using R Markdown).

When you click the **Knit HTML** button a web page will be generated that
includes both content as well as the output of any embedded R code chunks
within the document. You can embed an R code chunk like this:

```{r}
summary(cars)
```

But when I knit it, it just writes the "options" chunk at the top of my
document. Am I supposed to add something else to get the .rmd file to
reference the css?

I'm quite new to programming and R (as if you couldn't tell!), so not sure
what additional steps I need to add.

Thanks much.
Jeff



On Thu, Jan 30, 2014 at 1:48 PM, Yihui Xie <x...@yihui.name> wrote:

> Exactly. Please see RStudio documentation:
>
> https://support.rstudio.com/hc/en-us/articles/200552186-Customizing-Markdown-Rendering
>
> Regards,
> Yihui
> --
> Yihui Xie <xieyi...@gmail.com>
> Web: http://yihui.name
>
>
> On Thu, Jan 30, 2014 at 10:57 AM, Jeff Newmiller
> <jdnew...@dcn.davis.ca.us> wrote:
> > This sounds like a classic "you need to write a custom CSS file"
> problem... Which is off-topic here, so is homework for you.
> >
> > On January 30, 2014 8:34:32 AM PST, Jeff Johnson <mrjeffto...@gmail.com>
> wrote:
> >>Hi Yihui,
> >>
> >>The package I have installed is "knitr". To generate the HTML, I run
> >>Knit
> >>HTML from within R Studio version .98.490 (there's an icon to initiate
> >>it.
> >>
> ....
> >>
> >>You can load that dataset, then:
> >>Print the column names
> >>```{r, echo=showcode, comment=commentchar}
> >>colnames(mydf)
> >>```
> >>The resulting font is a couple of points larger than I'd like. I'd like
> >>to
> >>be able to control this either globally or at the code chunk level.
> >>
> >>Thanks for your help with this!
>



-- 
Jeff

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to