A variable $CodemirrorMime has to be set within the LON-CAPA problem file before the import line of the Footer library. The choices are
(It should be emphasised that most of these choices are only useful for manually assessed code, because automated marking is not provided for most of these languages.)
Codemirror can be used to provide better editing support for textareas for example for the LON-CAPA problem types "external response" and "essay response". It has modes for different programming languages. Libraries are provided in the following LON-CAPA location "/res/fhwf/ecult/lib/SyntaxHighlighter" by the eCULT project. Alternatively, such files can be installed from http://codemirror.net/doc/compress.html and then be configured for use in LON-CAPA. The current eCULT configuration includes: codemirror.js, clike.js, javascript.js, php.js, python.js, sql.js, xml.js, active-line.js, closebrackets.js, matchbrackets.js, matchtags.js.
The eCULT Codemirror libraries can be used by any LON-CAPA author. In order to use the libraries, the following two lines of code need to be included in the problem file. The first line should be at the beginning of the problem file, the second one at the end. A variable $CodemirrorMime has to be set within the LON-CAPA problem file before the import line of the Footer library.
<import id="91">/res/fhwf/ecult/lib/SyntaxHighlighter/CodeMirror_Header.library</import> <import id="92">/res/fhwf/ecult/lib/SyntaxHighlighter/CodeMirror_Footer.library</import>
An "<allow>" tag in LON-CAPA ensures that the resource has permission to be viewed. The codemirror-compressed.js file was downloaded from the Codemirror website, but the codemirror_3_16.css requires some modifications after downloading (in particular, it requires something like ".CodeMirror div { margin: 0; padding-bottom: 0; }".
The eCULT library currently provides the following:
Instead of using this library, one can also use the configuration for a single programming language:
Hint: when making changes to the footer library, it may be necessary to empty the browser cache to see the changes.