-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
#' Register engines to support Quarto vignettes | ||
#' @importFrom tools vignetteEngine | ||
#' @noRd | ||
.onLoad <- function(libname, pkgname) { # args ignored | ||
vignetteEngine(name = "pdf", | ||
package = "quarto", | ||
pattern = "[.]qmd$", | ||
weave = function(file, ..., encoding = "UTF-8") { | ||
quarto_render(file, ..., output_format = "pdf") | ||
}, | ||
tangle = vignetteEngine("knitr::rmarkdown")$tangle, | ||
aspell = vignetteEngine("knitr::rmarkdown")$aspell | ||
) | ||
vignetteEngine(name = "html", | ||
package = "quarto", | ||
pattern = "[.]qmd$", | ||
weave = function(file, ..., encoding = "UTF-8") { | ||
quarto_render(file, ..., output_format = "html") | ||
}, | ||
tangle = vignetteEngine("knitr::rmarkdown")$tangle, | ||
aspell = vignetteEngine("knitr::rmarkdown")$aspell | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: "Quarto Vignettes" | ||
format: | ||
pdf: | ||
toc: false | ||
html: | ||
toc: true | ||
vignette: > | ||
%\VignetteIndexEntry{Vignettes} | ||
%\VignetteEngine{quarto::pdf} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
## Hello Vignette World! | ||
|
||
This is an example Quarto vignette, demonstrating how the **quarto** package can let you write package vignettes in Quarto. | ||
|
||
## Two Vignette Engines | ||
|
||
The **quarto** package registers 2 vignette engines, `quarto::pdf` and `quarto::html`. Either of these may be selected in a Quarto vignette's YAML header. For example, this vignette's header reads: | ||
```yaml | ||
--- | ||
title: "Quarto Vignettes" | ||
format: | ||
pdf: | ||
toc: false | ||
html: | ||
toc: true | ||
vignette: > | ||
%\VignetteIndexEntry{Vignettes} | ||
%\VignetteEngine{quarto::pdf} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
``` | ||
|
||
Consequently, a PDF version of this vignette is built. |