-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from quarto-dev/vignette-engine
- Loading branch information
Showing
23 changed files
with
371 additions
and
16 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ | |
^\.github$ | ||
^\.vscode$ | ||
^\.quarto$ | ||
^doc$ | ||
^Meta$ | ||
|
||
^vignettes/*_files$ |
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 |
---|---|---|
|
@@ -7,3 +7,5 @@ inst/doc | |
docs | ||
|
||
/.quarto/ | ||
/doc/ | ||
/Meta/ |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: quarto | ||
Title: R Interface to 'Quarto' Markdown Publishing System | ||
Version: 1.3.11 | ||
Version: 1.3.12 | ||
Authors@R: c( | ||
person("JJ", "Allaire", , "[email protected]", role = "aut", | ||
comment = c(ORCID = "0000-0003-0174-9868")), | ||
|
@@ -21,17 +21,18 @@ Imports: | |
rlang, | ||
rmarkdown, | ||
rstudioapi, | ||
tools, | ||
utils, | ||
yaml | ||
Suggests: | ||
curl, | ||
knitr, | ||
rsconnect (>= 0.8.26), | ||
testthat (>= 3.1.0), | ||
testthat (>= 3.1.7), | ||
withr, | ||
xfun | ||
VignetteBuilder: | ||
knitr | ||
quarto | ||
Config/testthat/edition: 3 | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
|
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
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,47 @@ | ||
register_vignette_engines <- function(pkg) { | ||
vig_engine("html", quarto_format = "html") | ||
vig_engine("pdf", quarto_format = "pdf") | ||
vig_engine("format", quarto_format = NULL) | ||
} | ||
|
||
|
||
vig_engine <- function(..., quarto_format) { | ||
rmd_eng <- tools::vignetteEngine('rmarkdown', package = 'knitr') | ||
tools::vignetteEngine( | ||
..., | ||
weave = vweave_quarto(quarto_format), | ||
tangle = rmd_eng$tangle, | ||
pattern = "[.]qmd$", | ||
package = "quarto", | ||
aspell = rmd_eng$aspell | ||
) | ||
} | ||
|
||
vweave_quarto <- function(format) { | ||
meta <- get_meta(format) | ||
function(file, driver, syntax, encoding, quiet = FALSE, ...) { | ||
quarto_render(file, ..., output_format = format, metadata = meta) | ||
} | ||
} | ||
|
||
get_meta <- function(format) { | ||
if (is.null(format)) return(NULL) | ||
if (format == "html") { | ||
return(get_meta_for_html()) | ||
} | ||
} | ||
|
||
get_meta_for_html <- function() { | ||
|
||
css <- system.file("rmarkdown", "template", "quarto_vignette", "resources", | ||
"vignette.css", package = "quarto") | ||
meta <- list() | ||
meta$format$html <- | ||
list( | ||
`embed-resources` = TRUE, | ||
minimal = TRUE, | ||
theme = "none", | ||
css = css | ||
) | ||
meta | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
|
||
|
||
relative_to_wd <- function(path) { | ||
relative_to(getwd(), path) | ||
} | ||
|
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,4 @@ | ||
# Register engines to support Quarto vignettes | ||
.onLoad <- function(lib, pkg) { | ||
register_vignette_engines(pkg) | ||
} |
158 changes: 158 additions & 0 deletions
158
inst/rmarkdown/template/quarto_vignette/resources/vignette.css
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,158 @@ | ||
body { | ||
background-color: #fff; | ||
margin: 1em auto; | ||
max-width: 700px; | ||
overflow: visible; | ||
padding-left: 2em; | ||
padding-right: 2em; | ||
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
font-size: 14px; | ||
line-height: 1.35; | ||
} | ||
|
||
|
||
|
||
table { | ||
margin: 1em auto; | ||
border-width: 1px; | ||
border-color: #DDDDDD; | ||
border-style: outset; | ||
border-collapse: collapse; | ||
} | ||
table th { | ||
border-width: 2px; | ||
padding: 5px; | ||
border-style: inset; | ||
} | ||
table td { | ||
border-width: 1px; | ||
border-style: inset; | ||
line-height: 18px; | ||
padding: 5px 5px; | ||
} | ||
table, table th, table td { | ||
border-left-style: none; | ||
border-right-style: none; | ||
} | ||
table thead, table tr.even { | ||
background-color: #f7f7f7; | ||
} | ||
|
||
p { | ||
margin: 0.5em 0; | ||
} | ||
|
||
blockquote { | ||
background-color: #f6f6f6; | ||
padding: 0.25em 0.75em; | ||
} | ||
|
||
hr { | ||
border-style: solid; | ||
border: none; | ||
border-top: 1px solid #777; | ||
margin: 28px 0; | ||
} | ||
|
||
dl { | ||
margin-left: 0; | ||
} | ||
dl dd { | ||
margin-bottom: 13px; | ||
margin-left: 13px; | ||
} | ||
dl dt { | ||
font-weight: bold; | ||
} | ||
|
||
ul { | ||
margin-top: 0; | ||
} | ||
ul li { | ||
list-style: circle outside; | ||
} | ||
ul ul { | ||
margin-bottom: 0; | ||
} | ||
|
||
pre, code { | ||
background-color: #f7f7f7; | ||
border-radius: 3px; | ||
color: #333; | ||
white-space: pre-wrap; /* Wrap long lines */ | ||
} | ||
pre { | ||
border-radius: 3px; | ||
margin: 5px 0px 10px 0px; | ||
padding: 10px; | ||
} | ||
pre:not([class]) { | ||
background-color: #f7f7f7; | ||
} | ||
|
||
code { | ||
font-family: Consolas, Monaco, 'Courier New', monospace; | ||
font-size: 85%; | ||
} | ||
p > code, li > code { | ||
padding: 2px 0px; | ||
} | ||
|
||
div.figure { | ||
text-align: center; | ||
} | ||
img { | ||
background-color: #FFFFFF; | ||
padding: 2px; | ||
border: 1px solid #DDDDDD; | ||
border-radius: 3px; | ||
border: 1px solid #CCCCCC; | ||
margin: 0 5px; | ||
} | ||
|
||
h1 { | ||
margin-top: 0; | ||
font-size: 35px; | ||
line-height: 40px; | ||
} | ||
|
||
h2 { | ||
border-bottom: 4px solid #f7f7f7; | ||
padding-top: 10px; | ||
padding-bottom: 2px; | ||
font-size: 145%; | ||
} | ||
|
||
h3 { | ||
border-bottom: 2px solid #f7f7f7; | ||
padding-top: 10px; | ||
font-size: 120%; | ||
} | ||
|
||
h4 { | ||
border-bottom: 1px solid #f7f7f7; | ||
margin-left: 8px; | ||
font-size: 105%; | ||
} | ||
|
||
h5, h6 { | ||
border-bottom: 1px solid #ccc; | ||
font-size: 105%; | ||
} | ||
|
||
a { | ||
color: #0033dd; | ||
text-decoration: none; | ||
} | ||
a:hover { | ||
color: #6666ff; } | ||
a:visited { | ||
color: #800080; } | ||
a:visited:hover { | ||
color: #BB00BB; } | ||
a[href^="http:"] { | ||
text-decoration: underline; } | ||
a[href^="https:"] { | ||
text-decoration: underline; } | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.html | ||
*.R | ||
*_files |
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 @@ | ||
include |
Oops, something went wrong.