CodeLab Viewer: Edit and Run Program Examples
Turns program examples inserted with CodeLab for TinyMCE into code editors that readers can edit and run, in pages, books, forums and quiz text.
Live demo: try CodeLab on codelab.tsp.edu.rs as a guest (Python runs in the browser), or sign in with teacher or student (password Demo-2026) for every language, the debugger and SQL. Reset nightly.
Important: after installing, switch the filter On in Site administration, Plugins, Filters, Manage filters.
What's New in v1.18.0
- 29 interface languages: added 14 new translations (Portuguese Brazil, Turkish, Dutch, Russian, Ukrainian, Romanian, Hungarian, Bulgarian, Greek, Albanian, Japanese, Simplified Chinese, Korean and Arabic).
- HTML / CSS / JS live preview in the viewer: renders HTML examples with companion CSS and JS tabs inside a strictly sandboxed preview frame directly in the browser without an execution server.
- 27 supported languages: added card header badges and support for TypeScript, Bash, Go, Rust, R, Ruby, Lua, Kotlin, Perl, Octave, Julia, Scheme, Dart, Scala, Elixir, Swift, Haskell and HTML / CSS / JS.
Core features
- Run and interactive terminal: compile and run on Jobe or the CodeLab runner with prefilled or live terminal input, or run Python directly in the browser.
- SQL and files: MySQL examples whose setup of tables stays hidden from readers; input files readers can view and edit, and files the program writes appear under the console.
- Typing and error help: code completion (Jedi for Python), explanations of compiler errors, and optional AI explanations of errors through Moodle's AI subsystem.
- Debugger and Memory view: Step for Python and C/C++ with Step back, timeline slider, call stack, call tree, pointer arrows and heap leak warnings.
- Tooltips, zoom, themes and phones: hover for variable values, keyword explanations and number bases; zoom with Ctrl and mouse wheel; full screen; light and dark themes; input from a phone keyboard; screen reader and keyboard friendly console.
- Flowchart and Complexity: draw Python examples as flowcharts with the Algorithm plugins, and chart Python step growth against n, n log n and n².
- Class view and synced copies: students' changes stay saved across reloads and devices; teachers see class copies as cards with status filters and projector view.
- Fast pages: editors load lazily as they scroll into view.
The CodeLab plugins
Requirements
- Moodle: 4.5 LTS to 5.3.
- CodeLab for TinyMCE: version 1.24.0 or newer, with Jobe or the CodeLab runner configured. Switch the filter On after installing.
Privacy
For Class view the filter stores each student's latest copy of an example and last run status; the Moodle Privacy API exports and deletes them. Copies are also kept in browser local storage. Programs and input are sent to the configured server in CodeLab for TinyMCE, or run locally for browser Python.
Developed by Boban Blagojević. 29 languages: en, sr_lt, sr_cr, de, fr, es, it, pt, pt_br, pl, hr, bs, sl, mk, sk, cs, tr, nl, ru, uk, ro, hu, bg, el, sq, ja, zh_cn, ko, ar.
Source and issues: github.com/blagojevicboban/moodle-filter_codelab
Licensed under the GNU GPL v3 or later.