Skip to main content

A tool to generate table of contents for Jupyter notebooks

Project description

Jupyter Notebook Table of Contents Generator

A Python library that automatically generates a table of contents for Jupyter notebooks by scanning markdown cells for headers.

Features

  • Scans Jupyter notebooks for markdown cells
  • Identifies headers (H1, H2, H3) using "#", "##", and "###" syntax
  • Generates a formatted table of contents with proper indentation
  • Supports numbered sections
  • Easy to integrate into existing notebooks

Installation

pip install jupyter-toc-generator

Usage

from jupyter_toc_generator import generate_toc

# Generate TOC from a notebook file
toc = generate_toc("path/to/your/notebook.ipynb")

# Print the generated TOC
print(toc)

# Or save it to a file
with open("table_of_contents.md", "w") as f:
    f.write(toc)

Example Output

# Table of Contents

1. Introduction
   1.1. Background
   1.2. Purpose
2. Methodology
   2.1. Data Collection
   2.2. Analysis
3. Results
   3.1. Findings
   3.2. Discussion

Development

To set up the development environment:

  1. Clone the repository
  2. Install development dependencies:
    pip install -r requirements-dev.txt
    
  3. Run tests:
    pytest
    

License

MIT License - see LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_notebook_toc-0.1.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupyter_notebook_toc-0.1.3-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_notebook_toc-0.1.3.tar.gz.

File metadata

  • Download URL: jupyter_notebook_toc-0.1.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for jupyter_notebook_toc-0.1.3.tar.gz
Algorithm Hash digest
SHA256 27375e89bfb4570f55c2bb6566d62e48fa923652ab38b456e819b4150e928c64
MD5 5f025be70212ced9b580752402177cc9
BLAKE2b-256 6d364362126df049568ddca63f5a581ab41b250289073edb9d2a7db3029d5185

See more details on using hashes here.

File details

Details for the file jupyter_notebook_toc-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_notebook_toc-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 99ebae3193ad0dc2cb9d722355d11355ad50d86ba761b887ff2981084e604651
MD5 db3b8126c1f659c34c00475579855a72
BLAKE2b-256 a73ecd0bab99e3bcd7c200856b8390332e6353f9483155e83c8812dbf40fad76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page