Add code snippet text as interactive content


I would like to add code snippet highlighting as interactive content to H5P.

That functionality is derived from highlight.js .

That would be similar to what ckeditor does with code snippet and highlight.js where it searches for the tags <pre><code>.......</pre></code> and highlights whatever is inside them.

So when a user adds content to drupal in the dropdown list there is a "code snippet" entry.

I am thinking of cloning and renaming H5P.Text library to H5P.Code making it runnable and somehow add to the beggining and end of text string the tags <pre><code>.......</pre></code> so the highlight works.

Any idea how to do that ? What file should i change ?

Should I add something to text.js ?


falcon's picture

Why not add the ability to add code in the normal H5P.Text? We already have a thread about this.

I you want to add it as a separate content type, where will you use it? Only in Course Presentation?

I am working on a drupal site for enabling teachers to create educational content for school students.

I will use it there.

Also I haven't found a solution for the other thread

falcon's picture