-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathideas.html
More file actions
852 lines (817 loc) · 47.8 KB
/
Copy pathideas.html
File metadata and controls
852 lines (817 loc) · 47.8 KB
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.10.18">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Grok ideas</title>
<style>
/* Default styles provided by pandoc.
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
*/
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: 1.5em;}
div.column{flex: auto;}
@media screen {
div.columns{gap: min(4vw, 1.5em);}
div.column{overflow-x: auto;}
}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="site_libs/quarto-nav/quarto-nav.js"></script>
<script src="site_libs/clipboard/clipboard.min.js"></script>
<script src="site_libs/quarto-search/autocomplete.umd.js"></script>
<script src="site_libs/quarto-search/fuse.min.js"></script>
<script src="site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="./">
<script src="site_libs/quarto-html/quarto.js" type="module"></script>
<script src="site_libs/quarto-html/tabsets/tabsets.js" type="module"></script>
<script src="site_libs/quarto-html/popper.min.js"></script>
<script src="site_libs/quarto-html/tippy.umd.min.js"></script>
<script src="site_libs/quarto-html/anchor.min.js"></script>
<link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
<link href="site_libs/quarto-html/quarto-syntax-highlighting-64a204ab8560d761af7679ceaba22944.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="site_libs/bootstrap/bootstrap.min.js"></script>
<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="site_libs/bootstrap/bootstrap-d0cfe7a3482e0d49a74229a8f3b76718.min.css" rel="stylesheet" append-hash="true" id="quarto-bootstrap" data-mode="light">
<script id="quarto-search-options" type="application/json">{
"location": "sidebar",
"copy-button": false,
"collapse-after": 3,
"panel-placement": "start",
"type": "textbox",
"limit": 50,
"keyboard-shortcut": [
"f",
"/",
"s"
],
"show-item-context": false,
"language": {
"search-no-results-text": "No results",
"search-matching-documents-text": "matching documents",
"search-copy-link-title": "Copy link to search",
"search-hide-matches-text": "Hide additional matches",
"search-more-match-text": "more match in this document",
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-text-placeholder": "",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit",
"search-label": "Search"
}
}</script>
<script async="" src="https://www.googletagmanager.com/gtag/js?id=G-8ZE61PCXCP"></script>
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-8ZE61PCXCP', { 'anonymize_ip': true});
</script>
</head>
<body class="fullcontent quarto-light">
<div id="quarto-search-results"></div>
<!-- content -->
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
<!-- sidebar -->
<!-- margin-sidebar -->
<!-- main -->
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Grok ideas</h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<p>I’ll start by reviewing your repo so suggestions complement what you’ve already taught.The repo index is incomplete, so I’ll pull titles from the yearly folders and recent Quarto feature notes next.I’ll sample recent session files and look up your public listings so suggestions don’t repeat old episodes.A few more session titles should show what’s already been covered.Your series already covers a lot of the “how do I make nice RevealJS + Quarto artifacts” ground: books, APA Quarto, Mermaid, OJS, Typst (at least an intro), layouts, tables, GitHub, Positron, Pluto, Excalidraw, PRISMA diagrams, and several presentation extensions. The highest-leverage next sessions are the <strong>project types and authoring features that landed after the early Quarto years</strong>, plus a few extension/workflow topics that fit an Open Office Hours format.</p>
<section id="highest-value-new-capability-sessions" class="level2">
<h2 class="anchored" data-anchor-id="highest-value-new-capability-sessions">Highest-value “new capability” sessions</h2>
<p>These are the ones I would schedule first. Each is a full Tuesday, not a sidebar.</p>
<ol type="1">
<li><p><strong>Quarto Dashboards</strong><br>
<code>format: dashboard</code> is still the biggest format many R Markdown users have not used. Cover pages, rows/columns, tabsets, value boxes, sidebar inputs, and when to use static htmlwidgets vs Shiny vs Shinylive. A psychometric “scale dashboard” (item means, reliability, group comparisons) would feel native to your audience.</p></li>
<li><p><strong>Quarto Manuscripts</strong><br>
Scholarly article as a project type: article + computational notebooks as the published record, not just a PDF. Good contrast with the APA Quarto session you already did. Show one manuscript that emits HTML + PDF/Typst + embedded notebook outputs.</p></li>
<li><p><strong><code>brand.yml</code> and brand extensions</strong><br>
One brand file driving HTML, RevealJS, dashboard, and Typst/PDF. Light/dark colors, logos, typography, <code>brand-mode: dark</code> for slides, and packaging a reusable brand extension. This is a very visual live-coding session.</p></li>
<li><p><strong>Quarto Live / WebR exercises</strong><br>
Interactive R (and Python) cells that run in the browser inside HTML docs and RevealJS. This is the natural sequel to OJS: same “live in the slide” energy, but with R syntax your viewers already know. Great for homework, workshops, and self-paced labs.</p></li>
<li><p><strong>Shinylive for R in Quarto</strong><br>
Embed a small Shiny app that runs client-side. Pair it with a dashboard session rather than treating it as a separate stack. Keep the app tiny (one slider, one plot, one table) so the lesson stays about authoring, not app architecture.</p></li>
<li><p><strong>Light/dark renderings</strong><br>
Plots and tables that have separate light and dark versions, plus <code>respect-user-color-scheme</code>. Perfect if you already theme slides aggressively. Show ggplot2 and <code>gt</code> side by side.</p></li>
<li><p><strong>LLM-friendly website output</strong><br>
Quarto 1.9’s machine-readable site output. A practical angle: “make your course site or methods site easy for students <em>and</em> tools to query.” Good companion to your GitHub Pages migration.</p></li>
<li><p><strong>HTML accessibility checks</strong><br>
The built-in <code>axe</code> option, offline checking, WCAG targeting. Live-audit one of your existing decks. That is both new and immediately useful for a teaching series.</p></li>
</ol>
</section>
<section id="authoring-features-that-still-teach-well-live" class="level2">
<h2 class="anchored" data-anchor-id="authoring-features-that-still-teach-well-live">Authoring features that still teach well live</h2>
<p>These are less “new format,” more “people still fumble these.”</p>
<ol start="9" type="1">
<li><p><strong>Custom cross-references</strong><br>
Div syntax, custom types in YAML, cross-referenceable listings (<code>lst-label</code> / <code>lst-cap</code>), callouts, remarks/solutions. Psychometrics-friendly demo: hypotheses, items, scales, and figures all numbered consistently.</p></li>
<li><p><strong>Code annotations</strong><br>
Line-level comments that survive HTML and PDF. Better than dumping a wall of code on a slide.</p></li>
<li><p><strong><code></code> and document surgery</strong><br>
Move an executed figure or table without duplicating the chunk. Useful for “results first, code later” reports.</p></li>
<li><p><strong>Landscape blocks</strong><br>
<code>.landscape</code> sections in <code>docx</code>, PDF, and Typst. One wide correlation matrix or CFA diagram makes the point instantly.</p></li>
<li><p><strong>List tables</strong><br>
Complex tables written as nested lists instead of pipe tables. Good for APA-ish multi-header tables without fighting Markdown.</p></li>
<li><p><strong>Lightbox figures</strong><br>
Now built in. Galleries of path diagrams, item maps, or residual plots with captions and grouping.</p></li>
<li><p><strong>Conditional content</strong><br>
<code>when-format</code>, <code>.content-visible</code>, <code>.content-hidden</code> for one source that is a workshop handout, slide deck, and solution key.</p></li>
<li><p><strong>Profiles</strong><br>
<code>quarto render --profile student</code> vs <code>--profile instructor</code>. Same project, different execute/include settings.</p></li>
<li><p><strong>Parameterized reports from one <code>.qmd</code></strong><br>
Params for class section, dataset, or scale. Then <code>quarto render</code> in a loop. This is still the most practical literate-programming workflow for applied researchers.</p></li>
<li><p><strong>Rendering R scripts</strong><br>
<code>knitr::spin()</code>-style scripts as reports. Nice for “I already have an analysis script, I do not want a notebook yet.”</p></li>
<li><p><strong>The <code>quarto</code> R package as an API</strong><br>
Pass R objects into YAML metadata, render from scripts, build project-relative paths, insert Markdown into HTML tables. This is the missing glue episode for people who live in R but treat Quarto as a button.</p></li>
</ol>
</section>
<section id="extensions-worth-a-dedicated-night" class="level2">
<h2 class="anchored" data-anchor-id="extensions-worth-a-dedicated-night">Extensions worth a dedicated night</h2>
<p>You already use callouts, snow, quizzes, accordion, reveal-header, and Iconify. These would not feel like repeats:</p>
<ol start="20" type="1">
<li><p><strong>Write a tiny extension live</strong><br>
A shortcode (<code>{{< item 12 >}}</code>) or a Lua filter that turns a div into a formatted scale-item card. This demystifies <code>_extensions/</code> better than installing five more.</p></li>
<li><p><strong>Brand extension + custom format</strong><br>
Package your course look as something students can <code>quarto add</code>.</p></li>
<li><p><strong>RevealJS “presenter power tools”</strong><br>
Jump-to-slide, scroll view, chalkboard/notes, multiplex, pointer, attribution. You have done a lot of slide chrome; this is the remaining presenter-ops set.</p></li>
<li><p><strong><code>quarto-revealjs-editable</code></strong><br>
Edit positions, images, and shapes in the browser and write changes back to the <code>.qmd</code>. Very on-brand for your visual slide style.</p></li>
<li><p><strong>Typst templates for real documents</strong><br>
You introduced Typst; the next step is templates: preprint, CV (<code>awesomecv-typst</code>), letter, or a book via the orange-book style path. Compare compile time and iteration speed against LaTeX.</p></li>
<li><p><strong>Grouped tabsets, include-code-files, and partials</strong><br>
“Don’t paste the same chunk in three documents.” Good hygiene episode.</p></li>
<li><p><strong>Quarto Wizard / extension management</strong><br>
Less sexy, but your repo already has a growing <code>_extensions</code> tree. A session on listing, updating, pinning, and not letting extensions rot would age well.</p></li>
</ol>
</section>
<section id="workflow-and-publishing-sessions" class="level2">
<h2 class="anchored" data-anchor-id="workflow-and-publishing-sessions">Workflow and publishing sessions</h2>
<p>These match the 2026 repo change (bookdown.org → GitHub Pages) and keep the series about <em>authoring as a system</em>.</p>
<ol start="27" type="1">
<li><p><strong>Freeze, cache, and CI rendering</strong><br>
What <code>freeze: auto</code> actually saves you from. GitHub Actions that render only what changed.</p></li>
<li><p><strong>Binder / easy compute environments</strong><br>
Quarto’s Binder helpers plus <code>renv</code>. “A student clones this and it runs.”</p></li>
<li><p><strong>Posit Connect Cloud and scheduled documents</strong><br>
Especially parameterized departmental reports or email-style HTML output.</p></li>
<li><p><strong>Website listings as a teaching archive</strong><br>
Auto-index weekly sessions from YAML instead of hand-maintaining <code>index.qmd</code>. You would be scratching your own itch.</p></li>
<li><p><strong>Quarto 2 as a preview, not a migration</strong><br>
Collaborative editor, new parser, engine extensions, promised 1.x compatibility. One conceptual session is enough; I would not rebuild the course around it yet.</p></li>
</ol>
</section>
<section id="a-few-series-native-episode-ideas" class="level2">
<h2 class="anchored" data-anchor-id="a-few-series-native-episode-ideas">A few “series-native” episode ideas</h2>
<p>These play to <em>R is for Authoring</em> rather than generic Quarto docs:</p>
<ul>
<li><strong>One analysis, five products:</strong> same study becomes a dashboard, manuscript, RevealJS talk, Typst handout, and parameterized client PDF.</li>
<li><strong>Teaching with hidden solutions:</strong> exercises in Quarto Live, instructor profile that reveals answers, student profile that does not.</li>
<li><strong>APA tables that survive HTML and Typst:</strong> <code>gt</code> / <code>tinytable</code> + list tables + cross-refs.</li>
<li><strong>Accessible decks:</strong> <code>axe</code> + alt text + color contrast + keyboard fragments.</li>
<li><strong>From messy <code>.R</code> to literate report:</strong> spin, then promote to a manuscript project.</li>
</ul>
<p>If I were filling the next eight Tuesdays, I would do:</p>
<ol type="1">
<li>Dashboards<br>
</li>
<li>Quarto Live / WebR<br>
</li>
<li><code>brand.yml</code> + dark renderings<br>
</li>
<li>Manuscripts<br>
</li>
<li>Custom cross-refs + conditional content<br>
</li>
<li>Write a shortcode/filter<br>
</li>
<li>Freeze / CI / GitHub Pages archive<br>
</li>
<li>Typst templates for papers and CVs</li>
</ol>
<p>That sequence stays inside literate programming, uses capabilities that are still new for most R Markdown users, and does not redo Mermaid, OJS, APA Quarto, or “what is Quarto.”</p>
</section>
<section id="regarding-suggestion-16" class="level2">
<h2 class="anchored" data-anchor-id="regarding-suggestion-16">Regarding suggestion 16:</h2>
<p>Quarto <strong>profiles</strong> let one project produce different documents from the same files. For a workshop, <code>student</code> and <code>instructor</code> is the most useful pair: students get the worksheet; you get the version with answers, notes, and executed output.</p>
<p>Official docs: <a href="https://quarto.org/docs/projects/profiles.html">Project Profiles</a>.</p>
</section>
<section id="what-a-profile-actually-is" class="level2">
<h2 class="anchored" data-anchor-id="what-a-profile-actually-is">What a profile actually is</h2>
<p>You keep a shared <code>_quarto.yml</code>, then add extra YAML files named <code>_quarto-<name>.yml</code>. When you render with <code>--profile <name></code>, Quarto <strong>merges</strong> that file on top of the base config.</p>
<p>Activation:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">quarto</span> render <span class="at">--profile</span> student</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="ex">quarto</span> render <span class="at">--profile</span> instructor</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p>Or:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="bu">export</span> <span class="va">QUARTO_PROFILE</span><span class="op">=</span>instructor</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">quarto</span> render</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p><code>--profile</code> replaces any <code>QUARTO_PROFILE</code> in the environment. You can activate several at once (<code>--profile instructor,prod</code>); for scalar keys the <strong>first</strong> listed profile wins. If you typo a profile name and there is no matching <code>_quarto-….yml</code>, Quarto <strong>silently ignores</strong> it.</p>
<p>Four things change when a profile is active:</p>
<ol type="1">
<li>Extra YAML is merged (<code>execute</code>, <code>format</code>, <code>output-dir</code>, titles, which files to render, etc.).</li>
<li>Optional <code>_environment-<profile></code> vars are applied.</li>
<li>Content can be shown/hidden with <code>when-profile</code> / <code>unless-profile</code>.</li>
<li>Code can read <code>Sys.getenv("QUARTO_PROFILE")</code> (R) or <code>os.environ["QUARTO_PROFILE"]</code> (Python).</li>
</ol>
</section>
<section id="a-concrete-student-instructor-setup" class="level2">
<h2 class="anchored" data-anchor-id="a-concrete-student-instructor-setup">A concrete student / instructor setup</h2>
<p><strong><code>_quarto.yml</code></strong> (shared defaults):</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3"><pre class="sourceCode yaml code-with-copy"><code class="sourceCode yaml"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">project</span><span class="kw">:</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">type</span><span class="kw">:</span><span class="at"> default</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="fu">profile</span><span class="kw">:</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">group</span><span class="kw">:</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="kw">-</span><span class="at"> </span><span class="kw">[</span><span class="at">student</span><span class="kw">,</span><span class="at"> instructor</span><span class="kw">]</span></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">default</span><span class="kw">:</span><span class="at"> student</span></span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a><span class="fu">execute</span><span class="kw">:</span></span>
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">echo</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">eval</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">warning</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p><code>profile.group</code> says these two are mutually exclusive, and the first name is the default if nobody passes <code>--profile</code>. That is handy so RStudio / VS Code preview “just works” as the student version.</p>
<p><strong><code>_quarto-student.yml</code></strong>:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4"><pre class="sourceCode yaml code-with-copy"><code class="sourceCode yaml"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">project</span><span class="kw">:</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">output-dir</span><span class="kw">:</span><span class="at"> _student</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="fu">title</span><span class="kw">:</span><span class="at"> </span><span class="st">"Workshop worksheet"</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="fu">execute</span><span class="kw">:</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">eval</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span><span class="co"> # show starter code, do not run solutions</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">echo</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="fu">format</span><span class="kw">:</span></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">html</span><span class="kw">:</span></span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">output-file</span><span class="kw">:</span><span class="at"> worksheet</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p><strong><code>_quarto-instructor.yml</code></strong>:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5"><pre class="sourceCode yaml code-with-copy"><code class="sourceCode yaml"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">project</span><span class="kw">:</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">output-dir</span><span class="kw">:</span><span class="at"> _instructor</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="fu">title</span><span class="kw">:</span><span class="at"> </span><span class="st">"Workshop — instructor notes"</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="fu">execute</span><span class="kw">:</span></span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">eval</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">echo</span><span class="kw">:</span><span class="at"> </span><span class="ch">true</span></span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="fu">format</span><span class="kw">:</span></span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">html</span><span class="kw">:</span></span>
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">output-file</span><span class="kw">:</span><span class="at"> instructor-notes</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p>Then:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">quarto</span> render <span class="at">--profile</span> student</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">quarto</span> render <span class="at">--profile</span> instructor</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p>You get two output folders from one source tree.</p>
</section>
<section id="showing-different-content-not-just-different-execute-settings" class="level2">
<h2 class="anchored" data-anchor-id="showing-different-content-not-just-different-execute-settings">Showing different <em>content</em>, not just different execute settings</h2>
<p>This is the part that makes student vs instructor shine.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">## Exercise 1</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a>Fit a linear model of <span class="in">`mpg`</span> on <span class="in">`wt`</span> using <span class="in">`mtcars`</span>.</span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a>::: {.cell}</span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="in">```{.r .cell-code}</span></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="co"># starter code students should complete</span></span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a><span class="co"># fit <- lm(...)</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p>:::</p>
<p>Leave space for your answer.</p>
<pre><code>
Equivalents:
```markdown
::: {.content-visible unless-profile="instructor"}
Student-only prompt
:::
::: {.content-hidden when-profile="student"}
Instructor-only sidebar
:::</code></pre>
<p>Same idea as Tom Palmer’s questions/solutions worksheets: one <code>.qmd</code>, two profiles, solutions wrapped in <code>when-profile</code>.</p>
</section>
<section id="branching-inside-code-with-quarto_profile" class="level2">
<h2 class="anchored" data-anchor-id="branching-inside-code-with-quarto_profile">Branching <em>inside code</em> with <code>QUARTO_PROFILE</code></h2>
<p>If you would rather not wrap whole chunks in divs:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># hidden solution chunk</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
</div>
<p>Or keep <code>eval: true</code> everywhere and gate prints:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">grepl</span>(<span class="st">"instructor"</span>, <span class="fu">Sys.getenv</span>(<span class="st">"QUARTO_PROFILE"</span>))) {</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">print</span>(<span class="fu">coef</span>(fit))</span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>}</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
</div>
<p>That is useful when the <em>same</em> chunk should run in both versions but only the instructor output should appear.</p>
</section>
<section id="typical-workshop-mappings" class="level2">
<h2 class="anchored" data-anchor-id="typical-workshop-mappings">Typical workshop mappings</h2>
<table class="caption-top table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>Goal</th>
<th>Student profile</th>
<th>Instructor profile</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Starter vs answers</td>
<td>hide solution divs; <code>eval: false</code> on solution chunks</td>
<td>show solution divs; <code>eval: true</code></td>
</tr>
<tr class="even">
<td>Don’t leak answers in HTML</td>
<td><code>output-dir: _student</code></td>
<td><code>output-dir: _instructor</code> (don’t publish this folder)</td>
</tr>
<tr class="odd">
<td>Different title / filename</td>
<td><code>title</code> + <code>format.html.output-file</code></td>
<td>same</td>
</tr>
<tr class="even">
<td>Notes / timing / demo scripts</td>
<td><code>content-hidden</code> for students</td>
<td><code>when-profile="instructor"</code></td>
</tr>
<tr class="odd">
<td>Freeze vs always re-run</td>
<td><code>execute.freeze: true</code></td>
<td><code>execute.freeze: false</code></td>
</tr>
<tr class="even">
<td>Secrets / DB creds</td>
<td>no keys in student env</td>
<td><code>_environment-instructor</code> (don’t commit secrets; use <code>.local</code>)</td>
</tr>
</tbody>
</table>
<p>Related teaching pattern: the <a href="https://github.com/coatless-quarto/assign">coatless-quarto/assign</a> extension uses profiles <code>assign</code> / <code>solution</code> / <code>rubric</code> plus CSS classes (<code>.direction</code>, etc.) and separate <code>output-dir</code>s. Same idea, more homework-flavored.</p>
</section>
<section id="authoring-tips-so-this-doesnt-bite-you-in-a-live-workshop" class="level2">
<h2 class="anchored" data-anchor-id="authoring-tips-so-this-doesnt-bite-you-in-a-live-workshop">Authoring tips so this doesn’t bite you in a live workshop</h2>
<ol type="1">
<li>Set <code>profile.default: student</code> so a casual Render button never dumps solutions.</li>
<li>Put instructor output in a directory that is gitignored or unpublished.</li>
<li>Don’t rely on <code>eval: false</code> alone to hide answers — students can still read the <code>.qmd</code>. Profiles hide <em>rendered</em> content; they are not encryption.</li>
<li>If you use knitr, programmatic chunk options (<code>#| eval: !expr …</code>) remain the most flexible for R-only materials. Profiles are the cleaner route when you also have Python/Julia or want different titles, output dirs, and prose.</li>
<li>Preview: <code>quarto preview --profile instructor</code> to check the teaching version before class.</li>
</ol>
<p>If you want, I can sketch a minimal 2-file demo project (<code>_quarto.yml</code> + one <code>exercises.qmd</code>) you could drop into the workshop repo as a live demo.</p>
</section>
</main> <!-- /main -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const isCodeAnnotation = (el) => {
for (const clz of el.classList) {
if (clz.startsWith('code-annotation-')) {
return true;
}
}
return false;
}
const onCopySuccess = function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
}
const getTextToCopy = function(trigger) {
const outerScaffold = trigger.parentElement.cloneNode(true);
const codeEl = outerScaffold.querySelector('code');
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
text: getTextToCopy
});
clipboard.on('success', onCopySuccess);
if (window.document.getElementById('quarto-embedded-source-code-modal')) {
const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
text: getTextToCopy,
container: window.document.getElementById('quarto-embedded-source-code-modal')
});
clipboardModal.on('success', onCopySuccess);
}
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
var mailtoRegex = new RegExp(/^mailto:/);
var filterRegex = new RegExp('/' + window.location.host + '/');
var isInternal = (href) => {
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
}
// Inspect non-navigation links and adorn them if external
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
for (var i=0; i<links.length; i++) {
const link = links[i];
if (!isInternal(link.href)) {
// undo the damage that might have been done by quarto-nav.js in the case of
// links that we want to consider external
if (link.dataset.originalHref !== undefined) {
link.href = link.dataset.originalHref;
}
}
}
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
const config = {
allowHTML: true,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start',
};
if (contentFn) {
config.content = contentFn;
}
if (onTriggerFn) {
config.onTrigger = onTriggerFn;
}
if (onUntriggerFn) {
config.onUntrigger = onUntriggerFn;
}
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
if (note) {
return note.innerHTML;
} else {
return "";
}
});
}
const xrefs = window.document.querySelectorAll('a.quarto-xref');
const processXRef = (id, note) => {
// Strip column container classes
const stripColumnClz = (el) => {
el.classList.remove("page-full", "page-columns");
if (el.children) {
for (const child of el.children) {
stripColumnClz(child);
}
}
}
stripColumnClz(note)
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
container.appendChild(note.children[0].cloneNode(true));
for (let i = 1; i < note.children.length; i++) {
const child = note.children[i];
if (child.tagName === "P" && child.innerText === "") {
continue;
} else {
container.appendChild(child.cloneNode(true));
break;
}
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(container);
}
return container.innerHTML
} else {
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
return note.innerHTML;
}
} else {
// Remove any anchor links if they are present
const anchorLink = note.querySelector('a.anchorjs-link');
if (anchorLink) {
anchorLink.remove();
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
if (note.classList.contains("callout")) {
return note.outerHTML;
} else {
return note.innerHTML;
}
}
}
for (var i=0; i<xrefs.length; i++) {
const xref = xrefs[i];
tippyHover(xref, undefined, function(instance) {
instance.disable();
let url = xref.getAttribute('href');
let hash = undefined;
if (url.startsWith('#')) {
hash = url;
} else {
try { hash = new URL(url).hash; } catch {}
}
if (hash) {
const id = hash.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
if (note !== null) {
try {
const html = processXRef(id, note.cloneNode(true));
instance.setContent(html);
} finally {
instance.enable();
instance.show();
}
} else {
// See if we can fetch this
fetch(url.split('#')[0])
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.getElementById(id);
if (note !== null) {
const html = processXRef(id, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
} else {
// See if we can fetch a full url (with no hash to target)
// This is a special case and we should probably do some content thinning / targeting
fetch(url)
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.querySelector('main.content');
if (note !== null) {
// This should only happen for chapter cross references
// (since there is no id in the URL)
// remove the first header
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
note.children[0].remove();
}
const html = processXRef(null, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
}, function(instance) {
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
let cellAttr = 'data-code-cell="' + cell + '"';
let lineAttr = 'data-code-annotation="' + annotation + '"';
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
return selector;
}
const selectCodeLines = (annoteEl) => {
const doc = window.document;
const targetCell = annoteEl.getAttribute("data-target-cell");
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
const lineIds = lines.map((line) => {
return targetCell + "-" + line;
})
let top = null;
let height = null;
let parent = null;
if (lineIds.length > 0) {
//compute the position of the single el (top and bottom and make a div)
const el = window.document.getElementById(lineIds[0]);
top = el.offsetTop;
height = el.offsetHeight;
parent = el.parentElement.parentElement;
if (lineIds.length > 1) {
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
height = bottom - top;
}
if (top !== null && height !== null && parent !== null) {
// cook up a div (if necessary) and position it
let div = window.document.getElementById("code-annotation-line-highlight");
if (div === null) {
div = window.document.createElement("div");
div.setAttribute("id", "code-annotation-line-highlight");
div.style.position = 'absolute';
parent.appendChild(div);
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
div.style.left = 0;
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
gutterDiv.style.position = 'absolute';
const codeCell = window.document.getElementById(targetCell);
const gutter = codeCell.querySelector('.code-annotation-gutter');
gutter.appendChild(gutterDiv);
}
gutterDiv.style.top = top - 2 + "px";
gutterDiv.style.height = height + 4 + "px";
}
selectedAnnoteEl = annoteEl;
}
};
const unselectCodeLines = () => {
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
elementsIds.forEach((elId) => {
const div = window.document.getElementById(elId);
if (div) {
div.remove();
}
});
selectedAnnoteEl = undefined;
};
// Handle positioning of the toggle
window.addEventListener(
"resize",
throttle(() => {
elRect = undefined;
if (selectedAnnoteEl) {
selectCodeLines(selectedAnnoteEl);
}
}, 10)
);
function throttle(fn, ms) {
let throttle = false;
let timer;
return (...args) => {
if(!throttle) { // first call gets through
fn.apply(this, args);
throttle = true;
} else { // all the others get throttled
if(timer) clearTimeout(timer); // cancel #2
timer = setTimeout(() => {
fn.apply(this, args);
timer = throttle = false;
}, ms);
}
};
}
// Attach click handler to the DT
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
for (const annoteDlNode of annoteDls) {
annoteDlNode.addEventListener('click', (event) => {
const clickedEl = event.target;
if (clickedEl !== selectedAnnoteEl) {
unselectCodeLines();
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
if (activeEl) {
activeEl.classList.remove('code-annotation-active');
}
selectCodeLines(clickedEl);
clickedEl.classList.add('code-annotation-active');
} else {
// Unselect the line
unselectCodeLines();
clickedEl.classList.remove('code-annotation-active');
}
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
const cites = parentEl.dataset.cites;
if (cites) {
return {
el,
cites: cites.split(' ')
};
} else {
return findCites(el.parentElement)
}
} else {
return undefined;
}
};
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const citeInfo = findCites(ref);
if (citeInfo) {
tippyHover(citeInfo.el, function() {
var popup = window.document.createElement('div');
citeInfo.cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
}
});
</script>
</div> <!-- /content -->
</body></html>