Last active
          March 2, 2025 18:58 
        
      - 
      
 - 
        
Save jmclawson/8810de17f5b9cb2389970651a4bdcf7d to your computer and use it in GitHub Desktop.  
    RStudio snippet for learnr exercises with quarto-live
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | snippet exercise | |
| ```{webr} | |
| #| exercise: ${1:label} | |
| #| setup: true | |
| ``` | |
| ```{webr} | |
| #| caption: Exercise | |
| #| exercise: ${1:label} | |
| ``` | |
| ::: {.hint exercise="${1:label}"} | |
| ::: {.callout-note collapse="false"} | |
| #### Hint 1 | |
| <!-- hint text here --> | |
| ```{r} | |
| #| eval: false | |
| ${3:hintcode} | |
| ``` | |
| ::: | |
| ::: | |
| ::: {.solution exercise="${1:label}"} | |
| ::: {.callout-tip collapse="false"} | |
| #### Solution | |
| <!-- Solution text here --> | |
| ```{webr} | |
| #| exercise: ${1:label} | |
| #| solution: true | |
| ${2:solutioncode} | |
| ``` | |
| ::: | |
| ```{webr} | |
| #| exercise: ${1:label} | |
| #| check: true | |
| #| class: wait | |
| gradethis::grade_this_code() | |
| ``` | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Copy into RStudio using Tools > Edit Code Snippets... > Markdown.
To use in a Quarto file, type "exercise" and then hit
Shift+Tab.