Comments (8)
There is unfortunately a confusing mix of documentation out there for the different ipython versions. For many extensions upgrading works nicely but not all of them.
Until this extension is officially part of the jupyter/ipython repository the easiest way to install and run this extension is to stick to the standard installation method mentioned here with one key change:
In
.ipython/custom/custom.js
add
IPython.load_extensions('toc');
to load the extension. That is all, no other changes required.
from ipython_extensions.
@asteppke, adding IPython.load_extensions('toc');
in .ipython/custom/custom.js
does not work for me, still the notebook hangs. Also, AFAIA the notebook will not look into .ipython
folder anymore for custom.js, isn't it?
from ipython_extensions.
If I create .jupyter/custom/custom.js
with the only content:
IPython.load_extensions('toc');
then notebook loads (no hang) but no TOC button is shown.
from ipython_extensions.
I looked into this again, so what I wrote worked here for the transition to ipython 3.x. This is not working for jupyter as you experienced. Until the toc extension is part of the official repository some hacking is still required. The javascript api has changed again so this is the configuration that worked here after upgrading from 3.x to jupyter:
The toc.js
and toc.css
should be located in the appropriate directory, e.g. on Windows for a per user installation in %AppData%\Roaming\jupyter\nbextensions
.
This extension then needs to be loaded using a javascript snippet in your custom.js
:
require(['base/js/utils'],
function(utils) {
utils.load_extensions('toc');
});
To test whether this file is executed at all you can use a simple alert function additionally:
alert("hello world from custom.js")
Here the custom.js
is located in .jupyter\custom\
.
And finally a bit closer to the offical installation method is avoiding any custom.js
hacks. Instead the extension is installed via the extension manager, then in .jupyter\nbconfig\notebook.json
the extension is loaded via
{
"load_extensions": {
"toc": true
}
}
from ipython_extensions.
I've installed toc nbextension successfully with Jupyter notebook 4.
I post my solution here, may it help.
## download
mkdir toc
cd toc
wget https://raw.githubusercontent.com/minrk/ipython_extensions/master/nbextensions/toc.js
wget https://raw.githubusercontent.com/minrk/ipython_extensions/master/nbextensions/toc.css
## install and enable
cd ..
jupyter-nbextension install --user toc
jupyter-nbextension enable toc/toc
install
will copy toc
to ~/.local/share/jupyter/nbextensions/
enable
will modify ~/.jupyter/nbconfig/notebook.json
as asteppke said.
You can check these two place.
Note: we use enable toc/toc
here is because toc.js
is in ~/.local/share/jupyter/nbextensions/toc/
if you put toc.js
and toc.css
directly in ~/.local/share/jupyter/nbextensions/
then you should use enable toc
here.
from ipython_extensions.
@styra thanks! It worked flawlessly on OS X.
You should put this info in a more visible place :). Maybe you could send @minrk a PR to update the README?
Closing the issue as the problem is solved for me.
from ipython_extensions.
Note that the TOC extension was recently also added to the ipython-notebook-extension repository and there you can simple activate it via the <nbserver:port>/nbextension
URL.
from ipython_extensions.
@JanSchulz Thank you!
It's very impressive. Why I didn't see this earlier ...
And a typo: the URL should be <nbserver:port>/nbextensions
from ipython_extensions.
Related Issues (20)
- TOC doesnt load? HOT 26
- Gist button: problem grabbing notebook JSON code HOT 3
- ToC does not update on cell execution HOT 2
- ToC magic does not work in IPython 3.0 HOT 3
- TypeError: IPython is undefined toc.js:136:8 HOT 3
- Two install instructions for ToC HOT 1
- Load timeout for modules HOT 3
- contribute the nbextensions (at least toc) to ipython-contrib/IPython-notebook-extensions HOT 6
- How can I contribute to the table of content extension?
- feature request: show/hide table of contents with a shortcut HOT 1
- Typo in TOC install commands
- Duplicates entries after each save/refresh HOT 1
- floating TOC is too small
- string including "] will cause In[*] problem
- Question: Will some of the extensions, like ToC, gist work w/ custom kernels? HOT 2
- install renumber-button via URL?
- Error on install HOT 1
- making margin width configurable
- Headings for TOC no more supported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipython_extensions.