Skip to content
Permalink
Browse files

Add thebelab demo

Simplify the code rendering
  • Loading branch information...
psychemedia committed Jun 4, 2019
1 parent b594a40 commit 4fea066a2331cc07fd3ae91d35a9021a7dbd730f
Showing with 10 additions and 5 deletions.
  1. +10 −5 notebook.js
@@ -75,14 +75,19 @@
holder.setAttribute("data-prompt-number", this.cell.number);
}
var pre_el = makeElement("pre");
var code_el = makeElement("code");
//var code_el = makeElement("code");
var notebook = cell.worksheet.notebook;
var m = notebook.metadata;
var lang = this.cell.raw.language || m.language || (m.kernelspec && m.kernelspec.language) || (m.language_info && m.language_info.name);
code_el.setAttribute("data-language", lang);
code_el.className = "lang-" + lang;
code_el.innerHTML = nb.highlighter(escapeHTML(joinText(this.raw)), pre_el, code_el, lang);
pre_el.appendChild(code_el);
//code_el.setAttribute("data-language", lang);
//code_el.className = "lang-" + lang;
//code_el.innerHTML = nb.highlighter(escapeHTML(joinText(this.raw)), pre_el, code_el, lang);
//pre_el.appendChild(code_el);

// ThebeLab looks for code in the form: <pre data-executable="true" data-language="python"></pre>
pre_el.setAttribute("data-executable", "true");
pre_el.setAttribute("data-language", "python3"); //use the lang value?
pre_el.innerHTML = joinText(this.raw);
holder.appendChild(pre_el);
this.el = holder;
return holder;

0 comments on commit 4fea066

Please sign in to comment.
You can’t perform that action at this time.