Code blocks in qiuzzes

Code blocks in qiuzzes

ដោយ Stefan Warm នៅ
ចំនួនតប៖ 1

Hey,

what is the best way to import code blocks (for programming quiizzes) with the gift format?

I was trying to use markdown format to write unformated code. But I didn't get the right indentation as expected.

Any idea?

Thanks, Stefan


មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Stefan Warm

Re: Code blocks in qiuzzes

ដោយ Dominique Bauer នៅ
រូបភាព Documentation writers រូបភាព Particularly helpful Moodlers រូបភាព Plugin developers

Hello Stefan,

In your GIFT file, write:

::Multi choice 1::[markdown]
```
function myFunction(p1, p2) \{
····return p1 * p2;   // The function returns the product of p1 and p2
\}
```

where ···· stand for non-breaking spaces (Alt-255 on Windows) and where { and } are escaped with \.

Moodle will display:

function myFunction(p1, p2) {
    return p1 * p2;   // The function returns the product of p1 and p2
}
មធ្យមភាគនៃរង្វាយតម្លៃ: -