|
@@ -42,7 +42,6 @@
|
|
{{else if .IsIPythonNotebook}}
|
|
{{else if .IsIPythonNotebook}}
|
|
<script>
|
|
<script>
|
|
var rendered = null;
|
|
var rendered = null;
|
|
- console.log("fuck")
|
|
|
|
$.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
|
|
$.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
|
|
var notebook = nb.parse(notebook_json);
|
|
var notebook = nb.parse(notebook_json);
|
|
rendered = notebook.render();
|
|
rendered = notebook.render();
|
|
@@ -52,8 +51,14 @@
|
|
hljs.highlightBlock(block);
|
|
hljs.highlightBlock(block);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // Overwrite image method to append proper prefix to the source URL
|
|
|
|
+ var renderer = new marked.Renderer();
|
|
|
|
+ var context = '{{.TreeLink}}'.replace('/src/', '/raw/');
|
|
|
|
+ renderer.image = function (href, title, text) {
|
|
|
|
+ return `<img src="${context}/${href}"`
|
|
|
|
+ }
|
|
$("#ipython-notebook .nb-markdown-cell").each(function(i, markdown) {
|
|
$("#ipython-notebook .nb-markdown-cell").each(function(i, markdown) {
|
|
- $(markdown).html(marked($(markdown).html()));
|
|
|
|
|
|
+ $(markdown).html(marked($(markdown).html(), {renderer: renderer}));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|