开源软件名称(OpenSource Name):rstudio/revealjs开源软件地址(OpenSource Url):https://github.com/rstudio/revealjs开源编程语言(OpenSource Language):JavaScript 53.6%开源软件介绍(OpenSource Introduction):R Markdown Format for reveal.js PresentationsOverviewThis repository provides an R Markdown custom format for reveal.js HTML presentations. The packages includes reveal.js library in version 4.2.1 You can use this format in R Markdown documents by installing this package as follows: install.packages("revealjs") To create a reveal.js presentation from R
Markdown you specify the ---
title: "Habits"
author: John Doe
date: March 22, 2005
output: revealjs::revealjs_presentation
---
# In the morning
## Getting up
- Turn off alarm
- Get out of bed
## Breakfast
- Eat eggs
- Drink coffee
# In the evening
## Dinner
- Eat spaghetti
- Drink wine
## Going to sleep
- Get in bed
- Count sheep RenderingDepending on your use case, there are 3 ways you can render the presentation.
RStudioWhen creating the presentation in RStudio, there will be a R ConsoleThe rmarkdown::render('my_reveal_presentation.Rmd') There are many other output tweaks you can use by directly calling
Command LineWhen you need the presentation to be rendered from the command line: Rscript -e "rmarkdown::render('my_reveal_presentation.Rmd')" Display ModesThe following single character keyboard shortcuts enable alternate display modes:
Pressing Incremental BulletsYou can render bullets incrementally by adding the ---
output:
revealjs::revealjs_presentation:
incremental: true
--- If you want to render bullets incrementally for some slides but not others you can use this syntax: ::: incremental
- Eat spaghetti
- Drink wine
::: or ::: nonincremental
- Eat spaghetti
- Drink wine
::: Incremental RevealingYou can also add pauses between content on a slide using # Slide header
Content shown first
. . .
Content shown next on the same slide Using Fragments explicitly is also possible # Slide header
Content shown first
::: fragment
Content shown next on the same slide
::: Appearance and StyleThere are several options that control the appearance of revealjs presentations:
For example: output:
revealjs::revealjs_presentation:
theme: sky
highlight: pygments
center: true Revealjs documentation about themes Slide TransitionsYou can use the
For example: output:
revealjs::revealjs_presentation:
transition: fade
background_transition: slide You can override the global transition for a specific slide by using the data-transition attribute, for example: ## Use a zoom transition {data-transition="zoom"}
## Use a faster speed {data-transition-speed="fast"} You can also use different in and out transitions for the same slide, for example: ## Fade in, Slide out {data-transition="slide-in fade-out"}
## Slide in, Fade out {data-transition="fade-in slide-out"} This works also for background transition ## Use a zoomed background transition {data-background-transition="zoom"} Revealjs documentation about transitions Slide BackgroundsSlides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page backgrounds outside of the slide area by adding a data-background attribute to your slide header element. Four different types of backgrounds are supported: color, image, video and iframe. Below are a few examples. ## CSS color background {data-background-color=#ff0000}
## Full size image background {data-background-image="background.jpeg"}
## Video background {data-background-video="background.mp4"}
## Embed a web page as a background {data-background-iframe="https://example.com"} Backgrounds transition using a fade animation by default. This can be
changed to a linear sliding transition by specifying the
Revealjs documentation about backgrounds 2-D PresentationsYou can use the # Horizontal Slide 1
## Vertical Slide 1
## Vertical Slide 2
# Horizontal Slide 2 With this layout horizontal navigation will proceed directly from
“Horizontal Slide 1” to “Horizontal Slide 2”, with vertical navigation
to “Vertical Slide 1”, etc. presented as an option on “Horizontal Slide
1”. Global reveal option
Reveal OptionsReveal.js has many additional options to configure it’s behavior. You
can specify any of these options using ---
title: "Habits"
output:
revealjs::revealjs_presentation:
self_contained: false
reveal_options:
slideNumber: true
previewLinks: true
--- You can find documentation on the various available Reveal.js options here: https://revealjs.com/config/. Figure OptionsThere are a number of options that affect the output of figures within reveal.js presentations:
For example: ---
title: "Habits"
output:
revealjs::revealjs_presentation:
fig_width: 7
fig_height: 6
fig_caption: true
--- MathJax EquationsBy default MathJax scripts are included in
reveal.js presentations for rendering LaTeX and MathML equations. You
can use the
For example, to use a local copy of MathJax: ---
title: "Habits"
output:
revealjs::revealjs_presentation:
mathjax: local
self_contained: false
--- To use a self-hosted copy of MathJax: ---
title: "Habits"
output:
revealjs::revealjs_presentation:
mathjax: "http://example.com/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
--- To exclude MathJax entirely: ---
title: "Habits"
output:
revealjs::revealjs_presentation:
mathjax: null
--- Document DependenciesBy default R Markdown produces standalone HTML files with no external
dependencies, using data: URIs to incorporate the contents of linked
scripts, stylesheets, images, and videos. This means you can share or
publish the file just like you share Office documents or PDFs. If you’d
rather keep dependencies in external files you can specify
---
title: "Habits"
output:
revealjs::revealjs_presentation:
self_contained: false
--- Note that even for self contained documents MathJax is still loaded
externally (this is necessary because of it’s size). If you want to
serve MathJax locally then you should specify One common reason keep dependencies external is for serving R Markdown
documents from a website (external dependencies can be cached separately
by browsers leading to faster page load times). In the case of serving
multiple R Markdown documents you may also want to consolidate dependent
library files (e.g. Bootstrap, MathJax, etc.) into a single directory
shared by multiple documents. You can use the ---
title: "Habits"
output:
revealjs::revealjs_presentation:
self_contained: false
lib_dir: libs
--- Reveal PluginsYou can enable various reveal.js plugins using the
Note that the use of plugins requires that the ---
title: "Habits"
output:
revealjs::revealjs_presentation:
self_contained: false
reveal_plugins: ["notes", "search"]
--- You can specify additional options for the ---
title: "Habits"
output:
revealjs::revealjs_presentation:
self_contained: false
reveal_plugins: ["chalkboard", "menu"]
reveal_options:
chalkboard:
theme: whiteboard
toggleNotesButton: false
menu:
side: right
--- No other plugins can be added in Advanced CustomizationIncludesYou can do more advanced customization of output by including additional
HTML content or by replacing the core pandoc template entirely. To
include content in the document header or before/after the document body
you use the ---
title: "Habits"
output:
revealjs::revealjs_presentation:
includes:
in_header: header.html
before_body: doc_prefix.html
after_body: doc_suffix.html
--- Pandoc ArgumentsIf there are pandoc features you want to use that lack equivalents in
the YAML options described above you can still use them by passing
custom ---
title: "Habits"
output:
revealjs::revealjs_presentation:
pandoc_args: [
"--title-prefix", "Foo",
"--id-prefix", "Bar"
]
--- Documentation on all available pandoc arguments can be found in the pandoc user guide. Shared OptionsIf you want to specify a set of default options to be shared by multiple
documents within a directory you can include a file named _output.yaml revealjs::revealjs_presentation:
theme: sky
transition: fade
highlight: pygments All documents located in the same directory as Code of ConductPlease note that the revealjs project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论