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.2.tar.gz (4.6 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.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jupyter_notebook_toc-0.1.2.tar.gz
  • Upload date:
  • Size: 4.6 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.2.tar.gz
Algorithm Hash digest
SHA256 6031eac88036aaf41b9235328164591f5ccb6628bf51f5b345101927764cb22b
MD5 a0f9488909bb13e54e19b99bc684e1dc
BLAKE2b-256 ab2b5173550f6bb21c0ee1f777200685292877a178094a85fb5ff197a379e1e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jupyter_notebook_toc-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 534e4048f9ff3e1c08488b14d6154a8174ed3c64b94a7fcaff873a8e2680a2dd
MD5 6d3a7b2585002961a0ad3ba7243cc6e5
BLAKE2b-256 89dc496705df1f43865e3c10be1df8acb4509d757c44f7cedb8e2f580bb2d156

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