jupyterlab / jupyterlab-toc Goto Github PK
View Code? Open in Web Editor NEWTable of Contents extension for JupyterLab
License: BSD 3-Clause "New" or "Revised" License
Table of Contents extension for JupyterLab
License: BSD 3-Clause "New" or "Revised" License
A nice feature to add, if it's not too much work to implement, would be a command (so it can be bound to a keyboard shortcut) to pull up a search menu where you can type in the name of a section you're looking for. It could have a list of sections below it that match what you've typed thus far, and you could, e.g., use the arrow keys to go down to the one you want or press tab to use fill the menu with the top item in the list. Then press enter to jump to that section. Basically, I'd be glad for a way to use the TOC right from my keyboard so I don't have to move to the mouse (and to find sections by name so I don't have to remember what order they're in when I'm scrolling through the list).
I noticed that when I drag and move cells, the content tab is not updated. Would it be possible to update it each time a cell is moved ?
Note that it is if I hide and show again the content tab.
Thanks so much for your work on this extension! I've been using Lab more and more and definitely missing TOC2.
Would you consider adding a 'collapse' option for each of the items in the TOC? I imagine it being a small icon to the right of the TOC item that, when selected, hides the cells between that TOC item and the next. This is another JupyterNB extension that is sorely missed. If you need, I can put some nice icons together for you, beta test, and I will look into helping with the code as well.
Desired behavior: jupyterlab-toc installs and is usable.
Actual behavior: install fails both from labextension install
and from source.
Environment: Ubuntu 18.04 x64.
jupyter lab --version: 0.35.3
node --version: v8.10.0
npm --version: 3.5.2
Steps to reproduce:
Try to install jupyterlab-toc on Ubuntu 18.04. node and npm installed from Ubuntu repo (needed aptitude to install npm, since apt would complain about node-gyp).
Then:
$ jupyter labextension install @jupyterlab/toc
Node v8.10.0
> /usr/bin/npm pack @jupyterlab/toc
jupyterlab-toc-0.6.0.tgz
Node v8.10.0
> node /home/dani/anaconda3/envs/numerical_methods/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install
yarn install v1.9.4
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
error Received malformed response from registry for undefined. The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[I 09:29:09.526 LabApp] Saving file at /section-01.ipynb
info There appears to be trouble with your network connection. Retrying...
Error: Received malformed response from registry for undefined. The registry may be down.
at MessageError.ExtendableBuiltin (/home/dani/anaconda3/envs/numerical_methods/share/jupyter/lab/staging/yarn.js:243:66)
at new MessageError (/home/dani/anaconda3/envs/numerical_methods/share/jupyter/lab/staging/yarn.js:272:123)
at Function.<anonymous> (/home/dani/anaconda3/envs/numerical_methods/share/jupyter/lab/staging/yarn.js:51226:15)
...
Then, tried from source:
$ jlpm install
-everything seems fine-
$ jlpm run build
-everything seems fine-
$ jupyter labextension install .
jupyter labextension install .
Node v8.10.0
> /usr/bin/npm pack /home/dani/repos/numerical_methods/jupyterlab-toc
jupyterlab-toc-0.6.0.tgz
Node v8.10.0
> /usr/bin/npm pack /home/dani/repos/numerical_methods/jupyterlab-toc
jupyterlab-toc-0.6.0.tgz
> node /home/dani/anaconda3/envs/numerical_methods/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install
yarn install v1.9.4
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
error Received malformed response from registry for undefined. The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Received malformed response from registry for undefined. The registry may be down.
at MessageError.ExtendableBuiltin (/home/dani/anaconda3/envs/numerical_methods/share/jupyter/lab/staging/yarn.js:243:66)
...
My connection is fine, is the registry actually down???
This extension is great! Just wanted to suggest a feature: instead of going blank when editing a Python file, it could show a skeleton of the code with the class/method lines.
#34 added several new usages of this functionality. We should make sure that the sanitizer is used where appropriate.
I tried to update Python to 3.7 and I'm still running into a similar problem to the one described in issue #26.
Here is the complete set of steps I took:
conda --version
conda 4.5.8
conda create -n py37 jupyterlab python=3.7
source activate py37
conda install -c conda-forge nodejs
python --version
Python 3.7.0
jupyter --version
4.4.0
jupyter lab --version
0.32.1
jupyter labextension install @jupyterlab/toc
And the result:
jupyterlab-toc-0.3.1.tgz
Errored, use --debug for full output:
ValueError: No version of @jupyterlab/toc could be found that is compatible with the current version of JupyterLab. However, it seems to support a new version of JupyterLab. Consider upgrading JupyterLab.
Conflicting Dependencies:
JupyterLab Extension Package
>=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/application
>=0.16.4 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/apputils
>=1.1.3 <2.0.0 >=2.0.0 <3.0.0 @jupyterlab/coreutils
>=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/docmanager
>=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/fileeditor
>=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/notebook
>=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/rendermime
I don't understand how to read the table of conflicting dependencies.
My interpretation goes like this:
@jupyterlab/toc
requires @jupyterlab/application
to be 0.17.0 or newer, but it must be older than 0.18.0
@jupyterlab/application
requires jupyterlab to be 0.16.3 or newer, but it must be older than 0.17.0
Is that right? I don't think so, because my jupyterlab is 0.32.1, which is newer than all of the requirements listed in the table.
So, I'm confused and don't understand how to read this or how to debug it any further.
I'd like to ask the following questions:
What is the correct interpretation of the conflicting dependencies table?
What steps can I take to work around this issue? Is this a problem with my system? Or is it a bug in the package?
Thanks for any help!
jupyter labextension install --debug @jupyterlab/toc Searching ['/PHShome/ks38', '/PHShome/ks38/.jupyter', '/data/srlab/slowikow/src/miniconda2/envs/py37/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files Looking for jupyter_config in /etc/jupyter Looking for jupyter_config in /usr/local/etc/jupyter Looking for jupyter_config in /data/srlab/slowikow/src/miniconda2/envs/py37/etc/jupyter Looking for jupyter_config in /PHShome/ks38/.jupyter Looking for jupyter_config in /PHShome/ks38 > /data/srlab/slowikow/src/miniconda2/envs/py37/bin/npm pack @jupyterlab/toc npm notice npm notice ๐ฆ @jupyterlab/[email protected] npm notice === Tarball Contents === npm notice 2.1kB package.json npm notice 1.5kB LICENSE npm notice 1.2kB README.md npm notice 304B lib/extension.d.ts npm notice 3.2kB lib/extension.js npm notice 1.6kB lib/generators.d.ts npm notice 12.4kB lib/generators.js npm notice 81B lib/index.d.ts npm notice 373B lib/index.js npm notice 2.1kB lib/registry.d.ts npm notice 1.3kB lib/registry.js npm notice 3.2kB lib/toc.d.ts npm notice 4.9kB lib/toc.js npm notice 1.4kB style/index.css npm notice === Tarball Details === npm notice name: @jupyterlab/toc npm notice version: 0.3.1 npm notice filename: jupyterlab-toc-0.3.1.tgz npm notice package size: 9.5 kB npm notice unpacked size: 35.5 kB npm notice shasum: 0e46f30a3f99174b3e460448968ecc2bc6501496 npm notice integrity: sha512-nWhBFajzgK5UM[...]EXQK0f7bwxxng== npm notice total files: 14 npm notice jupyterlab-toc-0.3.1.tgz Fetching URL: https://registry.npmjs.org/@jupyterlab%2Ftoc Fetching URL: https://registry.npmjs.org/@jupyterlab%2Ftoc Traceback (most recent call last): File "/data/srlab/slowikow/src/miniconda2/envs/py37/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 71, in start ans = self.run_task() File "/data/srlab/slowikow/src/miniconda2/envs/py37/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 100, in run_task for arg in self.extra_args File "/data/srlab/slowikow/src/miniconda2/envs/py37/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 100, in <listcomp> for arg in self.extra_args File "/data/srlab/slowikow/src/miniconda2/envs/py37/lib/python3.7/site-packages/jupyterlab/commands.py", line 227, in install_extension return handler.install_extension(extension) File "/data/srlab/slowikow/src/miniconda2/envs/py37/lib/python3.7/site-packages/jupyterlab/commands.py", line 366, in install_extension info = self._install_extension(extension, tempdir) File "/data/srlab/slowikow/src/miniconda2/envs/py37/lib/python3.7/site-packages/jupyterlab/commands.py", line 1157, in _install_extension raise ValueError(msg) ValueError: No version of @jupyterlab/toc could be found that is compatible with the current version of JupyterLab. However, it seems to support a new version of JupyterLab. Consider upgrading JupyterLab. Conflicting Dependencies: JupyterLab Extension Package >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/application >=0.16.4 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/apputils >=1.1.3 <2.0.0 >=2.0.0 <3.0.0 @jupyterlab/coreutils >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/docmanager >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/fileeditor >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/notebook >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/rendermime Errored, use --debug for full output: ValueError: No version of @jupyterlab/toc could be found that is compatible with the current version of JupyterLab. However, it seems to support a new version of JupyterLab. Consider upgrading JupyterLab. Conflicting Dependencies: JupyterLab Extension Package >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/application >=0.16.4 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/apputils >=1.1.3 <2.0.0 >=2.0.0 <3.0.0 @jupyterlab/coreutils >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/docmanager >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/fileeditor >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/notebook >=0.16.3 <0.17.0 >=0.17.0 <0.18.0 @jupyterlab/rendermime
Full markdown/html support
Though I haven't tested it in real life, from what I see in the source, I suspect that the headings are detected from the lines beginning by #. In such case, only the first line in
will be used in the toc, despite the orther forms should. Perhaps use the jquery.find(:header)
for rendered cells to get the info.Installation fails with `shutil.SameFileError`
Here is a debug output
sudo jupyter labextension install @jupyterlab/toc --debug Searching ['/home/malte', '/root/.jupyter', '/usr/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files Looking for jupyter_config in /etc/jupyter Looking for jupyter_config in /usr/local/etc/jupyter Looking for jupyter_config in /usr/etc/jupyter Looking for jupyter_config in /root/.jupyter Looking for jupyter_config in /home/malte Node v11.8.0 > /usr/bin/npm pack @jupyterlab/toc npm notice npm notice ๐ฆ @jupyterlab/[email protected] npm notice === Tarball Contents === npm notice 2.1kB package.json npm notice 1.5kB LICENSE npm notice 1.2kB README.md npm notice 304B lib/extension.d.ts npm notice 3.3kB lib/extension.js npm notice 111B lib/generators/index.d.ts npm notice 403B lib/generators/index.js npm notice 474B lib/generators/latexgenerator.d.ts npm notice 2.4kB lib/generators/latexgenerator.js npm notice 1.0kB lib/generators/markdowndocgenerator/index.d.ts npm notice 8.1kB lib/generators/markdowndocgenerator/index.js npm notice 280B lib/generators/markdowndocgenerator/itemrenderer.d.ts npm notice 1.0kB lib/generators/markdowndocgenerator/itemrenderer.js npm notice 549B lib/generators/markdowndocgenerator/optionsmanager.d.ts npm notice 930B lib/generators/markdowndocgenerator/optionsmanager.js npm notice 1.1kB lib/generators/markdowndocgenerator/toolbargenerator.d.ts npm notice 1.7kB lib/generators/markdowndocgenerator/toolbargenerator.js npm notice 546B lib/generators/notebookgenerator/codemirror.d.ts npm notice 938B lib/generators/notebookgenerator/codemirror.js npm notice 300B lib/generators/notebookgenerator/heading.d.ts npm notice 180B lib/generators/notebookgenerator/heading.js npm notice 549B lib/generators/notebookgenerator/index.d.ts npm notice 21.9kB lib/generators/notebookgenerator/index.js npm notice 278B lib/generators/notebookgenerator/itemrenderer.d.ts npm notice 5.0kB lib/generators/notebookgenerator/itemrenderer.js npm notice 1.0kB lib/generators/notebookgenerator/optionsmanager.d.ts npm notice 2.6kB lib/generators/notebookgenerator/optionsmanager.js npm notice 941B lib/generators/notebookgenerator/tagstool/index.d.ts npm notice 4.7kB lib/generators/notebookgenerator/tagstool/index.js npm notice 348B lib/generators/notebookgenerator/tagstool/tag.d.ts npm notice 632B lib/generators/notebookgenerator/tagstool/tag.js npm notice 574B lib/generators/notebookgenerator/tagstool/tagslist.d.ts npm notice 2.1kB lib/generators/notebookgenerator/tagstool/tagslist.js npm notice 1.6kB lib/generators/notebookgenerator/toolbargenerator.d.ts npm notice 7.4kB lib/generators/notebookgenerator/toolbargenerator.js npm notice 1.1kB lib/generators/shared.d.ts npm notice 2.6kB lib/generators/shared.js npm notice 81B lib/index.d.ts npm notice 373B lib/index.js npm notice 2.8kB lib/registry.d.ts npm notice 1.8kB lib/registry.js npm notice 3.6kB lib/toc.d.ts npm notice 5.5kB lib/toc.js npm notice 559B style/img/autonumbering_darktheme.svg npm notice 343B style/img/autonumbering.svg npm notice 264B style/img/check.svg npm notice 320B style/img/code_darktheme.svg npm notice 305B style/img/code.svg npm notice 669B style/img/eyeball_hidden.svg npm notice 619B style/img/eyeball_hover.svg npm notice 617B style/img/eyeball_view.svg npm notice 357B style/img/markdown_darktheme.svg npm notice 363B style/img/markdown.svg npm notice 264B style/img/menu_arrow.svg npm notice 523B style/img/numbering.svg npm notice 762B style/img/tag_darktheme.svg npm notice 1.2kB style/img/tag.svg npm notice 202B style/img/toggle_down_darktheme.svg npm notice 181B style/img/toggle_down.svg npm notice 189B style/img/toggle_right_darktheme.svg npm notice 187B style/img/toggle_right.svg npm notice 9.0kB style/index.css npm notice 625B style/list-dark.svg npm notice 625B style/list-light.svg npm notice === Tarball Details === npm notice name: @jupyterlab/toc npm notice version: 0.6.0 npm notice filename: jupyterlab-toc-0.6.0.tgz npm notice package size: 24.5 kB npm notice unpacked size: 114.2 kB npm notice shasum: 393fe861404fa351ece7c4e326a4ddbd2076a39d npm notice integrity: sha512-ATlfAY3MhtUvM[...]Sy+NpN6U+RRWw== npm notice total files: 64 npm notice jupyterlab-toc-0.6.0.tgz Node v11.8.0 Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 81, in start logger=self.log, command=command) File "/usr/lib/python3.7/site-packages/jupyterlab/commands.py", line 274, in build command=command, clean_staging=clean_staging) File "/usr/lib/python3.7/site-packages/jupyterlab/commands.py", line 446, in build clean=clean_staging File "/usr/lib/python3.7/site-packages/jupyterlab/commands.py", line 871, in _populate_staging shutil.copy(pjoin(HERE, 'staging', fname), target) File "/usr/lib/python3.7/shutil.py", line 245, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "/usr/lib/python3.7/shutil.py", line 104, in copyfile raise SameFileError("{!r} and {!r} are the same file".format(src, dst)) shutil.SameFileError: '/usr/lib/python3.7/site-packages/jupyterlab/staging/index.js' and '/usr/lib/python3.7/site-packages/jupyterlab/staging/index.js' are the same file Errored, use --debug for full output: shutil.SameFileError: '/usr/lib/python3.7/site-packages/jupyterlab/staging/index.js' and '/usr/lib/python3.7/site-packages/jupyterlab/staging/index.js' are the same file
I guess it has something to do with the way I installed jupyter lab, because I use the pacman package manager of arch linux instead of pip. Thats also why I try to install the extension system wide.
Is there any way of getting around this by, e.g. forcing the installer to ignore this?
I mean from what I understand of the message, the installation is failing because a file that it needs is already there, so why is this failing anyways?Latest Tag (0.6.0) not compatible with Jupyter1.0
Hi there when installing this extension I get the following error:
Conflicting Dependencies:
JupyterLab Extension Package=1.0.0-alpha.3 <2.0.0 >=0.19.1 <0.20.0 @jupyterlab/application
=1.0.0-alpha.3 <2.0.0 >=0.19.1 <0.20.0 @jupyterlab/apputils
=1.0.0-alpha.3 <2.0.0 >=0.19.1 <0.20.0 @jupyterlab/docmanager
=1.0.0-alpha.3 <2.0.0 >=0.19.1 <0.20.0 @jupyterlab/fileeditor
=1.0.0-alpha.4 <2.0.0 >=0.19.1 <0.20.0 @jupyterlab/notebook
=1.0.0-alpha.3 <2.0.0 >=0.19.1 <0.20.0 @jupyterlab/rendermimeSteps to reproduce
$ jupyter-lab --version
1.0.0a1$jupyter labextension install @jupyterlab/toc
Would you mind creating a new tag that's compatible with Jupyter1.0
I was able to download and install the dev version in the interim
Kind Regards,
Alexis.Upgrade jupyterlab depedencies to work with jupyterlab 0.33.0
"[email protected]" is not compatible with the current JupyterLab Conflicting Dependencies: JupyterLab Extension Package >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/application >=0.17.2 <0.18.0 >=0.16.2 <0.17.0 @jupyterlab/apputils >=2.0.2 <3.0.0 >=1.0.0 <2.0.0 @jupyterlab/coreutils >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/docmanager >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/fileeditor >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/notebook >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/rendermime
Filtering by tags should be toggle-able
- Select a tag.
- Press "Filter". The cells without that tag are removed.
- Press "Filter" again. Nothing happens.
- Unselect the tag. Nothing happens.
I found this behavior confusing. I think it makes more sense to have filter be a toggle-able item. I'm not sure how to describe the current behavior.
How to customize the indent size of TOC
Feature request: highlight current/running cells, as in TOC2
First of all, thanks for your work in creating this extension! I very much would like to switch to JupyterLab, but I'm feeling somewhat held back by many of the extensions from https://github.com/ipython-contrib/jupyter_contrib_nbextensions not being ported yet.
This plugin goes a long way in re-creating the functionality of the "TOC2" plugin for the traditional notebook, and the core functionality already looks very solid. The one feature I really miss is the color highlights that TOC2 has to indicate "sections with selected elements", and "sections with running cells". Is there any chance to implement this in
jupyterlab-toc
?I really wish I could help on this with a pull-request, but sadly I don't really know anything about frontend development (anything js), so this may be a bit out of my reach.
Cell edit mode with TOC
I just noticed -- if you have an active cursor in a cell (in edit mode) when you click on a TOC entry:
- If it refers to a markdown cell, it jumps to the cell and makes the cell in edit mode as well.
- If the TOC entry is from a generated markdown header (as implemented in #15), it jumps to the code block that generated it, and not the place in the notebook with the header.
In case 1, I expect my active cursor to stay in the cell I was at (and just jump my view in the notebook to the markdown cell in question), or leave the active cell (no longer be in edit mode).
In case 2, I expect to jump to the specific place in the notebook with the generated markdown header being displayed, not the place in the code that generated it (if I have a long list of figures being made, delineated by markdown headers, I'd like to be able to just jump to my figure in question, not the top code block), with the same behavior for the cursor as case 1.
Thanks again for all the active development, and for the great plugin! I use it daily, and it is a real lifesaver!
Additional markdown headings in cell are ignored
Thanks again for the continued progress! I've noticed a regression -- if a markdown cell in a notebook has more than one heading, for example:
# Level 1 heading ## Level 2 heading # New level 1
Only the first
Level 1 heading
shows up in the TOC. It used to be the case that all headings were there, but now, to get them to show up, I have to split these markdown cells (into 3, for this example) so each has the heading as the first line of the cell. It would be nice if we were able to have the previous behavior back where all headings within a cell are captured.Ignore some generated headers in output cells, or collapse TOC entries
Thanks again for the update you made in #15 -- I regularly add to my TOC by displaying markdown snippets in my output cells.
However, I have recently come across the pandas-profiling module, which allows for the creating of a neat pd.DataFrame summary report (via
pandas_profiling.ProfileReport(df)
). This, however, creates a lot of top-level headings that end up getting captured by the TOC plugin.So, for this feature request -- could we have any way to turn off the capturing of headings in certain output cells? Perhaps a right-click on the cell in question, with a menu item saying "ignore output in TOC", or something like that.
Alternatively, if the Headings in TOC themselves can be collapsed (a little different from #12, as this isn't collapsing the cell contents, but the TOC entry itself), this would probably be sufficient. Perhaps allow the highest level TOC entry to collapse to a "..." to conserve space, but still notify the user that there is something there, if they care to expand it.
And, once again, thank you for this great plugin!
Code section in markdown generates heading
Hi,
When inserting a block of code in a md file, it seems that the content of this code block can generate headings.
For example, in any section of my md file, if I add the following code-block:# test
it will generate a level-1 heading "test" in the TOC.
Using toc to jump to the specified content is easy to trigger to edit the target cell
Click the corresponding menu to enter the editing state, click the jump event after the start of automatic editing cells?
Click the menu - > to jump to the specified content - > edit cell ?
There is a high probability that the process is this, which should be a bug because the process is so unreasonable.I just want to jump to the specified content, not edit the header cells.
Goto with simple-click, expand/collapse with double-click
Hi,
As of today, it seems to me that simple-clicking and double-clicking have the same effect in the toc extension.
When trying the new expand/collapse header sections, I expected to be able to collapse/expand the header section when doublie-clicking - which today only takes me to that header.Would it be possible to implement this double-click behavior ? It'd feel very intuitive IMO.
I know it is possible to collapse/expand sections when clicking the arrow, which is a nice feature, but I think double-clicking the header would be more convenient.Hope this is clear !
Last File content stays in the tab
Hi @ian-r-rose,
first thanks a lot for this great toc2-like extension, I'm really enjoying it and looking forward this project.
I noticed that after I close all my tabs, the content of the last file I used is still in the "Content" tab. It is not really an issue, but probably not an intended behaviour.
Cheers
Always out of sync with Anaconda
Having taught Anaconda python over a couple years, this version seems persistently out of sync with Anaconda. Given that Anaconda is the most popular version of jupyterlab by an order of magnitude, it seems entirely unreasonable that there is no clear instructions on how to roll this amazing feature in.
I've tried reverting to previous versions and their dependencies are either too new or too old. It is very frustrating as teaching with jupyterlab is a very important use case. Simplified instructions would also be of great help to students. That being said, I understand the need for advanced development features, but I am surprised that this program constantly needs bleeding edge features that upgrade it outside of the major python market.
features
Hi, as one of the authors and maintainers of the toc2 nbextension, I really appreciate this port to jupyterlab!
I would like to share some thoughts and experience on this
- automatic section numbering is a very useful feature. In toc2 we have a parameter to enable it and fix the depth of numbering. In an early version we had a link in the toc header to toggle on/off numbering; (the depth of sections to show in the toc is also a parameter).
- though it might seem redundant, lot of users like the possibility to insert a "toc cell" at the beginning of the notebook
- the toc2 cooperates with the collapsible headings nbextension. (Un)Collapsing a section in the toc/notebook (un)collapses it the notebook/toc. We simply have an event triggered and processed by the other nbextension.
- it is very useful to have the toc exported when exporting to html. Currently we add the toc2 javascript logic as a script into the exported html document. This is done via a dedicated exporter. In principle this could survive to the lab transition (?).
- some users like to have the sections with cells currently executed to be be highlighted in the toc, to follow the processing of their notebook
- it is useful to have a mark displayed in the toc pointing the current section while scrolling into the notebook.
Thanks for your work on that!I don't know (yet) typescript and haven't digged into the source to understand the new API, so unfortunately I can't really help for now...
Stuck resolving packages when installing
When installing
jupyterlab-toc
, the process is stuck "resolving packages". As of this writing, I have been waiting roughly 15 minutes and I haven't aborted the process yet. My juputerlab notebook server is running at the time of install.jupyter labextension install jupyterlab-toc > /usr/local/bin/npm pack jupyterlab-toc npm notice npm notice ๐ฆ [email protected] npm notice === Tarball Contents === npm notice 1.6kB package.json npm notice 863B README.md npm notice 1.5kB LICENSE npm notice 2.9kB lib/extension.js npm notice 11.3kB lib/generators.js npm notice 373B lib/index.js npm notice 1.5kB lib/registry.js npm notice 6.5kB lib/toc.js npm notice 304B lib/extension.d.ts npm notice 1.1kB lib/generators.d.ts npm notice 81B lib/index.d.ts npm notice 2.1kB lib/registry.d.ts npm notice 3.2kB lib/toc.d.ts npm notice 2.1kB style/index.css npm notice === Tarball Details === npm notice name: jupyterlab-toc npm notice version: 0.2.1 npm notice filename: jupyterlab-toc-0.2.1.tgz npm notice package size: 9.5 kB npm notice unpacked size: 35.5 kB npm notice shasum: edd570ba1a523e3e2bf5811b9995f9a99e0c4fe4 npm notice integrity: sha512-toWEuuN9zi3NM[...]qkQRGoDWupk+g== npm notice total files: 14 npm notice jupyterlab-toc-0.2.1.tgz > node /usr/local/anaconda3/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install yarn install v1.5.1 (node:2376) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. info No lockfile found. [1/4] ๐ Resolving packages... โ jupyterlab-toc@file:../extensions/jupyterlab-toc-0.2.1.tgz
I am new to jupyter and jupyterlab so please bear with me.
I have installed jupyterlab via
conda install -c conda-forge jupyterlab
and I have the current version ofconda
installed since earlier.I started the jupyterlab notebook at a specific directory:
jupyter lab --NotebookApp.notebook_dir=/Users/me/blah/Jupyter/JupyterLab/Notebooks
Multiple heading in same cell
Hi,
I noticed that if I have multiple markdown headings in the same cell, all the headings are indeed in the toc, but they all take me to the top of that cell.
Maybe if multiple headings are in the same cell, the links in the toc should bring you to that heading, and not to the top of the cell of that heading ?ValueError about nodejs
I am trying to install the extension and I am getting an error:
(py36) [myserver ~]$ jupyter labextension install @jupyterlab/toc --debug Searching ['/home/myuser', '/home/myuser/.jupyter', '/path/to/anaconda/envs/py36/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files Looking for jupyter_config in /etc/jupyter Looking for jupyter_config in /usr/local/etc/jupyter Looking for jupyter_config in /path/to/anaconda/envs/py36/etc/jupyter Looking for jupyter_config in /home/myuser/.jupyter Looking for jupyter_config in /home/myuser Traceback (most recent call last): File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab/labextensions.py", line 77, in start ans = self.run_task() File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab/labextensions.py", line 106, in run_task for arg in self.extra_args File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab/labextensions.py", line 106, in <listcomp> for arg in self.extra_args File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab/commands.py", line 221, in install_extension return handler.install_extension(extension) File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab/commands.py", line 413, in install_extension info = self._install_extension(extension, tempdir) File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab/commands.py", line 1261, in _install_extension info = self._extract_package(extension, tempdir) File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab/commands.py", line 1329, in _extract_package ret = self._run([which('npm'), 'pack', source], cwd=tempdir, quiet=quiet) File "/path/to/anaconda/envs/py36/lib/python3.6/site-packages/jupyterlab_launcher/process.py", line 59, in which raise ValueError(msg) ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website. Errored, use --debug for full output: ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
I am not sure what the error is: I installed nodejs with conda:
conda list nodejs # packages in environment at /path/to/anaconda/envs/py36: # # Name Version Build Channel nodejs 9.11.1 0 conda-forge
Also, the correct version of node seems to be used:
(py36) [myserver ~]$ which node /path/to/anaconda/envs/py36/bin/node
What am I doing wrong?
"@jupyterlab/toc" is not a valid npm package ??
I had to uninstall this for a minute since the most recent Conda packages clashed with toc's requirements a couple of weeks ago. I updated conda again today and thought I'd check to see if the dependencies had worked themselves out, but got this error message, instead.
Markdown heading visual anchors inconsistent
[JupyterLab 0.35.4]
When defining headings in Markdown cells, Jupyter Notebook and Jupyter Lab do not provide the same behaviour. Jupyter Notebook correctly provides visual anchor elements for each heading and subheading, whereas Jupyter Lab only shows the anchor for a particular subheading.
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Some Title\n", "## Sub Title\n", "***" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Contents" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }
Upon further inspection, the anchor tag isn't being generated for some of the headings. If I run
headerAnchors
on the root html node which contains the markdown, all anchors are correctly generated.
This is the relevant HTML generated for the first cell:<div class="p-Widget jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown"><h1 id="Some-Title">Some Title</h1> <h2 id="Sub-Title">Sub Title<a target="_self" href="#Sub-Title" class="jp-InternalAnchorLink">ยถ</a></h2> <hr> </div>This is the line of code which runs the anchor generation routine: https://github.com/jupyterlab/jupyterlab/blob/63090ad07a78574b1aea6ba82e1fe3ab08f9c89b/packages/rendermime/src/renderers.ts#L344
TypeError: the JSON object must be str, not 'bytes'
I successfully installed and use jupyterlab-toc:
jupyter labextension list JupyterLab v0.32.1 Known labextensions: app dir: /data/srlab/slowikow/src/miniconda2/envs/py3/share/jupyter/lab jupyterlab-toc jupyterlab-toc v0.2.1 enabled OK
Today, I decided to try to upgrade to v0.3.1, but I get an error:
jupyter labextension install @jupyterlab/toc > /data/srlab/slowikow/src/miniconda2/envs/py3/bin/npm pack @jupyterlab/toc jupyterlab-toc-0.3.1.tgz Errored, use --debug for full output: TypeError: the JSON object must be str, not 'bytes'
It seems like an easy bug to fix, but I don't know which file has the buggy code.
I hope you can help!
Thanks for the great extension ๐
Here are more details:
jupyter labextension install --debug @jupyterlab/toc
jupyter labextension install --debug @jupyterlab/toc Searching ['/PHShome/ks38', '/PHShome/ks38/.jupyter', '/data/srlab/slowikow/src/miniconda2/envs/py3/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files Looking for jupyter_config in /etc/jupyter Looking for jupyter_config in /usr/local/etc/jupyter Looking for jupyter_config in /data/srlab/slowikow/src/miniconda2/envs/py3/etc/jupyter Looking for jupyter_config in /PHShome/ks38/.jupyter Looking for jupyter_config in /PHShome/ks38 > /data/srlab/slowikow/src/miniconda2/envs/py3/bin/npm pack @jupyterlab/toc jupyterlab-toc-0.3.1.tgz โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ โ โ Update available 5.6.0 โ 6.2.0 โ โ Run npm i -g npm to update โ โ โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ Fetching URL: https://registry.npmjs.org/@jupyterlab%2Ftoc Traceback (most recent call last): File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/labextensions.py", line 71, in start ans = self.run_task() File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/labextensions.py", line 100, in run_task for arg in self.extra_args File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/labextensions.py", line 100, in for arg in self.extra_args File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/commands.py", line 227, in install_extension return handler.install_extension(extension) File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/commands.py", line 366, in install_extension info = self._install_extension(extension, tempdir) File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/commands.py", line 1138, in _install_extension version = self._latest_compatible_package_version(name) File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/commands.py", line 1202, in _latest_compatible_package_version metadata = _fetch_package_metadata(self.registry, name, self.logger) File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/site-packages/jupyterlab/commands.py", line 1588, in _fetch_package_metadata return json.load(response) File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/json/__init__.py", line 268, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/data/srlab/slowikow/src/miniconda2/envs/py3/lib/python3.5/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes' Errored, use --debug for full output: TypeError: the JSON object must be str, not 'bytes'Feature Request: add a expand/collapse all
I think it'd be great to have a button that allows you to expand or collapse everything in the TOC.
Thanks for everything !jupyter 0.33 and python2.7
Hi
Not sure:can i install this extension for jupyterlab 0.33 and python 2.7 ?
That s only work for python3.6, isn t itregards
Fabien
No nesting and ยถ erroneously appears
MD parsing bug
The following :
### foo - bar ```python # python code here \``` --> just an arrow
(remove the last backslash) renders as :
0.0.1 foo
- python code here
1.1 ```The problem seems to be coming from the first two dashes of the arrow.
Thumbs up for the new numbering feature !
How to integrate TOC in file
Hi
This is a great life savior for long files. While I could use on left pane, I also wish I could integrate this TOC on top of my markdown file. Is it possible? If not can you kindly integrate it?
Dependecies issues during installation
Hi,
I installed JupyterLab and the first thing I tried to do is install your extension. But I am not able to do that due to the following errors.
npm notice npm notice ๐ฆ @jupyterlab/[email protected] npm notice === Tarball Contents === npm notice 2.1kB package.json npm notice 1.5kB LICENSE npm notice 1.2kB README.md npm notice 304B lib/extension.d.ts npm notice 3.3kB lib/extension.js npm notice 1.6kB lib/generators.d.ts npm notice 12.4kB lib/generators.js npm notice 81B lib/index.d.ts npm notice 373B lib/index.js npm notice 2.1kB lib/registry.d.ts npm notice 1.3kB lib/registry.js npm notice 3.2kB lib/toc.d.ts npm notice 4.9kB lib/toc.js npm notice 1.6kB style/index.css npm notice 625B style/list-dark.svg npm notice 625B style/list-light.svg npm notice === Tarball Details === npm notice name: @jupyterlab/toc npm notice version: 0.4.0 npm notice filename: jupyterlab-toc-0.4.0.tgz npm notice package size: 9.9 kB npm notice unpacked size: 37.1 kB npm notice shasum: 197db58e4a9f8d5ca776800cd6b6c5eaf09adeae npm notice integrity: sha512-6n2CWkkHvPePS[...]Cm1wY959ZU86Q== npm notice total files: 16 npm notice jupyterlab-toc-0.4.0.tgz Errored, use --debug for full output: ValueError: "@jupyterlab/[email protected]" is not compatible with the current JupyterLab Conflicting Dependencies: JupyterLab Extension Package >=0.15.4-0 <0.16.0-0 >=0.18.0-0 <0.19.0-0 @jupyterlab/application >=0.15.4-0 <0.16.0-0 >=0.18.0-0 <0.19.0-0 @jupyterlab/apputils >=1.0.6-0 <2.0.0-0 >=2.1.0-0 <3.0.0-0 @jupyterlab/coreutils >=0.15.4-0 <0.16.0-0 >=0.18.0-0 <0.19.0-0 @jupyterlab/docmanager >=0.15.4-0 <0.16.0-0 >=0.18.0-0 <0.19.0-0 @jupyterlab/fileeditor >=0.15.4-0 <0.16.0-0 >=0.18.0-0 <0.19.0-0 @jupyterlab/notebook >=0.15.4-0 <0.16.0-0 >=0.18.0-0 <0.19.0-0 @jupyterlab/rendermime
I am not sure if that is related to any recent update at JL
Thanks
Make appearance of toc in sidebar context aware
The "cell tools" tab on the left sidebar only appears when a jupyter notebook is open. It would be nice if this extension did something similar.
Especially once jlab enables undocking of sidebar tabs. It'd personally move toc to the right sidebar (yes jlab does have a right sidebar already), and have all of the tabs that are dependant on open files on the right.
NodeJs 5+ error when installing jupyterlab-toc
This error may well look as mysterious to you as it does to me, but I'll post it just in case someone might be able to clue me in.
> jupyter labextension install jupyterlab-toc Errored, use --debug for full output: ValueError: Please install nodejs 5+ and npm before continuing. nodejs may be installed using conda or directly from the nodejs website.
Many of us a delighted you did this (THANKS!). Do you have any plans to add conda support?
Capture Headings from Generated Markdown
First off, thank you for a great extension! Very useful to help organize long documents. One area that this doesn't touch, however, is if one code-block outputs a lot of figures, tables, etc, and we would like to break it up into chunks. This can be done with
IPython.display.Markdown
(as seen in this link), but the toc extension is not currently capturing these headings.So, a feature request: Capture Headings displayed with
IPython.display.Markdown
as well, so you can quickly jump to a particular part of a code-block's output.Thanks again!
Links do not work in first Markdown heading of each cell
This bug only manifests for the very first heading in any given cell, and only if the very first text in the cell is the heading in question. It does not matter what level of heading it is (so it could be sub-sub-sub heading and still yield the same problem). For example, the heading
## [Visit Google](https://www.google.com/)
would appear as if it were a regular heading without a link, and would not be clickable โ but only if it were the very first text to appear in the cell, regardless of where in the cell it appears.(Tested on jupyterlab 0.35.4, Windows 10.)
Use statedb instead of cell metadata
The storing of ToC view-state in cell metadata seems like an unnecessary editing of the user's notebook to me. We should see if we can store that in the statedb instead.
Foldable TOC entries for Markdown files
Thanks for the great progress with this extension! I am loving the new features!
Perhaps this is already on the roadmap, but I noticed folding TOC entries in Markdown files (or their previews) is not currently implemented. This would be a great addition/ extension of the awesome work you guys have done with TOC entry folding for notebooks!
Is this compatible with JLab 0.33.4?
If so, has it been published?
C:\> jupyter labextension install jupyterlab-toc > C:\Miniconda3\npm.CMD pack jupyterlab-toc npm WARN deprecated [email protected]: This package has been renamed '@jupyterlab/toc' jupyterlab-toc-0.2.1.tgz Failed to fetch package metadata for 'jupyterlab-toc': URLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)'),) Failed to fetch package metadata for 'jupyterlab-toc': URLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)'),) Errored, use --debug for full output: ValueError: No version of jupyterlab-toc could be found that is compatible with the current version of JupyterLab. Conflicting Dependencies: JupyterLab Extension Package >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/application >=0.17.2 <0.18.0 >=0.16.2 <0.17.0 @jupyterlab/apputils >=2.0.2 <3.0.0 >=1.0.0 <2.0.0 @jupyterlab/coreutils >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/docmanager >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/fileeditor >=0.17.2 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/notebook >=0.17.3 <0.18.0 >=0.16.0 <0.17.0 @jupyterlab/rendermime
The SSL issues are a bit suspicious however I can definitely install other extensions without any problem.
Simplify codebase
The new functionality in
@jupyterlab/toc
is awesome, but some if it is kind of hard to maintain and understand. In particular, the notebook generator is over 500 lines long with many branches. We should try to modularize and simplify this.@markellekelly, do you have any cycles to devote to this, and you able to have a video chat at some point to come up with a strategy?
Check if cell tags are an array
Skip H1 headers
It is common to start a notebook with a title, like:
# My notebook title Some information ## My first "real" title > code
Here, I don't want the title of the notebook to be numbered.
An interesting feature of the ToC 2 extension was to skip the h1 headers in the automatic numbering.
Is it possible to do the same with jupyterlab-toc? If not, is it a feature that could be included in the road map?
Thank you.
Installation fails because git repository is renamed
I try to install the toc addon with
$ jupyter labextension install @jupyterlab/toc
but the installation fails because the git repo seems to be renamed:
npm ERR! git clone [email protected]:jupyterlab/toc ERROR: Repository not found. npm ERR! git clone [email protected]:jupyterlab/toc fatal: Could not read from remote repository. npm ERR! git clone [email protected]:jupyterlab/toc npm ERR! git clone [email protected]:jupyterlab/toc Please make sure you have the correct access rights npm ERR! git clone [email protected]:jupyterlab/toc and the repository exists. npm ERR! addLocal Could not install jupyterlab/toc npm ERR! Error: ENOENT, stat 'jupyterlab/toc' npm ERR! If you need help, you may report this log at: npm ERR! <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR! <[email protected]> npm ERR! System Linux 4.17.14-1.el6.elrepo.x86_64 npm ERR! command "node" "/usr/bin/npm" "pack" "@jupyterlab/toc" npm ERR! cwd /tmp/nbraun/tmp8l4__knr npm ERR! node -v v0.10.48 npm ERR! npm -v 1.3.6 npm ERR! path jupyterlab/toc npm ERR! code ENOENT npm ERR! errno 34 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /tmp/nbraun/tmp8l4__knr/npm-debug.log npm ERR! not ok code 0
Apart from that: very useful package!
How to install extension in home directory?
goerz@mlhpc2:~> /home/goerz/.conda/envs/default/bin/jupyter labextension install jupyterlab-toc PermissionError: [Errno 13] Permission denied: '/usr/local/anaconda/share/jupyter/lab/extensions'
Is there any way to install the extension in my home directory?
Feature Request : search/find text
Hi,
I'm not sure this is the right place for such a feature, but I would find it usefull to have a search bar at the top of the toc tab, that allows one to find text inside the document that is being edited. The extension could then highlight the headers that contains such text.
Cheers
Section headers in non-rendered MD cells always appear as foldable
Hi there,
This extension is looking awesome - thanks for the hard work!
I just wanted to report a very minor bug. It seems that when a markdown cell with a section header is in edit mode (not rendered as markdown), that section has a folding triangle next to it in the left area, even when it doesn't have children to display. Clicking the triangle toggles the icon, but has no other effect.
Demonstrated in Section 2. in the following screenshot.
When the cell is re-rendered, the triangle disappears, but only after selecting another cell.
Similarly, when the cell is un-rendered, the triangle reappears, but only after selecting another cell.Again, very minor, but thought it would be good to point out in case it comes up again later.
Thanks!
OliverWeird rendering
While playing around with a markdown file, I noticed the following text in my md file:
# --foo --
renders in the toc as :
--foo # --foo
I'm guessing a parsing bug ?
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
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 โค๏ธ Open Source for everyone.
Alibaba
Alibaba Open Source for everyone
D3
Data-Driven Documents codes.
Tencent
China tencent open source team.