Last active
August 15, 2016 14:29
-
-
Save amitkaps/095114022c0f36b0ab71ac8071406f7e to your computer and use it in GitHub Desktop.
For using nbviewer.js from https://github.com/kokes/nbviewer.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism.min.css'/> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js'></script> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/prism.min.js' data-manual></script> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/components/prism-python.min.js' data-manual></script> | |
<script src="https://rawgit.com/kokes/nbviewer.js/master/lib/nbv.js"></script> | |
<link rel='stylesheet' src="https://rawgit.com/kokes/nbviewer.js/master/lib/nbv.css"> | |
</head> | |
<body> | |
<div id="notebook"></div> | |
<script> | |
var request = new XMLHttpRequest(); | |
request.open('GET', 'notebook.ipynb', true); | |
request.onload = function() { | |
if (request.status >= 200 && request.status < 400) { | |
// Success! | |
console.log("notebook loaded"); | |
var data = JSON.parse(request.responseText); | |
var target = document.getElementById("notebook"); | |
nbv.render(data, target); | |
} else { | |
// We reached our target server, but it returned an error | |
console.log("notebook not found error"); | |
} | |
}; | |
request.onerror = function() { | |
// There was a connection error of some sort | |
console.log("connection error"); | |
}; | |
request.send(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment