link rel stylesheet href https cdnjs cloudflare com ajax libs prism 1 21 0 themes prism css script src https cdnjs cloudflare com ajax libs prism 0 0 1 prism min js script script src https cdnjs cloudflare com ajax libs KaTeX 0 16 7 katex min js script script src https cdnjs cloudflare com ajax libs KaTeX 0 16 7 contrib auto render min js script link rel stylesheet href https cdnjs cloudflare com ajax libs KaTeX 0 16 7 katex min css script src https cdnjs cloudflare com ajax libs es5 shim 4 6 7 es5 shim min js script script src https cdnjs cloudflare com ajax libs marked 0 7 0 marked min js script script src https cdnjs cloudflare com ajax libs dompurify 3 0 3 purify min js script script src https jsvine github io nbpreview js vendor notebook min js script link rel stylesheet href https jsvine github io nbpreview css notebook css script window Prism window Prism window Prism manual true script style body font family Helvetica Neue Helvetica sans serif font size 14px main width 99 max width 750px margin 0 auto header line height 2 margin bottom 0 25em font weight bold controls border 1px dotted CCC padding 0 75em margin bottom 0 5em background color EEF language python margin 0 important padding 0 important overflow wrap break word white space initial nb input margin 2px padding 0px border 1px solid rgb 200 200 200 background color rgb 240 240 240 margin bottom 5px nb text output nb stdout margin 2px border 0px solid black background color rgb 240 240 240 nb output overflow x auto nb input before color blue nb output before color red style div id header input type file id file input div div id main div id notebook holder div div style body min height 8100px padding 70px style script Example usage const fileInput document getElementById file input Function to load and parse the IPython Notebook file async function loadIPythonNotebook txt var notebook nb parse JSON parse txt var rendered notebook render var holder document querySelector notebook holder holder appendChild rendered Prism highlightAll fileInput addEventListener change async event const file event target files 0 const reader new FileReader reader onload async await loadIPythonNotebook reader result reader readAsText file onload async function let p await fetch https notebook xbdev net var resources lab01 ipynb let t await p text await loadIPythonNotebook t Prism highlightAll script
break word white space initial nb input margin 2px padding 0px border 1px solid rgb 200 200 200 background color rgb 240 240 240 margin bottom 5px nb text output nb stdout margin 2px border 0px solid black background color rgb 240 240 240 nb output overflow x auto nb input before color blue nb output before color red style div id header input type file id file input div div id main div id notebook holder div div style body min height 8100px padding 70px style script Example usage const fileInput document getElementById file input Function to load and parse the IPython Notebook file async function loadIPythonNotebook txt var notebook nb parse JSON parse txt var rendered notebook render var holder document querySelector notebook holder holder appendChild rendered Prism highlightAll fileInput addEventListener change async event const file event target files 0 const reader new FileReader reader onload async await loadIPythonNotebook reader result reader readAsText file onload async function let p await fetch https notebook xbdev net var resources lab01 ipynb let t await p text await loadIPythonNotebook t Prism highlightAll script