Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sync): 🔨 synced file(s) with rostools/r3-theme #8

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .vscode/json.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
// Place your snippets for Quarto here.
// Each snippet is defined under a snippet name and has a prefix, body and description.
// The prefix is what is used to trigger the snippet and the body will be expanded and inserted.
// Possible variables are:
//
// - $1 and $2 for tab stops,
// - $0 for the final cursor position, and
// - ${1:label}, ${2:another} for placeholders
//
// Placeholders with the same ids are connected.
//
// How to use the code snippets:
// After you have set the above settings, a suggestion for one of the code snippets below will pop up automatically, when
// you start writing the prefix. Press "Enter" or "Tab" to insert the code snippet.
"Insert TODO formatting": {
"scope": "quarto,markdown",
"prefix": "todo",
"body": [
"<!-- TODO: ${0:Write text here} -->"
],
"description": "Insert TODO formatting"
},
"R package name syntax": {
"scope": "quarto,markdown",
"prefix": "pkg",
"body": [
"`{${0:Package}}`"
],
"description": "The syntax used to display and link R packages to their websites."
},
"Insert code exercise": {
"scope": "quarto,markdown",
"prefix": "exercise",
"body": [
"## :technologist: Exercise: ${0:Title}",
"",
"> Time: ~${1:Minutes} minutes.",
"",
"${2:Text}",
],
"description": "Insert a hands-on coding exercise section."
},
"Insert discussion exercise": {
"scope": "quarto,markdown",
"prefix": "discussion",
"body": [
"## :speech_balloon: Discussion activity: ~${0:Title}",
"",
"**Time: ~${1:Minutes}**",
"",
"${2:Text}",
],
"description": "Insert a discussion activity section."
},
"Insert reading task": {
"scope": "quarto,markdown",
"prefix": "reading",
"body": [
"::: callout-note",
"## :book: Reading task: ~${0:Minutes}",
"",
"${1:Text body}",
"",
"{{< include ../includes/_sticky_up.qmd >}}",
":::",
],
"description": "Insert reading task section."
},
"Insert instructor note": {
"scope": "quarto,markdown",
"prefix": "instructor_note",
"body": [
"::: {.callout-note collapse=\"true\"}",
"## :teacher: Instructor note",
"",
"${0:Text body}",
":::",
],
"description": "Insert instructor note that is a Quarto callout note block."
}
}
33 changes: 33 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"files.autoSave": "onFocusChange",
"editor.tabSize": 2,
"editor.wordWrap": "off",
"editor.formatOnSave": true,
"git.autofetch": false,
"quarto.visualEditor.markdownWrap": "column",
"quarto.visualEditor.markdownWrapColumn": 72,
"editor.tabCompletion": "on",
"editor.snippetSuggestions": "inline",
"conventional-branch.type": [
"build", // Changes that affect the build system or external dependencies
"ci", // Changes to our CI configuration files and scripts
"docs", // Documentation only changes
"feat", // A new feature
"fix", // A bug fix
"refactor", // A code change that neither fixes a bug nor adds a feature
"style", // Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
"test", // Adding missing tests or correcting existing tests
"chore", // Misc things, like renaming or deleting files
],
"conventional-branch.format": "{Type}/{Branch}",
"files.insertFinalNewline": true,
"cSpell.enableFiletypes": [
"quarto"
],
"cSpell.language": "en,en-GB",
"conventionalCommits.scopes": [
"preamble",
"sessions",
"appendix"
],
}
2 changes: 2 additions & 0 deletions _extensions/rostools/r3-theme/_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ author: Luke W. Johnston
version: 1.0.6
quarto-required: ">=1.5.0"
contributes:
shortcodes:
- text-snippet.lua
format:
common:
shortcodes:
Expand Down
77 changes: 77 additions & 0 deletions _extensions/rostools/r3-theme/text-snippet.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
local review_note = [[
::: {.callout-note appearance="minimal" collapse="true"}
## :teacher: Instructor note

Before beginning, get them to recall what they remember of the previous
session, either with something like Mentimeter, verbally, or using hands
/ stickies / origami hats. Preferably something that will allow everyone
to participate, not just the ones who are more comfortable being vocal
to the whole group.

Depending on what they write, you may need to briefly go over the previous
session.
:::
]]

local sticky_up = [[
::: {.callout-tip appearance="default"}
When you're ready to continue, place the sticky/paper hat on your
computer to indicate this to the instructor :womans_hat: :tophat:
:::
]]

local faq_text = [[
Throughout the many times we've taught this course and others, we
get asked a lot of questions. We have a [Frequently Asked
Questions](https://guides.rostools.org/faq) page for keeping track of
some of these questions. Check out this page, maybe your question has
already been answered!
]]

local wip = [[
::: {.callout-warning appearance="default"}
🚧 This section is being actively worked on. 🚧
:::
]]

-- TODO: This doesn't trigger the r chunk to execute
local code_appendix = [[
::: {.callout-tip appearance="minimal" icon="false" collapse="true"}
## Code used in section

This lists *some*, but not all, of the code used in the section. Some code is
incorporated into Markdown content, so is harder to automatically list here in
a code chunk. The code below also includes the code from the exercises.

<!-- The stringr subset removes code chunks that aren't shown or typed by the learner. -->
```{r code-appendix}
#| echo: false
#| eval: false
#| ref-label: !expr stringr::str_subset(knitr::all_labels(), "^(unnamed-chunk-.*|purl-only-.*|setup|fig-.*)", negate = TRUE)
```
:::
]]

local discord_text = [[
If you want to get help virtually or after the course, you can join the
[Discord channel](https://discord.gg/WKyTF5yXBJ) where you can ask questions
in the `questions-or-advice` text channel.
]]

function text_snippet(args)
local snippet_type = pandoc.utils.stringify(args[1])

if snippet_type == "review_note" then
return quarto.utils.string_to_blocks(review_note)
elseif snippet_type == "sticky_up" then
return quarto.utils.string_to_blocks(sticky_up)
elseif snippet_type == "wip" then
return quarto.utils.string_to_blocks(wip)
elseif snippet_type == "faq_text" then
return quarto.utils.string_to_blocks(faq_text)
elseif snippet_type == "discord_text" then
return quarto.utils.string_to_blocks(discord_text)
elseif snippet_type == "code_appendix" then
return quarto.utils.string_to_blocks(code_appendix)
end
end