Skip to content

Commit

Permalink
tweak vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Nov 8, 2024
1 parent c43fda0 commit 9eb1074
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: knitr
Type: Package
Title: A General-Purpose Package for Dynamic Report Generation in R
Version: 1.49
Version: 1.49.1
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
person("Abhraneel", "Sarma", role = "ctb"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CHANGES IN knitr VERSION 1.50

# CHANGES IN knitr VERSION 1.49

## NEW FEATURES
Expand Down
3 changes: 1 addition & 2 deletions vignettes/knitr-intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ manual](https://yihui.org/knitr/demo/graphics/) ), and remember to read the help
pages of functions in this package. There is a book "Dynamic Docuemnts with R
and knitr" for this package, too.

Anyway, here is a code chunk that shows you can compile vignettes with **knitr**
as well using R 3.0.x, which supports non-Sweave vignettes:
Below are code chunk examples:

```{r show-off}
options(digits = 4)
Expand Down
12 changes: 6 additions & 6 deletions vignettes/knitr-markdown.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: R Markdown (v1) Vignettes with knitr
title: R Markdown Vignettes with litedown
author: Yihui Xie
date: "`{r} Sys.Date()`"
output:
Expand All @@ -10,24 +10,24 @@ output:

<!--
%\VignetteEngine{litedown::vignette}
%\VignetteIndexEntry{An R Markdown Vignette with knitr}
%\VignetteIndexEntry{R Markdown Vignettes with litedown}
-->

Before R 3.0.0, only Sweave/PDF vignettes were supported in R. Markdown is gaining popularity over the years due to its simplicity, and R 3.0.0 starts to support package vignettes written in R Markdown.

> Please note this example is for [R Markdown v1](https://cran.r-project.org/package=markdown) only. If you use [R Markdown v2](https://rmarkdown.rstudio.com), you should use the vignette engine `knitr::rmarkdown` instead of `knitr::knitr`.
> Please note this example is for [litedown](https://cran.r-project.org/package=litedown). If you use [R Markdown v2](https://rmarkdown.rstudio.com), you should use the vignette engine `knitr::rmarkdown` instead of `litedown::vignette`.
## Package vignettes

To enable Markdown vignettes in an R package, you need to

- add `*.Rmd` files under the `vignettes` directory
- add `VignetteBuilder: knitr` to the `DESCRIPTION` file
- specify the vignette engine `\VignetteEngine{knitr::knitr}` in the `Rmd` files (inside HTML comments)
- add `VignetteBuilder: litedown` to the `DESCRIPTION` file
- specify the vignette engine `\VignetteEngine{litedown::vignette}` in the `Rmd` files (inside HTML comments)

## View vignettes

And R will load the **knitr** package to build these vignettes to HTML files, and you can see them when you open the HTML help:
And R will load the **litedown** package to build these vignettes to HTML files, and you can see them when you open the HTML help:

```{r eval=FALSE}
help(package = 'YourPackage', help_type = 'html')
Expand Down

0 comments on commit 9eb1074

Please sign in to comment.