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.0.tar.gz (4.5 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.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jupyter_notebook_toc-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 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.0.tar.gz
Algorithm Hash digest
SHA256 127324b868ac5d74861b997d43eeb3dee68cb027230fa354c7c617c8a3278c49
MD5 2b7570cb8015e2731f0f63355c63e618
BLAKE2b-256 f24864de1a9ffcdb203d56b111e6469c66c1d7ffc816aff3b14f19cbde79d0c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jupyter_notebook_toc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c368741d77cace117b6e55b8c107df476cd1d915e64f91aab1f37b54bbb35a5
MD5 d97e48c4f6a4000b57c301da6b43d4a3
BLAKE2b-256 708ca48319ee69683197250a330ef6dd979d093cc53f9cbba6870e9656f1db09

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