Skip to content

Commit

Permalink
Merge pull request #810 from jfbercher/toc2
Browse files Browse the repository at this point in the history
toc2: html export -- take into account number_section, threshold and sideBar metadata parameters
  • Loading branch information
jfbercher authored Dec 3, 2016
2 parents 51f0090 + c3b7947 commit 40fa980
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/jupyter_contrib_nbextensions/templates/toc2.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>

<style> /* defined here in case the main.css below cannot be loaded */
.lev1 {margin-left: 80px}
.lev2 {margin-left: 100px}
.lev3 {margin-left: 120px}
.lev4 {margin-left: 140px}
.lev5 {margin-left: 160px}
.lev6 {margin-left: 180px}
</style>

<link rel="stylesheet" type="text/css" href="https://rawgit.com/ipython-contrib/jupyter_contrib_nbextensions/master/src/jupyter_contrib_nbextensions/nbextensions/toc2/main.css">

<script src="https://rawgit.com/ipython-contrib/jupyter_contrib_nbextensions/master/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js"></script>

<script>
$( document ).ready(function(){
var cfg={'threshold':6, // depth of toc (number of levels)
'number_sections':true, // sections numbering
'toc_cell':false, // useless here
'toc_window_display':true, // display the toc window
var cfg={'threshold':{{ nb.get('metadata', {}).get('toc', {}).get('threshold', '3') }}, // depth of toc (number of levels)
'number_sections': {{ 'true' if nb.get('metadata', {}).get('toc', {}).get('number_sections', False) else 'false' }}, // sections numbering
'toc_cell': false, // useless here
'toc_window_display': true, // display the toc window
"toc_section_display": "block", // display toc contents in the window
'sideBar':true, // sidebar or floating window
'sideBar':{{ 'true' if nb.get('metadata', {}).get('toc', {}).get('sideBar', False) else 'false' }}, // sidebar or floating window
'navigate_menu':false // navigation menu (only in liveNotebook -- do not change)
}
Expand Down

0 comments on commit 40fa980

Please sign in to comment.