-
Notifications
You must be signed in to change notification settings - Fork 44
Description
I am trying to use the library along with Prism highlighting to render a notebook's content. It seems like the notebookjs library html-escapes the '<' and '>' characters before passing it to the highlighter. The highlighter treats it as the actual code and renders it as such by tokenising < and >
Anyway to disable escaping or any recommended way to handle this situation?
I am using the code given on the site to use prism highlighting. ie
`var Prism = require('prismjs');
var highlighter = function(code, lang) {
if (typeof lang === 'undefined') lang = 'markup';
if (!Prism.languages.hasOwnProperty(lang)) {
try {
require('prismjs/components/prism-' + lang + '.js');
} catch (e) {
console.warn('** failed to load Prism lang: ' + lang);
Prism.languages[lang] = false;
}
}
return Prism.languages[lang] ? Prism.highlight(code, Prism.languages[lang]) : code;
};
var nb = require("notebookjs");
nb.highlighter = function(text, pre, code, lang) {
var language = lang || 'text';
pre.className = 'language-' + language;
if (typeof code != 'undefined') {
code.className = 'language-' + language;
}
return highlighter(text, language);
};`