├── README.md ├── index.html ├── ipython_notebook_toc.js ├── javascripts └── scale.fix.js ├── params.json └── stylesheets ├── pygment_trac.css └── styles.css /README.md: -------------------------------------------------------------------------------- 1 | ipython_notebook_goodies 2 | ======================== 3 | 4 | Random goodies for use in iPython Notebooks. 5 | Tested with the latest iPython Notebook 3.2.0 6 | 7 | 1. Table of Contents 8 | -------------------- 9 | 10 | Make a table of contents for your notebook. Uses headings (e.g. H1, H2, etc.) to build TOC, 11 | and provides anchors (added where needed). 12 | 13 | **Usage:** 14 | 15 | 1. Add a *markdown* cell at the top of your notebook with the following: 16 | ``` 17 |

Table of Contents

18 |
19 | ``` 20 | 2. Add a *code* cell anywhere in the notebook with the following: 21 | ``` 22 | %%javascript 23 | $.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js') 24 | ``` 25 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | iPython Notebook Goodies by kmahelona 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |
17 |
18 |

iPython Notebook Goodies

19 |

Random goodies for use in iPython Notebooks

20 | 21 |

View the Project on GitHub kmahelona/ipython_notebook_goodies

22 | 23 | 24 | 29 |
30 |
31 |

32 | ipython_notebook_goodies

33 | 34 |

Random goodies for use in iPython Notebooks

35 | 36 |

37 | 1. Table of Contents

38 | 39 |

Make a table of contents for your notebook. Uses headings (e.g. H1, H2, etc.) to build TOC, 40 | and provides anchors (added where needed).

41 | 42 |

Usage: Include the following at the top of your notebook:

43 | 44 |
<h1 id="tocheading">Table of Contents</h1>
45 | <div id="toc"></div>
46 | <script type="text/javascript" src="https://raw.github.com/kmahelona/ipython_notebook_goodies/master/ipython_notebook_toc.js">
47 | 
48 |
49 | 53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /ipython_notebook_toc.js: -------------------------------------------------------------------------------- 1 | // Converts integer to roman numeral 2 | function romanize(num) { 3 | var lookup = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}, 4 | roman = '', 5 | i; 6 | for ( i in lookup ) { 7 | while ( num >= lookup[i] ) { 8 | roman += i; 9 | num -= lookup[i]; 10 | } 11 | } 12 | return roman; 13 | } 14 | 15 | // Builds a "); 56 | } 57 | 58 | 59 | $('#toc').append(toc); 60 | 61 | }; 62 | 63 | // Executes the createToc function 64 | setTimeout(function(){createTOC();},100); 65 | 66 | // Rebuild to TOC every minute 67 | setInterval(function(){createTOC();},60000); 68 | -------------------------------------------------------------------------------- /javascripts/scale.fix.js: -------------------------------------------------------------------------------- 1 | var metas = document.getElementsByTagName('meta'); 2 | var i; 3 | if (navigator.userAgent.match(/iPhone/i)) { 4 | for (i=0; iTable of Contents\r\n\t
\r\n\t