rmd2ioslides {accessr} | R Documentation |
Converts R markdown code to ioslides html presentations
Description
Creates accessible html ioslides presentations using R markdown's
ioslides_presentation
argument to
render
. Zip archives of the html files may be
created.
Usage
rmd2ioslides(
x,
zip = if (length(x) == 1 & !add) FALSE else TRUE,
pdf = FALSE,
zip_pdf = zip,
pdf_args = list(),
add = FALSE,
quiet = TRUE,
rm_html = FALSE,
rm_pdf = FALSE,
inc_rmd = FALSE,
params = NULL,
...
)
Arguments
x |
A character vector containing the names (no extension) of
the |
zip |
A logical scalar or character vector indicating whether html
files should be put into a zip archive. If |
pdf |
A logical scalar. If |
zip_pdf |
As |
pdf_args |
A list of arguments passed to
|
add |
A logical scalar that determines what happens if the output
zip file already exists. If |
quiet |
Argument of the same name passed to
|
rm_html |
A logical scalar. If |
rm_pdf |
A logical scalar. If |
inc_rmd |
A logical scalar. If |
params |
A list of named parameters to pass as the argument
|
... |
Additional arguments passed to
If This function is not vectorised with respect to arguments in
|
Details
Information such as title
, author
, lang
etc in
the YAML header in the Rmd file are used but output
is ignored.
The simplest setup is to have the .Rmd
files in the current
working directory, in which case rmd2ioslides()
will create ioslides
presentations from all these Rmd files, but the .Rmd
files may be
in different directories.
The render
function, with the argument
output_file =
ioslides_presentation
creates the ioslides html files.
The function ioslides_presentation
has an
argument slide_level
that sets the header level used as a slide
separator. The Lua filter ioslides_presentation.lua
in
the rmarkdown
package uses
any content between headers of level slide_level
to create a segue
slide, which has a grey background and is intended only to contain a section
heading.
In particular, under the default, slide_level = 2
, content
between a level one header # and the next level two header ## is formatted
as a separate grey segue slide. If we do not want segue slides then we must
avoid using level one headers. However, for reasons of document
accessibility, we may want to use level one headers to separate slides.
For example, if we wish to create an ioslides presentation and a Word
document from the same source Rmd file then the Word document will only meet
fully accessibility requirements if the headings in the document start at
level one.
In rmarkdown version 2.26, passing slide_level = 1
to
ioslides_presentation
does not force a new
non-segue slide when a level one header # is used: it places
all content between # and the next ## on a grey segue slide and the
behaviour content of the resulting slides is not as intended. Passing
slide_level = 1
to rmd2ioslides()
replaces rmarkdown
's Lua filter
ioslides_presentation.lua
with one that has been modified, so that
passing slide_level = 1
will start a new non-segue slide.
A modified default.css
css file is also used
that adjusts the font sizes for the header levels accordingly, so that the
level one header has a larger font than the level two header.
For values of slide_level
greater than or equal to 2,
ioslides_presentation
will behave as usual.
If slide_level
is not supplied then slide_level = 1
is used.
Value
In addition to creating the html files, and perhaps zip files, a list containing the following (character vector) components is returned invisibly:
files |
(absolute) paths and file names of the files added to a zip file. |
zips |
(relative) paths and names of all the zip files. |
See Also
rmd2many
, rmd2word
,
rmd2slidy
, rmd2html
for other output formats.
The accessr package page on Github.
Examples
# Create an ioslides presentation from example.Rmd
got_hux <- requireNamespace("huxtable", quietly = TRUE)
got_flex <- requireNamespace("flextable", quietly = TRUE)
got_pandoc <- rmarkdown::pandoc_available("1.14")
got_all <- got_hux && got_flex && got_pandoc
# This example needs packages huxtable and flextable
if (got_all) {
ex_file <- system.file(package = "accessr", "examples", "example.Rmd")
file.copy(ex_file, tdir <- tempdir(check = TRUE), overwrite = TRUE)
ex_file <- list.files(tdir, pattern = "example.Rmd", full.names = TRUE)
ex_file <- sub(".Rmd", "", ex_file)
rmd2ioslides(ex_file)
}