Skip to content

Commit 45d6c81

Browse files
Alison Presmanes Hillyihui
authored andcommitted
Add a pkgdown site (#1574)
1 parent 473d803 commit 45d6c81

10 files changed

Lines changed: 381 additions & 122 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ PANDOC\.(Rmd|md|html)
1313
^tests/testthat/site/.*_files/
1414
^revdep/
1515
^\.github$
16-
16+
^pkgdown$

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
.DS_Store
55
README.html
66
CONTRIBUTING.html
7-
PANDOC.html
87
issues/
98
inst/doc
109
vignettes/*.R

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@ env:
77
global:
88
- _R_CHECK_TESTS_NLINES_=0
99
matrix:
10-
- PANDOC_VERSION=default
10+
- PANDOC_VERSION=default NETLIFY_SITE_ID=5d77c13c-e2ee-4a31-87ca-2fe657196160
1111
- PANDOC_VERSION=latest PATH=$HOME/bin:$PATH
1212

1313
before_install:
1414
- "[[ ${PANDOC_VERSION} = latest ]] && ./tools/install-pandoc.sh || true"
1515
- tlmgr install units
16+
17+
after_success:
18+
- "[[ ${TRAVIS_BRANCH} = master ]] || exit 0"
19+
- "[[ ${PANDOC_VERSION} = default ]] || exit 0"
20+
- nvm install stable
21+
- npm install netlify-cli -g
22+
- Rscript -e 'xfun::pkg_load2("pkgdown")'
23+
- Rscript -e 'pkgdown::build_site(".", document = FALSE, preview = FALSE)'
24+
- netlify deploy --prod --dir docs

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ Suggests:
9494
fs,
9595
callr (>= 2.0.0)
9696
SystemRequirements: pandoc (>= 1.12.3) - http://pandoc.org
97-
URL: https://rmarkdown.rstudio.com
97+
URL: https://github.com/rstudio/rmarkdown
9898
BugReports: https://github.com/rstudio/rmarkdown/issues
9999
License: GPL-3
100100
RoxygenNote: 6.1.1
101101
Encoding: UTF-8
102+
VignetteBuilder: knitr

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ rmarkdown 1.14
77

88
- For `render()`, if the input filename contains special characters such as spaces or question marks (as defined in `rmarkdown:::.shell_chars_regex`), the file will be temporarily renamed with the special characters replaced by `-` (dash) instead of `_` (underscore, as in previous versions of **rmarkdown**). This change will affect users who render such files with caching (cache will be invalidated and regenerated). The change is due to the fact that `-` is generally a safer character than `_`, especially for LaTeX output (#1396).
99

10+
- Added a **pkgdown** site for the **rmarkdown** package: https://rmarkdown.rstudio.com/docs/ (thanks, @apreshill, #1574).
11+
1012

1113
rmarkdown 1.13
1214
================================================================================

README.md

Lines changed: 30 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -3,146 +3,63 @@
33
[![Build Status](https://travis-ci.org/rstudio/rmarkdown.svg?branch=master)](https://travis-ci.org/rstudio/rmarkdown)
44
[![Downloads from the RStudio CRAN mirror](https://cranlogs.r-pkg.org/badges/rmarkdown)](https://cran.r-project.org/package=rmarkdown)
55

6-
The **rmarkdown** package is a next generation implementation of R Markdown based on [Pandoc](http://johnmacfarlane.net/Pandoc/). This implementation brings many enhancements to R Markdown, including:
6+
The **rmarkdown** package helps you create dynamic analysis documents that combine code, rendered output (such as figures), and prose. You bring your data, code, and ideas, and R Markdown renders your content into a polished document that can be used to:
77

8-
- Create HTML, PDF, and MS Word documents as well as [Beamer](https://bitbucket.org/rivanvx/beamer/wiki/Home), [ioslides](https://code.google.com/p/io-2012-slides/), and [Slidy](http://www.w3.org/Talks/Tools/Slidy2/) presentations.
9-
- New markdown syntax including expanded support for tables, definition lists, and bibliographies.
10-
- Hooks for customizing HTML and PDF output (include CSS, headers, and footers).
11-
- Include raw LaTeX within markdown for advanced customization of PDF output.
12-
- Compile HTML, PDF, or MS Word notebooks from R scripts.
13-
- Extensibility: easily define new formats for custom publishing requirements.
14-
- Create interactive R Markdown documents using Shiny.
8+
<img src="https://bookdown.org/yihui/rmarkdown/images/hex-rmarkdown.png" alt="The rmarkddown hex sticker" width="200" style="padding: 0 15px; float: right;"/>
159

16-
Note that PDF output (including Beamer slides) requires an installation of TeX.
10+
- Do data science interactively within the RStudio IDE,
1711

18-
See the [R Markdown documentation](https://rmarkdown.rstudio.com) for full details.
12+
- Reproduce your analyses,
1913

20-
### Installation
14+
- Collaborate and share code with others, and
2115

22-
If you are working within RStudio then you can simply install the [current release](http://www.rstudio.com/ide/download/preview) of RStudio (both the rmarkdown package and Pandoc are included).
16+
- Communicate your results with others.
2317

24-
If you want to use the rmarkdown package outside of RStudio then you can install the package from CRAN as follows:
18+
R Markdown documents can be rendered to many output formats including HTML documents, PDFs, Word files, slideshows, and more, allowing you to focus on the content while R Markdown takes care of your presentation.
2519

26-
```r
27-
install.packages("rmarkdown")
28-
# or install the dev version via remotes::install_github('rstudio/rmarkdown')
29-
```
3020

31-
A recent version of Pandoc (&gt;= 1.12.3) is also required. See the [Pandoc installation instructions](Pandoc.md) for details on installing Pandoc for your platform.
21+
### Installation
3222

33-
### Usage
23+
The easiest way to install the **rmarkdown** package is from within the [RStudio IDE](http://www.rstudio.com/ide/download/preview), but you don't need to explicitly install it or load it, as RStudio automatically does both when needed. A recent version of Pandoc (>= 1.12.3) is also required; RStudio also automatically includes this too so you do not need to download Pandoc if you plan to use rmarkdown from the RStudio IDE.
3424

35-
The `render` function is used to convert R Markdown (Rmd) files into various output formats (the default is HTML). Calling `render` will knit the specified input document and then produce the final output document using Pandoc:
25+
If you want to use the rmarkdown package outside of RStudio, you can install the package from CRAN as follows:
3626

3727
```r
38-
render("input.Rmd")
39-
```
40-
41-
You can also specify a plain markdown file in which case knitting will be bypassed:
42-
43-
```r
44-
render("input.md")
45-
```
46-
47-
#### Output Formats
48-
49-
R Markdown documents can contain a metadata section that includes both title, author, and date information as well as options for customizing output. For example, this metadata included at the top of an Rmd file adds a table of contents and chooses a different HTML theme:
50-
51-
```yaml
52-
---
53-
title: "Sample Document"
54-
output:
55-
html_document:
56-
toc: true
57-
theme: united
58-
---
59-
```
60-
61-
R Markdown has built in support for several output formats (HTML, PDF, and MS Word documents as well as Beamer presentations). These formats can also be specified in metadata, for example:
62-
63-
```yaml
64-
---
65-
title: "Sample Document"
66-
output:
67-
pdf_document:
68-
toc: true
69-
highlight: zenburn
70-
---
71-
```
72-
73-
If you aren't specifying format options you can also just use a simple format name:
74-
75-
```yaml
76-
---
77-
title: "Sample Document"
78-
output: pdf_document
79-
---
80-
```
81-
82-
Multiple formats can be specified in metadata:
83-
84-
```yaml
85-
---
86-
title: "Sample Document"
87-
output:
88-
html_document:
89-
toc: true
90-
theme: united
91-
pdf_document:
92-
toc: true
93-
highlight: zenburn
94-
---
28+
install.packages("rmarkdown")
9529
```
9630

97-
To select from the various formats defined you can pass a format name to `render`. For example:
31+
If you want to use the development version of the rmarkdown package (either with or without RStudio), you can install the package from GitHub via the [**remotes** package](https://remotes.r-lib.org):
9832

9933
```r
100-
render("input.Rmd", "pdf_document")
34+
remotes::install_github('rstudio/rmarkdown')
10135
```
10236

103-
If no explicit format name is passed to `render` then the first one defined will be used. You can also render all formats defined in the file with:
37+
If not using the RStudio IDE, you'll need to install a recent version of Pandoc (>= 1.12.3); see the [Pandoc installation instructions](https://rmarkdown.rstudio.com/docs/articles/pandoc.html) for help.
10438

105-
```r
106-
render("input.Rmd", "all")
107-
```
39+
### Usage
10840

109-
#### Shared Output Formats
41+
The easiest way to make a new R Markdown document is from within RStudio. Go to _File > New File > R Markdown_. From the new file wizard, you may:
11042

111-
You can also define output formats externally in a file named `_output.yml` located in the same directory as the R Markdown source file. For example:
43+
+ Provide a document title (_optional but recommended_),
44+
+ Provide an author name (_optional but recommended_),
45+
+ Select a default output format- HTML is the recommended format for authoring, and you can switch the output format anytime (_required_),
46+
+ Click **OK** (_required_).
11247

113-
```yaml
114-
html_document:
115-
toc: true
116-
theme: united
117-
pdf_document:
118-
toc: true
119-
highlight: zenburn
120-
```
48+
Once inside your new `.Rmd` file, you should see some boilerplate text that includes code chunks. Use the "Knit" button in the RStudio IDE to render the file and preview the output with a single click or use the keyboard shortcut Cmd/Ctrl + Shift + K.
12149

122-
Using an `_output.yml` file is a good way to share output settings across multiple R Markdown files in the same directory.
50+
You can also delete all the text below the YAML frontmatter and fill in your own `.Rmd` by:
12351

124-
#### Output Format Functions
52+
+ Adding code chunks (keyboard shortcut: `Ctrl + Alt + I`; OS X: `Cmd + Option + I`),
53+
+ Writing prose with [Markdown formatting](https://www.markdowntutorial.com/), and
54+
+ Running each code chunk interactively by clicking the ![The run button](https://rmarkdown.rstudio.com/images/notebook-run-chunk.png) icon within RStudio.
12555

126-
Output formats need not be specified in metadata. In fact, metadata is just a convenient way to invoke functions that implement output formats. There are seven built-in output formats each exported as a function from the package:
56+
You can also click "Knit to HTML" again to render the full document with all code chunks. For more help getting started in R Markdown, please see the [R Markdown website](https://rmarkdown.rstudio.com/lesson-1.html) or use the **"Get Started"** links at the top of this page.
12757

128-
- `html_document`
129-
- `pdf_document`
130-
- `word_document`
131-
- `md_document`
132-
- `beamer_presentation`
133-
- `ioslides_presentation`
134-
- `slidy_presentation`
58+
### Getting help
13559

136-
As you'd expect, these functions can also be invoked as part of the call to `render`, for example:
137-
138-
```r
139-
render("input.Rmd", html_document(toc = TRUE))
140-
render("input.Rmd", pdf_document(latex_engine = "lualatex"))
141-
render("input.Rmd", beamer_presentation(incremental = TRUE))
142-
```
60+
There are two main places to get help:
14361

144-
For more details on the options available for each format see their respective help topics.
62+
1. The [RStudio community](https://community.rstudio.com/c/R-Markdown) is a friendly place to ask any questions about rmarkdown and the R Markdown family of packages.
14563

146-
### License
64+
1. [Stack Overflow](https://stackoverflow.com/questions/tagged/r-markdown) is a great source of answers to common rmarkdown questions. It is also a great place to get help, once you have created a reproducible example that illustrates your problem.
14765

148-
The **rmarkdown** package is licensed under the GPLv3 (<http://www.gnu.org/licenses/gpl.html>).

0 commit comments

Comments
 (0)