Skip to content

Generate simplified table of contents for Jupyter Notebooks based on @xelad0m's extension.

License

Notifications You must be signed in to change notification settings

validbeck/jupyter-notebook-toc

 
 

Repository files navigation

Simplified table of contents for Jupyter Notebooks

This VS Code extension based off of xelad0m/vscode-jupyter-toc is customized for ValidMind's Jupyter Notebook conventions.

The extension functions more or less the same with the following differences (tl;dr our version allows us to add, udpate, and remove ToCs with ease without needing to hack-replace anchor links and manually adjust tables and anchors if the notebooks were ever edited):

Version comparison
Original ver. Simplified ver. Notes Reason for fix
Page anchors set above header instead of inset after markdown heading, no reverse anchors to top in page anchors Original version was not parsed correctly by Quarto and broke the native ToC, required us to manually find-replace anchor link formatting in each notebook after ToC generation, if notebooks were modified the ToC/anchors would need to be edited manually
Top/reverse anchor in table of contents cell removed, default heading changed Required us to hack the default settings to remove the icon-anchor back up to the table of contents
Reduced global settings, defaults set to ValidMind conventions; added a setting for hiding the embedded table of contents cell using Quarto conditional content Required us to adjust the default settings to accommodate for the default structuring of ValidMind Juptyer Notebooks; embedded table of contents cell always rendered by Quarto

User guide

Refer to the User guide for installation and usage instructions.

Updating the extension

Key files

Before you begin

You'll need to install the dependencies required for you to work on the extension for the first time:

npm install

Then install @vscode/vsce locally in your project directory in preparation for packaging:

npm install @vscode/vsce

Update the version

Before you re-package the extension, make sure to bump the version so we can keep track of changes:

npm version patch

Export the extension

Compile the code:

npm run compile

Since this extension is for internal use and we don't want to publish it to the VS Code marketplace, we'll package the extension and move the exported file into the installation directory:

npx vsce package && mv *.vsix installation

About

Generate simplified table of contents for Jupyter Notebooks based on @xelad0m's extension.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%