swirldev / swirlify

:books: A toolbox for writing swirl courses
Other
63 stars 47 forks source link

Adding a markdown class #48

Open krcarriere opened 4 months ago

krcarriere commented 4 months ago

You can load Markdowns via class: script, but I don't think swirlify also includes a way to 'test' for a correct Markdown answer.

It's a very obscure feature, but in PSYCH, we have these Notes scripts that load for the student for them to simply save and then submit. It's fine for what it is, but it would be so much better organized if the notes could be provided as a Markdown, and swirlify would let the student pass through without truly evaluating the Markdown.

My limited testing suggests that even creating a very basic way to pass a custom test (create a test that just asks itself if 1+1==2),

pass_notes <- function() {
    (1+1==2)
}

- Class: script
  Output: To save the notes for this module, copy and paste the code provided into your own RNotebook. Type submit() when you have finished saving these notes. 
  AnswerTests: pass_notes()
  Hint: "Don't change anything, just type submit(). If you did and you don't know how to fix it, just type skip(), and you'll be all set."
  Script: Notes.Rmd

The script class will still want to check for specific things related to the script class. It passes the user's submission, to be sure, but it throws an error message along the way:

Error in source(e$script_temp_path, encoding = "UTF-8") : attempt to use zero-length variable name

Which isn't ideal. Maybe I'm not thinking this through or making a simple mistake.