You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: inst/examples/03-formats.Rmd
+23-23Lines changed: 23 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -40,11 +40,11 @@ In this case, all formats should be at the top level, instead of under an `outpu
40
40
41
41
## HTML
42
42
43
-
The main difference between rendering a book (using **bookdown**) with rendering a single R Markdown document (using **rmarkdown**) to HTML\index{HTML} is that a book will generate multiple HTML pages by default---normally one HTML file per chapter. This makes it easier to bookmark a certain chapter or share its URL with others as you read the book, and faster to load a book into the web browser. Currently we have provided a number of different styles for HTML output:
43
+
The main difference between rendering a book (using **bookdown**) with rendering a single R Markdown document (using **rmarkdown**) to HTML\index{HTML} is that a book will generate multiple HTML pages by default---normally one HTML file per chapter. This makes it easier to bookmark a certain chapter or share its URL with others as you read the book, and faster to load a book into the web browser. Currently we have provided a number of different styles for HTML output:
44
44
45
-
- the GitBook style (Section \@ref(gitbook-style)),
46
-
- the three-column Bootstrap style (Section \@ref(bs4-book)),
47
-
- the default Bootstrap style (Section \@ref(bootstrap-style)), and
45
+
- the GitBook style (Section \@ref(gitbook-style)),
46
+
- the three-column Bootstrap style (Section \@ref(bs4-book)),
47
+
- the default Bootstrap style (Section \@ref(bootstrap-style)), and
48
48
- the Tufte style (Section \@ref(tufte-style)).
49
49
50
50
### GitBook style {#gitbook-style}
@@ -202,7 +202,7 @@ Another button shown on the toolbar is the information ('i') button that lists k
202
202
Finally, there are a few more top-level options in the YAML metadata that can be passed to the GitBook HTML template via Pandoc. They may not have clear visible effects on the HTML output, but they may be useful when you deploy the HTML output as a website. These options include:
203
203
204
204
- `description`: A character string to be written to the `content` attribute of the tag `<meta name="description" content="">` in the HTML head (if missing, the title of the book will be used). This can be useful for search engine optimization (SEO). Note that it should be plain text without any Markdown formatting such as `_italic_` or `**bold**`.
205
-
- `url`: The URL of book's website, e.g., `https\://bookdown.org/yihui/bookdown/`.^[The backslash before `:` is due to a technical issue: we want to prevent Pandoc from translating the link to HTML code `<a href="..."></a>`. More details at https://github.com/jgm/pandoc/issues/2139.]
205
+
- `url`: The URL of book's website, e.g., `https\://example.github.io/awesome/`.^[The backslash before `:` is due to a technical issue: we want to prevent Pandoc from translating the link to HTML code `<a href="..."></a>`. More details at https://github.com/jgm/pandoc/issues/2139.]
206
206
- `github-repo`: The GitHub repository of the book of the form `user/repo`.
207
207
- `cover-image`: The path to the cover image of the book.
208
208
- `apple-touch-icon`: A path to an icon (e.g., a PNG image). This is for iOS only: when the website is added to the Home screen, the link is represented by this icon.
@@ -216,7 +216,7 @@ Below we show some sample YAML metadata (again, please note that these are _top-
216
216
title: "An Awesome Book"
217
217
author: "John Smith"
218
218
description: "This book introduces the ABC theory, and ..."
219
-
url: 'https\://bookdown.org/john/awesome/'
219
+
url: 'https\://example.github.io/awesome/'
220
220
github-repo: "john/awesome"
221
221
cover-image: "images/cover.png"
222
222
apple-touch-icon: "touch-icon.png"
@@ -258,7 +258,7 @@ In addition to the basic **bookdown** components (Section \@ref(components)), th
258
258
- R syntax highlighting and autolinking by
259
259
[the **downlit** package](https://downlit.r-lib.org) is paired with an accessible
260
260
color scheme designed by Alison Hill.
261
-
261
+
262
262
- Enhanced metadata for social sharing via platforms like Twitter, LinkedIn, and Facebook, so that each chapter shared will have a unique description, auto-generated based on that chapter's content.
263
263
264
264
- Ability to configure links to a remote repository like GitHub or GitLab, allowing readers to easily view each chapter's source file or suggest an edit.
If you do not use RStudio or prefer a function, you can create the same project template with `bookdown::create_bs4_book()` from your R console. See `?bookdown::create_bs4_book` or [the online documentation](https://pkgs.rstudio.com/bookdown/reference/create_book.html) for help.
280
280
281
-
This style is designed for books that use one chapter per page.
282
-
This means that each chapter is an `.Rmd` file, and each `.Rmd` file can contain one chapter.
283
-
Each file *must* start with a first-level heading, `# Chapter title`, and that must be the only first-level heading in the file.
281
+
This style is designed for books that use one chapter per page.
282
+
This means that each chapter is an `.Rmd` file, and each `.Rmd` file can contain one chapter.
283
+
Each file *must* start with a first-level heading, `# Chapter title`, and that must be the only first-level heading in the file.
284
284
285
-
Use second-level and lower-level headings within chapters like:
285
+
Use second-level and lower-level headings within chapters like:
286
286
287
287
```md
288
288
# A chapter
@@ -305,7 +305,7 @@ author: "Jane Doe"
305
305
date: "`r Sys.Date()`"
306
306
site: bookdown::bookdown_site
307
307
output: bookdown::bs4_book
308
-
url: https://bookdown.org/janedoe/bookdown-demo
308
+
url: https://example.github.io/bookdown-demo
309
309
cover-image: cover.png
310
310
description: |
311
311
This is a minimal example of using the bookdown package to write a book.
@@ -322,24 +322,24 @@ You can use the `theme` option to add a `primary` color in [hexadecimal format,]
322
322
```yaml
323
323
bookdown::bs4_book:
324
324
theme:
325
-
primary: "#0d6efd"
325
+
primary: "#0d6efd"
326
326
```
327
327
328
328
For custom font settings, adding a `google:` keyword triggers [`sass::font_google()`’s](https://rstudio.github.io/sass/reference/font_face.html) ability to automatically import [Google Font files.](https://fonts.google.com) Here is an example YAML that changes the `base_font`, `heading_font`, and `code_font`:
329
329
330
330
```yaml
331
331
bookdown::bs4_book:
332
332
theme:
333
-
primary: "#0d6efd"
334
-
base_font:
333
+
primary: "#0d6efd"
334
+
base_font:
335
335
google: Sen
336
336
heading_font:
337
337
google:
338
338
family: Bitter
339
339
wght: 200
340
340
code_font:
341
-
google:
342
-
# arguments to sass::font_google()
341
+
google:
342
+
# arguments to sass::font_google()
343
343
family: DM Mono
344
344
local: false
345
345
```
@@ -350,7 +350,7 @@ You may also use non-Google fonts that you serve locally using [`sass::font_face
350
350
351
351
#### Callout blocks
352
352
353
-
Callout blocks can be used to make certain portions of content stand out from the rest of your narrative. The `bs4_book` style includes special callout blocks with predefined styles for adding a colored border around the text and/or code inside the callout. Use the following syntax to create a callout block:
353
+
Callout blocks can be used to make certain portions of content stand out from the rest of your narrative. The `bs4_book` style includes special callout blocks with predefined styles for adding a colored border around the text and/or code inside the callout. Use the following syntax to create a callout block:
`bs4_book` makes any footnotes to show inline on hover instead of a linked item at the bottom of the page. You can set `footnotes_inline = FALSE` to opt-out this behavior and keep the footnotes at the bottom.
393
+
`bs4_book` makes any footnotes to show inline on hover instead of a linked item at the bottom of the page. You can set `footnotes_inline = FALSE` to opt-out this behavior and keep the footnotes at the bottom.
394
394
395
395
```yaml
396
396
bookdown::bs4_book:
@@ -399,7 +399,7 @@ bookdown::bs4_book:
399
399
400
400
#### References/Bibliography
401
401
402
-
Making your citations _footnotes_ allows readers to read them near the text where they are used because `bs4_book` makes by default footnotes appear inline when clicked.
402
+
Making your citations _footnotes_ allows readers to read them near the text where they are used because `bs4_book` makes by default footnotes appear inline when clicked.
403
403
To do that, download a footnote style CSL file; we recommend <https://www.zotero.org/styles/>.
404
404
For example, you could download the `chicago-fullnote-bibliography.csl` from [Zotero,](https://www.zotero.org/styles/?q=id%3Achicago-fullnote-bibliography) then
405
405
add this to your `index.Rmd`:
@@ -520,17 +520,17 @@ What the default page builder does is to put TOC in the first row, the body in t
0 commit comments