generated from ns-rse/quarto-revealjs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.qmd
1470 lines (1218 loc) · 55.9 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "SheffieldR : Quarto for Slides"
author:
- name: Neil Shephard
orcid: 0000-0001-8301-6857
email: n.shephard@sheffield.ac.uk
affiliations: RSE, University of Sheffield
from: markdown+emoji
format:
clean-revealjs:
# revealjs:
# theme: solarized
incremental: false
scrollable: true
slide-number: true
show-slide-number: speaker
auto-stretch: false
chalkboard: true
# embed-resources: true
# standalone: true
revealjs-plugins:
- confetti
footer: "**Slides** : [**ns-rse.github.io/SheffieldR-quarto-for-slides**](https://ns-rse.github.io/SheffieldR-quarto-for-slides)"
project:
preview:
port: 7864
host: localhost
watch-inputs: true
---
## Scan This!
View Slides : [**ns-rse.github.io/SheffieldR-quarto-for-slides**](ns-rse.github.io/SheffieldR-quarto-for-slides)
{{< qrcode https://ns-rse.github.io/SheffieldR-quarto-for-slides width=400 height=400 >}}
::: {.notes}
You can go the URL [**ns-rse.github.io/SheffieldR-quarto-for-slides**](ns-rse.github.io/SheffieldR-quarto-for-slides) to
view the slides or if you use a browser on your phone which is synced with your desktop then you can scan this QR code
and send it to your laptops browser and it will take you to these slides.
:::
## Overview
+ Background
+ Prerequisites
+ Using a template
+ Necessary Changes
+ Initial Publish
+ Markdown (briefly)
+ Modifying slides
+ Publishing
::: {.notes}
I thought it might be useful to cover a bit of history with regards to the philosophy that underpins Quarto, then go
over a live example of how to use a template to make RevealJS Slides that are hosted on GitHub Pages and edit the
Markdown.
This _isn't_ an exposition of Markdown and writing Quarto documents, its more focused on working with and publishing
slides on GitHub.
:::
## Literate Programming - Origins
:::: {.columns}
::: {.column width="50%"}
> a computer program is given as an explanation of how it works in a natural language, such as English, interspersed
(embedded) with snippets of macros and traditional source code, from which compilable source code can be
generated.^[[Wikipedia - Literate programming](https://en.wikipedia.org/wiki/Literate_programming)]
:::
::: {.column width="50%"}
![[_Literate Programming_ - Donald Knuth](https://en.wikipedia.org/wiki/Literate_programming)](https://upload.wikimedia.org/wikipedia/en/6/62/Literate_Programming_book_cover.jpg)
:::
::::
::: {.notes}
Quarto and other languages like it such as RMarkdown and [Org-mode](https://orgmode.org) are literate programming
languages which may be an unfamiliar term so I've borrowed the definition from Wikipedia.
The idea was originally proposed and developed the computer scientist Donald Knuth, and he literally wrote the book on it.
:::
## Literate Programming - Better Programmes
:::: {.columns}
::: {.column width="50%"}
> My programs are not only explained better than ever before; they also are better programs, because the new methodology
encourages me to do a better job.^[[Knuth (1984)](http://www.literateprogramming.com/knuthweb.pdf)]
:::
::: {.column width="50%"}
![[_Literate Programming_ - Donald Knuth](https://en.wikipedia.org/wiki/Literate_programming)](https://upload.wikimedia.org/wikipedia/en/6/62/Literate_Programming_book_cover.jpg)
:::
::::
::: {.notes}
Whilst originating in computer science the principle has seen wide spread adoption in data science because it encourages
reproducible research and facilitates open access to research.
As Knuth found when he adopted the practice it _improved_ the quality of the programmes he wrote and I've found the same
is true when writing documents myself since adopting the practice over 20 years ago.
:::
## Background - Pedigree
+ [WEB](https://en.wikipedia.org/wiki/Web_(programming_system)) ([Knuth & Levy
(2001)](https://www-cs-faculty.stanford.edu/~knuth/cweb.html))
+ [noweb](https://en.wikipedia.org/wiki/Noweb)
+ [S](https://en.wikipedia.org/wiki/S_(programming_language)) ([Becker, Chambers & Wilks
(1988)](https://dl.acm.org/doi/abs/10.5555/43380))
+ [Sweave](https://web.archive.org/web/20100130021808/http://www.statistik.lmu.de/~leisch/Sweave/) ([Leisch
F. (2002a)](http://www.ci.tuwien.ac.at/~leisch/Sweave); [Leisch F
(2002b)](https://journal.r-project.org/articles/RN-2002-025/); [Leisch F
(2003)](https://journal.r-project.org/articles/RN-2003-013/))
+ [RMarkdown](https://rmarkdown.rstudio.com/) ([R Markdown: The Definitive Guide](https://bookdown.org/yihui/rmarkdown/))
. . .
+ :tada: [Quarto](https://quarto.org) :tada:
::: {.notes}
Quarto has a long pedigree and is the latest form of literate programming. Knuths WEB language was followed by a number
of variants most of which worked with his document preparation system [TeX](https://tug.org/). One of these dialects was
noweb and noweb underpinned an early integration of Tex/LaTeX and S code (S being the original language specification by
Becker, Chambers and Wilks which R is an implementation of) this was developed by Freidrich Liesch who wrote and
maintained the Sweave package.
More recently with the rise in popularity of Markdown, a simple form of markup language and the increase in popularity
of R saw the development of RMarkdown which some of you might be familiar with.
The last year or two have seen the development of and release of Quarto which is the next iteration and allows embedding
of not just R code within the document but other languages such as [Python](https://python.org),
[Julia](https://julialang.org) and [Observable](https://observablehq.com/) a data analysis and visualisation language in
JavaScript.
Part of the flexibility of Quarto is that its underpinned by [Pandoc](https://pandoc.org/) which is a powerful tool for
converting documents between different markup languages, including PDF and HTML.
:::
## Pre-requisites
Need a few things to get going...
. . .
+ [Git](https://git-scm.com)
+ [GitHub](https://github.com/) account (ideally academic `@<somewhere>.ac.uk`).
+ RStudio configured with Git^[[Let’s Git started | Happy Git and GitHub for the useR](https://happygitwithr.com/)] (or similar
e.g. [Emacs](https://www.gnu.org/software/emacs/)/[ESS](https://ess.r-project.org)/[Magit](https://magit.vc) or
[VSCode](https://code.visualstudio.com/)).
+ [Jupyter](https://jupyter.org/) if using Python.
+ Quarto [installed](https://quarto.org/docs/get-started/).
::: {.notes}
Ok, now that I've covered some of the background going to move on and hopefully demonstrate how to use Quarto to write
RevealJS slides that are hosted on GitHub and can be viewed in a web-browser. This has a number of advantages as you'll
never have to worry about getting your slides to meeting organisers, you just need a working internet connection which
these days is fairly common. As a consequence you can keep on working on your slides right up to the last minute (as
long as you remember to publish the changes!).
There are however a few pre-requisities for using this system. You need Git installed and a academic email address I'd
recommend signing up with that, you get a few more features that are usually reserved for paying customers.
You also need a development environment which will help make some of the tasks of editing files and working with Git
easier.
If you're not already set up with one I'd recommend RStudio which I'm going using today.
There is a really useful site from Jenny Bryan on how to setup and configure RStudio and Git
which I would recommend.
There are of course alternatives, personally I use Emacs with Emacs Speaks Statistics and
Magit, another popular choice is VSCode, but what you use is somewhat secondary, what I
hope to convey to you is the essence of the workflow and the principles of working in this manner.
Perhaps most importantly a willingness to learn comes in pretty handy, if you're new to this approach it will seem
frustrating to start with, but persevere, it gets easier and is a lot faster than copying and pasting figures and tables
into Word documents and then tweaking them or replacing them when data changes. As Donald Knuth said, its fun!
:::
## Quarto RevealJS Template
[Quarto RevealJS Template](https://github.com/ns-rse/quarto-revealjs-template) includes...
+ Sample slides with many examples.
+ [GitHub Workflow](https://docs.github.com/en/actions/using-workflows)to publish pages.
+ Instructions on usage.
+ Thanks to [David Wilby](https://www.davidwilby.dev/) and [Alex Coleman](https://github.com/Sparrow0hawk/).
[github.com/ns-rse/quarto-revealjs-template](https://github.com/ns-rse/quarto-revealjs-template)
::: {.notes}
To make it simple to use this workflow there is a Quarto RevealJS template in my GitHub repository that can be used.
It uses a [GitHub Workflow](https://docs.github.com/en/actions/using-workflows) and the `README.md` on the front page has
instructions on usage and I'm hoping to take you through this process today.
I have to say this isn't all my own work, I used a workflow my colleague David Wilby originally setup in for slides I
prepared for a talk I was invited to give in Leeds on using [pre-commit](https://pre-commit.com). The person who invited
me, Alex Coleman, liked the setup and used my slides as a basis for making a Template and I've then borrowed that back
and extended it to its current state.
:::
## Using Quarto RevealJS Template
:::: {.columns}
::: {.column width=30%}
+ Go to [github.com/ns-rse/quarto-revealjs-template](https://github.com/ns-rse/quarto-revealjs-template)
+ Make a copy to your account using the "_Use This Template_" button.
+ Give repository a unique name.
:::
::: {.column width=70%}
![Cloning the template](img/github_quarto_revealjs_template_front.png)
:::
::::
::: {.notes}
The first step to using this template is to make a copy to your GitHub account.
To do this go to the repository and find the _Use This Template_ which is on the top right in green, click on it and
you'll be prompted to give your repository a new and unique name. You can use anything you want as long as you don't
already have a repository with that name in your GitHub account.
:::
## Configuring Repository
:::: {.columns}
::: {.column width=40%}
+ _Settings > Actions > General > Workflow Permissions > Read and write_
:::
::: {.column width=60%}
![Changing Workflow Permissions](img/github_quarto_settings_action01.png){height="250"}
![Changing Workflow Permissions](img/github_quarto_settings_action02.png){height="250"}
:::
::::
::: {.notes}
A key change after cloning the repository is that you need to change the permissions so that the site will be published
automatically when you push changes to GitHub.
I'll explain more about how this works bit but because this is important and you're in GitHub after using the template I
find it good practice to make the change now so I don't forget to do it later and then end up scratching my head as to
why the slides haven't been published.
So you go to _Settings_ tab along the top, then in the menu on the left selection _Actions > General_. Scroll down and
you can change the _Workflow Permissions_ to _Read and Write permissions_ which allows [GitHub
Workflows])(<https://docs.github.com/en/actions/using-workflows>) to read and write to branches.
:::
## Cloning - URL
:::: {.columns}
::: {.column width="30%"}
+ Code button
:::
::: {.column width="70%"}
:::
![Getting repository URL for cloning](img/github_quarto_cloning.png)
::::
::: {.notes}
Now that you have copied the template to your account and have a repository of your own you will want to get a copy of
the files locally on your own computer. In Git parlance this is called cloning and on GitHub the green button at the top
of the front page of the repository allows you to copy links to clone a repository.
Whether use use `https` or `ssh` depends on how you've setup RStudio but the safest option is to use `https` (although
long term I would recommend configuring and using SSH keys as they are faster and easier).
:::
## RStudio Cloning - New Project
:::: {.columns}
::: {.column width="30%"}
+ _File > **New Project** > Version Control > Git_.^[[Let’s Git started | Happy Git and GitHub for the useR](https://happygitwithr.com/)]
:::
::: {.column width="70%"}
![New Project](img/rstudio_new_project_cloning1.png)
:::
::::
::: {.notes}
You now need to start a new Project in RStudio, from the File menu select New Project and the following dialog will
appear, select _Version Control_.
:::
## RStudio Cloning - Version Control
:::: {.columns}
::: {.column width="30%"}
+ _File > New Project > **Version Control** > Git_.^[[Let’s Git started | Happy Git and GitHub for the useR](https://happygitwithr.com/)]
:::
::: {.column width="70%"}
![New Project](img/rstudio_new_project_cloning2.png)
:::
::::
::: {.notes}
...and you progress to the next dialog. We are cloning a Git repository rather than Subversion so select Git.
:::
## RStudio Cloning - Git
:::: {.columns}
::: {.column width="30%"}
+ _File > New Project > Version Control > **Git**_.^[[Let’s Git started | Happy Git and GitHub for the useR](https://happygitwithr.com/)]
:::
::: {.column width="70%"}
![New Project](img/rstudio_new_project_cloning3.png)
:::
::::
::: {.notes}
You now need to use the URL you copied from GitHub and paste it into the _Repository URL_ field, you should give a
_Project directory name_ and typically this would be the same name that you gave your repository when you used the
template (you can copy and paste the last bit of the URL, removing the `.git` if you want).
The last field required is where to create the project and clone the repository to, this will depend on where you keep
your files.
:::
## Restore `renv`
+ [`renv`]() used for required packages.
+ Required packages in `renv.lock`.
``` {.r}
# Bootstrapping renv 1.0.3 ---------------------------------------------------
- Downloading renv ... OK
- Installing renv ... OK
- Project '~/work/git/hub/slackline/quarto-live-demo' loaded. [renv 1.0.3]
- One or more packages recorded in the lockfile are not installed.
- Use `renv::status()` for more details.
> renv::restore()
The following package(s) will be updated:
# CRAN -----------------------------------------------------------------------
- lattice [0.22-4 -> 0.21-8]
- base64enc [* -> 0.1-3]
- bslib [* -> 0.5.1]
- cachem [* -> 1.0.8]
- cli [* -> 3.6.1]
- colorspace [* -> 2.1-0]
- ellipsis [* -> 0.3.2]
- evaluate [* -> 0.21]
- fansi [* -> 1.0.4]
- farver [* -> 2.1.1]
- fastmap [* -> 1.1.1]
- fontawesome [* -> 0.5.2]
- ggplot2 [* -> 3.4.3]
- glue [* -> 1.6.2]
- gtable [* -> 0.3.4]
- highr [* -> 0.10]
- htmltools [* -> 0.5.6]
- isoband [* -> 0.2.7]
- jquerylib [* -> 0.1.4]
- labeling [* -> 0.4.3]
- lifecycle [* -> 1.0.3]
- magrittr [* -> 2.0.3]
- memoise [* -> 2.0.1]
- mime [* -> 0.12]
- munsell [* -> 0.5.0]
- pillar [* -> 1.9.0]
- pkgconfig [* -> 2.0.3]
- R6 [* -> 2.5.1]
- rappdirs [* -> 0.3.3]
- RColorBrewer [* -> 1.1-3]
- rmarkdown [* -> 2.25]
- sass [* -> 0.4.7]
- scales [* -> 1.2.1]
- stringi [* -> 1.7.12]
- stringr [* -> 1.5.0]
- tibble [* -> 3.2.1]
- tinytex [* -> 0.46]
- utf8 [* -> 1.2.3]
- viridisLite [* -> 0.4.2]
- withr [* -> 2.5.0]
- yaml [* -> 2.3.7]
# RSPM -----------------------------------------------------------------------
- digest [* -> 0.6.33]
- fs [* -> 1.6.3]
- jsonlite [* -> 1.8.7]
- knitr [* -> 1.44]
- rlang [* -> 1.1.1]
- vctrs [* -> 0.6.3]
- xfun [* -> 0.40]
Do you want to proceed? [Y/n]: y
# Installing packages --------------------------------------------------------
- Installing lattice ... OK [linked from cache]
- Installing R6 ... OK [linked from cache]
- Installing RColorBrewer ... OK [linked from cache]
- Installing base64enc ... OK [linked from cache]
- Installing rlang ... OK [linked from cache]
- Installing fastmap ... OK [linked from cache]
- Installing cachem ... OK [linked from cache]
- Installing digest ... OK [linked from cache]
- Installing ellipsis ... OK [linked from cache]
- Installing htmltools ... OK [linked from cache]
- Installing jquerylib ... OK [linked from cache]
- Installing jsonlite ... OK [linked from cache]
- Installing memoise ... OK [linked from cache]
- Installing mime ... OK [linked from cache]
- Installing fs ... OK [linked from cache]
- Installing rappdirs ... OK [linked from cache]
- Installing sass ... OK [linked from cache]
- Installing bslib ... OK [linked from cache]
- Installing cli ... OK [linked from cache]
- Installing colorspace ... OK [linked from cache]
- Installing evaluate ... OK [linked from cache]
- Installing fansi ... OK [linked from cache]
- Installing farver ... OK [linked from cache]
- Installing fontawesome ... OK [linked from cache]
- Installing glue ... OK [linked from cache]
- Installing lifecycle ... OK [linked from cache]
- Installing gtable ... OK [linked from cache]
- Installing isoband ... OK [linked from cache]
- Installing labeling ... OK [linked from cache]
- Installing munsell ... OK [linked from cache]
- Installing viridisLite ... OK [linked from cache]
- Installing scales ... OK [linked from cache]
- Installing magrittr ... OK [linked from cache]
- Installing utf8 ... OK [linked from cache]
- Installing vctrs ... OK [linked from cache]
- Installing pillar ... OK [linked from cache]
- Installing pkgconfig ... OK [linked from cache]
- Installing tibble ... OK [linked from cache]
- Installing withr ... OK [linked from cache]
- Installing ggplot2 ... OK [linked from cache]
- Installing xfun ... OK [linked from cache]
- Installing highr ... OK [linked from cache]
- Installing yaml ... OK [linked from cache]
- Installing knitr ... OK [linked from cache]
- Installing stringi ... OK [linked from cache]
- Installing stringr ... OK [linked from cache]
- Installing tinytex ... OK [linked from cache]
- Installing rmarkdown ... OK [linked from cache]
>
```
::: {.notes}
As this is an R user group its pertinent to focus on using Quarto with R, even though it supports embedding code in
other languages such as Python, Julia and Obesrvable, but the principles transcend the language as most rely heavily on
packages and for work to be reproducible you need to install the packages that are used.
In R this is done using the [`renv`](https://rstudio.github.io/renv/) package which creates a `renv.lock` detailing
the installed packages along with a `.Rprofile` which runs a script `renv/activate.R` that together restore environments
on loading a new project. However, your system needs to install the required packages within the directory initially and
this is done using `renv::restore()`.
This may take a little while depending on your system and its possible, if you use Windows and have an old, outdated
version of R installed that it won't install at all since Microsoft stopped providing all package version for all
versions of R on their MRAN archive. If this happens try updating to the latest version of R and repeating this step.
Perhaps this is a natural point to have a short pause and ask if there are any questions?
If there aren't any then we can carry on and instal themes and extensions locally.
:::
## Install Themes and Extensions
+ Themes and extensions need installing
``` {.bash}
quarto install --no-prompt extension jmbuhr/quarto-qrcode
quarto install --no-prompt extension grantmcdermott/quarto-revealjs-clean
quarto install --no-prompt extension ArthurData/quarto-confetti
```
::: {.notes}
These slides use some extensions for generating QR codes and making Confetti and a custom theme. I'll explain more about
extensions and themes in a bit but before you can proceed you need to install the themes on your computer.
:::
## Configuration : `_quarto.yaml`
+ Define project type (`website`)
+ Set `title`, `site-url` and `description`
:::: {.columns}
::: {.column width="50%"}
**Before**
``` {.yaml}
project:
type: website
website:
title: "<TITLE>"
site-url: https://<YOUR_GITHUB_USERNAME>.github.io/<NAME_OF_REPOSITORY>
description: "Using Quarto to make slides"
```
:::
::: {.column width="50%"}
**After**
``` {.yaml}
project:
type: website
website:
title: "SheffieldR - Live Demo!"
site-url: https://slackline.github.io/quarto-live-demo
description: "A Live Demo of How to use Quarto RevealJS Template"
```
:::
::::
::: {.notes}
You will want to configure the slides to your own taste or preferences.
This is done via two files the first is `_quarto.yaml` file which allows you to define the project type, which in this
case is a website and you can set the `title`, `site-url` and `description`.
:::
## `index.qmd` YAML Header
``` {.yaml}
---
title: "SheffieldR - Live Demo!"
author:
- name: Neil Shephard
orcid: 0000-0001-8301-6857
email: n.shephard@sheffield.ac.uk
affiliations: RSE, University of Sheffield
from: markdown+emoji
format:
clean-revealjs:
incremental: false
scrollable: true
slide-number: true
show-slide-number: speaker
auto-stretch: false
chalkboard: true
# embed-resources: true
# standalone: true
revealjs-plugins:
- confetti
footer: "**Slides** : [**slackline.github.io/quarto-live-demo**](https://slackline.github.io/quarto-live-demo)"
project:
preview:
port: 7864
host: localhost
watch-inputs: true
---
```
::: {.notes}
The other file that settings reside in is the YAML header of `index.qmd` such as the author details,
footer, what extensions or plugins are used and so forth. So open up the `index.qmd** and start editing this header.
Put your name, your ORCiD number, email address and affiliation. The rest you can mostly leave in place but you will
probably want to change the footer as its useful for the audience to see the URL where they can view the slides at all
times.
You also use this file to define other common slide properties such as the theme, whether bullet points are to appear
incrementally, whether to include the chalkboard feature which is enabled for these slides and introduces a button here
to bring up a chalk board which you can write on. You also define common footers in this file.
**NB** I have two git accounts with different SSH keys so need to tweak my `.git/config` to make sure the correct key is
used.
```
[core]
sshCommand = ssh -i ~/.ssh/id_ed25519 -F /dev/null
```
:::
<!-- ## Initial Publish -->
<!-- + `quarto publish` -->
<!-- + Select `Github Pages` if asked (may depend on Quarto version). -->
<!-- + Creates a special branch `gh-pages` which holds HTML. -->
<!-- + Pushes branch to GitHub. -->
<!-- + View slides at -->
<!-- [https://<username>.github.io/my_first_quarto_slides/](https://ns-rse.github.io/my_first_quarto_slides/) -->
<!-- ::: {.notes} -->
<!-- You've used a template and created a repository in your GitHub account and configured it to publish pages, cloned it -->
<!-- to your local computer and installed the themes and extensions. The next step is to make an initial publish of your -->
<!-- pages. -->
<!-- This is done using the `quarto publish` command. It creates a special branch in your Git repository called `gh-pages` -->
<!-- which contains the HTML output. It then pushes the branch to GitHub, configuring it to make the pages on pushes. -->
<!-- You can then view the slides at a dedicated URL. This will depend on your username and the name you gave to your copy of -->
<!-- the template when you used it, but its a consistent nomenclature for the paths so fairly easy to remember. -->
<!-- ::: -->
## Initial Publish
:::: {.columns}
::: {.column width="30%"}
``` {.bash}
❱ quarto publish
? Provider:
Quarto Pub
❯ GitHub Pages
Posit Connect
Netlify
Confluence
```
:::
::: {.column width="70%"}
``` {.bash}
❱ quarto publish
? Provider: › GitHub Pages
? Publish site to https://slackline.github.io/quarto-live-demo using gh-pages? (Y/n) › Yes
Saved working directory and index state WIP on main: 822f892 Initial commit
Switched to a new branch 'gh-pages'
[gh-pages (root-commit) 02fbb7b] Initializing gh-pages branch
remote:
remote: Create a pull request for 'gh-pages' on GitHub by visiting:
remote: https://github.com/slackline/quarto-live-demo/pull/new/gh-pages
remote:
To github.com:slackline/quarto-live-demo.git
* [new branch] HEAD -> gh-pages
Your branch is up to date with 'origin/main'.
Switched to branch 'main'
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .gitignore
modified: _quarto.yml
modified: index.qmd
Untracked files:
(use "git add <file>..." to include in what will be committed)
quarto-live-demo.Rproj
no changes added to commit (use "git add" and/or "git commit -a")
From github.com:slackline/quarto-live-demo
* branch gh-pages -> FETCH_HEAD
Rendering for publish:
processing file: index.qmd
1/5
2/5 [fig-airquality]
3/5
4/5 [fig-airquality2]
5/5
output file: index.knit.md
pandoc
to: revealjs
from: markdown+emoji
output-file: index.html
standalone: true
title-prefix: SheffieldR - Live Demo!
wrap: none
default-image-extension: png
html-math-method:
method: mathjax
url: >-
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML-full
slide-level: 2
incremental: false
metadata
link-citations: true
width: 1050
height: 700
margin: 0.1
center: false
navigationMode: linear
controlsLayout: edges
controlsTutorial: false
hash: true
history: true
hashOneBasedIndex: false
fragmentInURL: false
transition: none
backgroundTransition: none
pdfSeparateFragments: false
lang: en
auto-stretch: false
theme:
- default
- _extensions/grantmcdermott/clean/clean.scss
menu:
side: left
slideNumber: true
date-format: long
revealjs-plugins:
- confetti
title: 'Quarto Live Demo! :tada:'
author:
- name: Neil Shephard
orcid: 0000-0001-8301-6857
email: n.shephard@sheffield.ac.uk
affiliations: 'RSE, University of Sheffield'
footer: '**Slides** : [**slackline.github.io/quarto-live-demo**](https://github-username.github.io/<repository>)'
showSlideNumber: speaker
chalkboard: true
branch 'gh-pages' set up to track 'origin/gh-pages'.
HEAD is now at 02fbb7b Initializing gh-pages branch
Preparing worktree (resetting branch 'gh-pages'; was at 02fbb7b)
fatal: pathspec '.' did not match any files
[gh-pages d22f205] Built site for gh-pages
125 files changed, 15420 insertions(+)
create mode 100644 .nojekyll
create mode 100644 img/OSC_Sheffield.png
create mode 100644 index.html
create mode 100644 index_files/figure-revealjs/fig-airquality2-1.png
create mode 100644 robots.txt
create mode 100644 search.json
create mode 100644 site_libs/clipboard/clipboard.min.js
create mode 100644 site_libs/quarto-contrib/qrcodejs-v1.0.0/qrcode.js
create mode 100644 site_libs/quarto-html/light-border.css
create mode 100644 site_libs/quarto-html/popper.min.js
create mode 100644 site_libs/quarto-html/quarto-html.min.css
create mode 100644 site_libs/quarto-html/quarto-syntax-highlighting.css
create mode 100644 site_libs/quarto-html/tabby.min.js
create mode 100644 site_libs/quarto-html/tippy.css
create mode 100644 site_libs/quarto-html/tippy.umd.min.js
create mode 100644 site_libs/revealjs/dist/reset.css
create mode 100644 site_libs/revealjs/dist/reveal.css
create mode 100644 site_libs/revealjs/dist/reveal.esm.js
create mode 100644 site_libs/revealjs/dist/reveal.esm.js.map
create mode 100644 site_libs/revealjs/dist/reveal.js
create mode 100644 site_libs/revealjs/dist/reveal.js.map
create mode 100644 site_libs/revealjs/dist/theme/fonts/league-gothic/LICENSE
create mode 100644 site_libs/revealjs/dist/theme/fonts/league-gothic/league-gothic.css
create mode 100755 site_libs/revealjs/dist/theme/fonts/league-gothic/league-gothic.eot
create mode 100755 site_libs/revealjs/dist/theme/fonts/league-gothic/league-gothic.ttf
create mode 100755 site_libs/revealjs/dist/theme/fonts/league-gothic/league-gothic.woff
create mode 100644 site_libs/revealjs/dist/theme/fonts/source-sans-pro/LICENSE
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-italic.eot
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-italic.ttf
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-italic.woff
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-regular.eot
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-regular.ttf
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-regular.woff
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.eot
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.ttf
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.woff
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.eot
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.ttf
create mode 100755 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.woff
create mode 100644 site_libs/revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro.css
create mode 100644 site_libs/revealjs/dist/theme/quarto.css
create mode 100644 site_libs/revealjs/plugin/highlight/highlight.esm.js
create mode 100644 site_libs/revealjs/plugin/highlight/highlight.js
create mode 100644 site_libs/revealjs/plugin/highlight/monokai.css
create mode 100644 site_libs/revealjs/plugin/highlight/plugin.js
create mode 100644 site_libs/revealjs/plugin/highlight/zenburn.css
create mode 100644 site_libs/revealjs/plugin/markdown/markdown.esm.js
create mode 100644 site_libs/revealjs/plugin/markdown/markdown.js
create mode 100755 site_libs/revealjs/plugin/markdown/plugin.js
create mode 100755 site_libs/revealjs/plugin/math/katex.js
create mode 100644 site_libs/revealjs/plugin/math/math.esm.js
create mode 100644 site_libs/revealjs/plugin/math/math.js
create mode 100644 site_libs/revealjs/plugin/math/mathjax2.js
create mode 100644 site_libs/revealjs/plugin/math/mathjax3.js
create mode 100644 site_libs/revealjs/plugin/math/plugin.js
create mode 100644 site_libs/revealjs/plugin/notes/notes.esm.js
create mode 100644 site_libs/revealjs/plugin/notes/notes.js
create mode 100644 site_libs/revealjs/plugin/notes/plugin.js
create mode 100644 site_libs/revealjs/plugin/notes/speaker-view.html
create mode 100644 site_libs/revealjs/plugin/pdf-export/pdfexport.js
create mode 100644 site_libs/revealjs/plugin/pdf-export/plugin.yml
create mode 100644 site_libs/revealjs/plugin/quarto-line-highlight/line-highlight.css
create mode 100644 site_libs/revealjs/plugin/quarto-line-highlight/line-highlight.js
create mode 100644 site_libs/revealjs/plugin/quarto-line-highlight/plugin.yml
create mode 100644 site_libs/revealjs/plugin/quarto-support/footer.css
create mode 100644 site_libs/revealjs/plugin/quarto-support/plugin.yml
create mode 100644 site_libs/revealjs/plugin/quarto-support/support.js
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/README.md
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/LICENSE.txt
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/all.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/brands.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/fontawesome.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/regular.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/solid.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/svg-with-js.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/v4-shims.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/v4-shims.min.css
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-brands-400.eot
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-brands-400.svg
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-brands-400.ttf
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-brands-400.woff
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-brands-400.woff2
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-regular-400.eot
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-regular-400.svg
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-regular-400.ttf
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-regular-400.woff
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-regular-400.woff2
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-solid-900.eot
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-solid-900.svg
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-solid-900.ttf
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-solid-900.woff
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/font-awesome/webfonts/fa-solid-900.woff2
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/blackboard.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/boardmarker-black.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/boardmarker-blue.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/boardmarker-green.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/boardmarker-orange.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/boardmarker-purple.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/boardmarker-red.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/boardmarker-yellow.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/chalk-blue.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/chalk-green.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/chalk-orange.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/chalk-purple.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/chalk-red.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/chalk-white.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/chalk-yellow.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/sponge.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/img/whiteboard.png
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/plugin.js
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/plugin.yml
create mode 100644 site_libs/revealjs/plugin/reveal-chalkboard/style.css
create mode 100644 site_libs/revealjs/plugin/reveal-confetti/confetti.js
create mode 100644 site_libs/revealjs/plugin/reveal-menu/menu.css
create mode 100644 site_libs/revealjs/plugin/reveal-menu/menu.js
create mode 100644 site_libs/revealjs/plugin/reveal-menu/plugin.yml
create mode 100644 site_libs/revealjs/plugin/reveal-menu/quarto-menu.css
create mode 100644 site_libs/revealjs/plugin/reveal-menu/quarto-menu.js
create mode 100644 site_libs/revealjs/plugin/search/plugin.js
create mode 100644 site_libs/revealjs/plugin/search/search.esm.js
create mode 100644 site_libs/revealjs/plugin/search/search.js
create mode 100644 site_libs/revealjs/plugin/zoom/plugin.js
create mode 100644 site_libs/revealjs/plugin/zoom/zoom.esm.js
create mode 100644 site_libs/revealjs/plugin/zoom/zoom.js
create mode 100644 sitemap.xml
origin git@github.com:slackline/quarto-live-demo.git (fetch)
origin git@github.com:slackline/quarto-live-demo.git (push)
To github.com:slackline/quarto-live-demo.git
02fbb7b..d22f205 HEAD -> gh-pages
[✓] Deploying gh-pages branch to website (this may take a few minutes)
[✓] Published to https://slackline.github.io/quarto-live-demo
```
:::
::::
::: {.notes}
Next we're going to use the `quarto publish` command which makes the initial publishing for us, creating the
`gh-pages` branch, rendering the pages and pushing them to GitHub. This should complete ok and once its done you can
navigate to your [repository](https://github.com/slackline/quarto-demo) and look at the `Actions` tab and hopefully see the
pages being deployed.
Once this completes you should have a browser tab open up with your pages in them.
For those following along have how many have been able to publish their slides?
:::
## Slides : `index.qmd`
+ _Now_ you can write your slides!
+ `index.qmd` is the main file to work on.
+ Template includes many examples.
::: {.notes}
Ok we've cloned the template and customised it to work under our account, setup a `gh-pages` branch and pushed the
changes and they are published and we have our website, _now_ you are finally ready to start writing your slides and
customising them.
In addition to the YAML header the `index.qmd` contains the contents of your slides.
The body is written in Quarto Markdown which is pretty similar to general Markdown.
:::
## Markdown
+ Simple markup language.
+ Separate content from style.
+ Write in ASCII plain text.
+ Simple to version control.
::: {.notes}
Ok we'll now make a very brief digression into Markdown because Quarto uses its own dialect of Markdown which is a
relatively simple markup language.
Markup languages differ from Word Processor software such as Microsoft Word and Google Docs as they separate the content
that you are writing from the style, which is how it looks because you write in ASCII plain text and adorn the text
with markers which indicate what it should look like and then apply themes to say what certain features should look
like.
Plain text files have the advantage that they are simple to keep under version control which also means they are easy to
work on collaboratively using tools such as [GitHub](https://github.com) or [GitLab](https://gitlab.com).
:::
## Basic Markdown
:::: {.columns}
::: {.column width="50%"}
``` {.markdown}
+ **Bold**
+ _Italics_
+ ~~Strikethrough~~
+ [Search](https://duckduckgo.com)
```
:::
::: {.column width="50%"}
+ **Bold**
+ _Italics_
+ ~~Strikethrough~~
+ [Search](https://duckduckgo.com)
:::
::::
Quarto [documentation](https://quarto.org/docs/authoring/markdown-basics.html) is excellent.
## QR Code Extension
+ [quarto-qrcode](https://github.com/jmbuhr/quarto-qrcode) extension is really useful.
<!-- :::: {.columns} -->
<!-- ::: {.column width="50%"} -->
**Before**
``` {.markdown}
\{{< qrcode https://ns-rse.github.io/quarto-revealjs-template qr1 width=400 height=400 >}\}
[ns-rse.github.io/quarto-revealjs-template](https://ns-rse.github.io/quarto-revealjs-template)
```
<!-- ::: -->
<!-- ::: {.column width="50%"} -->
**After**
``` {.markdown}
\{{< qrcode https://ns-rse.github.io/quarto-live-demo qr1 width=400 height=400 >}\}
[slackline.github.io/quarto-live-demo](https://slackline.github.io/quarto-live-demo)
```
**NB** The `\` before the `\{` and `\}` are **NOT** required, I had to escape them to get them to render.
<!-- ::: -->
<!-- :::: -->
::: {.notes}
We can update the QR-code references to point to our new site as we wouldn't want viewers going to the wrong site!
:::
## Images
+ Embed Images (any image on the internet or locally)
<!-- :::: {.columns} -->
<!-- ::: {.column width="50%"} -->
**Before**
``` {.markdown}
![Relaxing in the mountains](https://live.staticflickr.com/65535/53144704609_c5e6fa8c77_k.jpg){width=700}
```
<!-- ::: -->
<!-- ::: {.column width="50%"} -->
**After**
``` {.markdown}
![SheffieldR Hex](https://raw.githubusercontent.com/SheffieldR/SheffieldR.github.io/main/images/SheffieldR_hex.png){width=400}
```
<!-- ::: -->
<!-- :::: -->
::: {.notes}
On line 162 there is an image embedded, a picture I snapped whilst relaxing on a hiking holiday in the Julian Alps this
summer.
We can modify this and change the embeded image by simply changing the target URL for the image.
Here I insert the Sheffield R Hex image instead `https://github.com/SheffieldR/SheffieldR.github.io/blob/main/images/SheffieldR_hex.png?raw=true`
:::
::: {.notes}
Lets change the first slide to show an image.
:::
## Previewing
:::: {.columns}
::: {.colum width="30%"}
+ Preview slides locally whenever you want using `quarto preview`.
+ Renders files locally and opens them in a new browser tab.
+ **Use regularly when writing your slides!**
:::
::: {.colum width="70%"}