# Code Widget

The code widget allows for coding exercises to be embedded into the worksheet. The code widget is a wrapper around the [CodeMirror](https://codemirror.net/) editor. The code widget supports the following languages:

-   JavaScript
-   Python
-   HTML

## Usage

    The code widget comes with some example excersises. To select an example, just choose one out of the list, be aware that the code will be replaced with the example code.

    To change the language of the code widget, just select the language from the list in the top right of the editor. The code widget will automatically highlight the code based on the selected language.

The editor can be customized, by changing the settings in the action panel.

### Alow code execution

    Toggels, if the code can be executed or not. If the code can be executed, the code will be executed when the user clicks the run button, if not, the run button will be disabled.

### Autocompletion

    Toggels, if the editor should show autocompletion suggestions or not.

### Toggle Theme

    Switches between the light and dark theme. The light theme is the default theme.

### Show execution time

    Toggels, if the execution time should be shown or not. The execution time will be shown in the bottom right of the editor.

### Disable lines

    By clicking on the gutter left of the code, the line will be disabled. Disabled lines cannot be edited. To enable a line, just click on the gutter again.
