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.1.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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jupyter_notebook_toc-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 63437334e36e32a36ec36c2caaa42921ffa06a6e7e64ff85a86de928e5133b22
MD5 644a0dd1587af6b4b3d4749978812448
BLAKE2b-256 1cf2f5094bff19a597de5ec4d130eef81aa9d85ba09d8b3673864a248dd56531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jupyter_notebook_toc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b3b692e98ae4147f7be48b3ad8bdfd676d274d86ad35979519b877d3da0897e2
MD5 a221dbea2561e1990879b5a10be264bc
BLAKE2b-256 7f8b1a3163293f2e56e167cbb7071c87b3b46d2d00b17be9f112843c0f5e2b47

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