Skip to content

Quarto mod0 mod1 #71

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

Merged
merged 15 commits into from
Jun 5, 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
Binary file removed .RData
Binary file not shown.
Empty file removed .Rapp.history
Empty file.
512 changes: 0 additions & 512 deletions .Rhistory

This file was deleted.

76 changes: 0 additions & 76 deletions .gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions .prettierrc

This file was deleted.

13 changes: 0 additions & 13 deletions MCL-DSCI-511-programming-in-python.Rproj

This file was deleted.

15 changes: 15 additions & 0 deletions _extensions/r-wasm/live/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
title: Quarto Live
author: George Stagg
version: 0.1.3-dev
quarto-required: ">=1.4.0"
contributes:
filters:
- live.lua
formats:
common:
ojs-engine: true
filters:
- live.lua
html: default
revealjs: default
dashboard: default
40 changes: 40 additions & 0 deletions _extensions/r-wasm/live/_gradethis.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
```{webr}
#| edit: false
#| output: false
webr::install("gradethis", quiet = TRUE)
library(gradethis)
options(webr.exercise.checker = function(
label, user_code, solution_code, check_code, envir_result, evaluate_result,
envir_prep, last_value, engine, stage, ...
) {
if (is.null(check_code)) {
# No grading code, so just skip grading
invisible(NULL)
} else if (is.null(label)) {
list(
correct = FALSE,
type = "warning",
message = "All exercises must have a label."
)
} else if (is.null(solution_code)) {
list(
correct = FALSE,
type = "warning",
message = htmltools::tags$div(
htmltools::tags$p("A problem occurred grading this exercise."),
htmltools::tags$p(
"No solution code was found. Note that grading exercises using the ",
htmltools::tags$code("gradethis"),
"package requires a model solution to be included in the document."
)
)
)
} else {
gradethis::gradethis_exercise_checker(
label = label, solution_code = solution_code, user_code = user_code,
check_code = check_code, envir_result = envir_result,
evaluate_result = evaluate_result, envir_prep = envir_prep,
last_value = last_value, stage = stage, engine = engine)
}
})
```
32 changes: 32 additions & 0 deletions _extensions/r-wasm/live/_knitr.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
```{r echo=FALSE}
# Setup knitr for handling {webr} and {pyodide} blocks
# TODO: With quarto-dev/quarto-cli#10169, we can implement this in a filter
# We'll handle `include: false` in Lua, always include cell in knitr output
knitr::opts_hooks$set(include = function(options) {
if (options$engine == "webr" || options$engine == "pyodide") {
options$include <- TRUE
}
options
})
# Passthrough engine for webr
knitr::knit_engines$set(webr = function(options) {
knitr:::one_string(c(
"```{webr}",
options$yaml.code,
options$code,
"```"
))
})
# Passthrough engine for pyodide
knitr::knit_engines$set(pyodide = function(options) {
knitr:::one_string(c(
"```{pyodide}",
options$yaml.code,
options$code,
"```"
))
})
```
Loading
Loading