Skip to content

Commit 1d3f5c5

Browse files
authored
Port from bookdown to quarto (#365)
* use yaml formatted chunk options * enforce sentence-level markdown wraping locally * ignore *_cache and *_files folders * canonicalise facets chapter markdown * replace _bookdown.yml and _output.yml with _quarto.yml * canonicalise getting-started * fixes level 1 headers in chapter files * spurious newline diffs * canonicalise references * remove yaml header and canonicalise index.Rmd * use quarto on gh actions * use @ notation for cross-references and sec- prefix for section labels * restore references.Rmd to document structure * tweak heading to fix inscrutable quarto bug * removes columns() function, uses quarto layout-ncols instead * adds status() function and set.seed() to common.R, and updates chapter headings * remove refs chapter (each chapter has its own refs) * fix broken crossrefs * adds "welcome to part" file for part 1 * removes status note from part headers where it makes no sense to have one * tentatively assign some chapters to status: polishing * removes spurious heading * fixes silly mistakes in the gh actions
1 parent 3e6b51e commit 1d3f5c5

38 files changed

+1685
-1387
lines changed

.github/workflows/bookdown.yaml renamed to .github/workflows/build_book.yaml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,54 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2-
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
31
on:
42
push:
5-
branches: [main, master]
3+
branches: main
64
pull_request:
7-
branches: [main, master]
5+
branches: main
6+
# to be able to trigger a manual build
7+
workflow_dispatch:
88
schedule:
99
# run every day at 11 PM
1010
- cron: '0 23 * * *'
1111

12-
name: bookdown
12+
name: Render and deploy Book to Netlify
13+
14+
env:
15+
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }}
16+
RUST_BACKTRACE: 1
1317

1418
jobs:
15-
bookdown:
19+
build-deploy:
1620
runs-on: ubuntu-latest
1721
env:
1822
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
19-
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }}
20-
2123
steps:
2224
- uses: actions/checkout@v3
2325

24-
- uses: r-lib/actions/setup-pandoc@v2
26+
- name: Install Quarto
27+
uses: quarto-dev/quarto-actions/install-quarto@v1
28+
with:
29+
# To install LaTeX to build PDF book
30+
tinytex: true
31+
# uncomment below and fill to pin a version
32+
# version: 0.9.105
2533

2634
- uses: r-lib/actions/setup-r@v2
2735
with:
2836
use-public-rspm: true
2937

3038
- uses: r-lib/actions/setup-r-dependencies@v2
3139

32-
- name: Cache bookdown results
33-
uses: actions/cache@v3
34-
with:
35-
path: _bookdown_files
36-
key: bookdown-${{ hashFiles('**/*Rmd') }}
37-
restore-keys: bookdown-
38-
39-
- name: Build site
40-
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
40+
- name: Render book to all format
41+
# Add any command line argument needed
42+
run: |
43+
quarto render
4144
4245
- name: Deploy to Netlify
4346
if: contains(env.isExtPR, 'false')
4447
id: netlify-deploy
4548
uses: nwtgck/[email protected]
4649
with:
4750
publish-dir: './_book'
48-
production-branch: master
51+
production-branch: main
4952
github-token: ${{ secrets.GITHUB_TOKEN }}
5053
deploy-message:
5154
'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})'

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.Rproj.user
44
.Rhistory
55
book/ggplot2-book.pdf
6-
_cache
76
temp.Rmd
87
rsconnect
98
www
@@ -17,3 +16,8 @@ _main.aux
1716
_main.idx
1817
_main.out
1918
_main.toc
19+
20+
/.quarto/
21+
*_cache
22+
*_files
23+
_main.Rmd

_bookdown.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

_output.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

_quarto.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
project:
2+
type: book
3+
output-dir: _book
4+
5+
book:
6+
title: "ggplot2: Elegant Graphics for Data Analysis (3e)"
7+
reader-mode: true
8+
9+
page-footer:
10+
left: |
11+
ggplot2: Elegant Graphics for Data Analysis (3e) was written by
12+
Hadley Wickham, Danielle Navarro, and Thomas Lin Pedersen.
13+
right: |
14+
This book was built with <a href="https://quarto.org/">Quarto</a>.
15+
cover-image: cover.jpg
16+
favicon: cover.jpg
17+
site-url: https://ggplot2-book.org/
18+
repo-url: https://github.com/hadley/ggplot2-book/
19+
repo-branch: main
20+
repo-actions: [edit, issue]
21+
chapters:
22+
- index.Rmd
23+
24+
- preface-3e.Rmd
25+
- preface-2e.Rmd
26+
27+
- part: start.Rmd
28+
chapters:
29+
- introduction.Rmd
30+
- getting-started.Rmd
31+
32+
- part: toolbox.Rmd
33+
chapters:
34+
- individual-geoms.Rmd
35+
- collective-geoms.Rmd
36+
- statistical-summaries.Rmd
37+
- maps.Rmd
38+
- networks.Rmd
39+
- annotations.Rmd
40+
- arranging-plots.Rmd
41+
42+
- part: scales.Rmd
43+
chapters:
44+
- scales-position.Rmd
45+
- scales-colour.Rmd
46+
- scales-other.Rmd
47+
48+
- part: mastery.Rmd
49+
chapters:
50+
- layers.Rmd
51+
- scales-guides.Rmd
52+
- coord.Rmd
53+
- facet.Rmd
54+
- themes.Rmd
55+
56+
- part: extending.Rmd
57+
chapters:
58+
- programming.Rmd
59+
- internals.Rmd
60+
- extensions.Rmd
61+
- ext-springs.Rmd
62+
63+
bibliography: references.bib
64+
65+
format:
66+
html:
67+
theme:
68+
- cosmo
69+
code-link: true
70+
71+
author-meta: "Hadley Wickham, Danielle Navarro, and Thomas Lin Pedersen"
72+
include-in-header: "ga_script.html"
73+
callout-appearance: simple
74+
75+
editor: visual
76+

0 commit comments

Comments
 (0)