mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Merge pull request #2212 from minrk/protectjs
catch errors in markdown javascript
This commit is contained in:
commit
5c394dab71
@ -388,3 +388,7 @@ pre, code, kbd, samp { white-space: pre-wrap; }
|
||||
#fonttest {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.js-error {
|
||||
color: darkred;
|
||||
}
|
@ -221,7 +221,15 @@ var IPython = (function (IPython) {
|
||||
var text = this.get_text();
|
||||
if (text === "") { text = this.placeholder; }
|
||||
var html = IPython.markdown_converter.makeHtml(text);
|
||||
this.set_rendered(html);
|
||||
try {
|
||||
this.set_rendered(html);
|
||||
} catch (e) {
|
||||
console.log("Error running Javascript in Markdown:");
|
||||
console.log(e);
|
||||
this.set_rendered($("<div/>").addClass("js-error").html(
|
||||
"Error rendering Markdown!<br/>" + e.toString())
|
||||
);
|
||||
}
|
||||
this.typeset()
|
||||
this.element.find('div.text_cell_input').hide();
|
||||
this.element.find("div.text_cell_render").show();
|
||||
|
Loading…
Reference in New Issue
Block a user