viebel / klipse

Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
http://blog.klipse.tech/
GNU General Public License v3.0
3.11k stars 146 forks source link

Getting evaluated output - Towards providing automated grading and feedback #381

Closed aneesha closed 4 years ago

aneesha commented 4 years ago

Hi

Klipse is amazing! It has truely transformative capabilities for computer science education. I'm building a H5P content type - H5P is a collection of open source interactives that can easily be embedded in Wordpress, Drupal and many Learning Management Systems (eg Moodle, Blackboard, Canvas, D2L, etc). I already have a prototype version: github and blog post .

The next step is adding support for autograding and feedback. In order to do this I need to get access to the evaluated output. Is there an API? Are there any examples of testing the output against assertions?

Thanks for a great library.

Aneesha

viebel commented 4 years ago

Hello @aneesha,

I just released Klipse version 7.10.5 that provides programmatic access to the evaluated output.

The evaluation of each snippet is also wrapped into a CodeMirror editor. The CodeMirror editors that wrapped results are accessible via the JavaScript global variable: klipse_results. This is an array that contains the CodeMirror editors wrapping the results of the evaluation of the code snippets. For instance, you can read the content of the code snippet i by calling: klipse_results[i].getValue();

Here is a jsfiddle that shows it in action.

All the info has been added to the README.

viebel commented 4 years ago

Keep me updated once you relase a stable version of your interactive tutorials.