Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MarkDown in Moodle quiz questions with the GIFT format

Is there a way to use MarkDown's fixed-width code blocks in a quiz question?

I'm writing my quiz questions in my text editor in the "GIFT" format and then importing them to my quiz pool. The GIFT format is very quick and compact, and this method lets me develop questions without internet access.

However, I'm struggling with using the MarkDown text format in the quiz questions. The docs say it's supported.

The problem is that the GIFT format doesn't allow newlines in the middle of a question, but MarkDown relies on newlines to delineate code blocks. For example, I would like the following quiz question:

::Finding bugs::
[markdown] Consider the following code:

    x=5;
    if x=5
        disp("It worked!")
    else
        print('Uh oh!')
    done

On which lines do bugs occur? Answer in the form [1,2,3]. 
{
=[2,3,5,6]
}

This doesn't import properly because the GIFT format prohibits newlines within a quiz question. But I can't remove the newlines because then MarkDown won't recognize the code block.

Thoughts? Thanks!

like image 403
ConvexMartian Avatar asked Oct 19 '22 13:10

ConvexMartian


1 Answers

(Answering my own question) This seems to work:

::Finding bugs::
[markdown]
Consider the following code\:\n
\n    x\=5;
\n    if x\=5
\n        disp("It worked!")
\n    else
\n        print('Uh oh!')
\n    done
\n\n\n
On which lines do bugs occur? Answer in the form [1,2,3].
{
        =[2,3,5,6]
}

Note the four spaces between each \n and the code. Ugh.

like image 198
ConvexMartian Avatar answered Oct 22 '22 05:10

ConvexMartian