Metadata-Version: 2.2
Name: jupyter-notebook-toc
Version: 0.2.2
Summary: A tool to generate table of contents for Jupyter notebooks
Home-page: https://github.com/Viktor-Sjoberg/jupyter-notebook-toc
Author: Viktor Sjöberg
Author-email: viktor@alfrida.se
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nbformat>=5.0.0
Requires-Dist: jupyter>=1.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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
- Automatic notebook detection
- Hyperlinks to sections

## Installation

```bash
pip install jupyter-notebook-toc
```

## Usage

```python
import jupyter_notebook_toc.core as toc_gen

# Generate TOC from the current notebook
toc = toc_gen.generate_toc()
print(toc)

# Or specify a notebook file
toc = toc_gen.generate_toc("path/to/your/notebook.ipynb")
print(toc)

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

## Command Line Usage

```bash
# Generate TOC from current notebook
jupyter-toc

# Generate TOC from specific notebook
jupyter-toc path/to/your/notebook.ipynb

# Save TOC to file
jupyter-toc -o table_of_contents.md
```

## Example Output

```markdown
# Table of Contents

1. [Introduction](#introduction)
    1.1. [Background](#background)
    1.2. [Purpose](#purpose)
2. [Methodology](#methodology)
    2.1. [Data Collection](#data-collection)
    2.2. [Analysis](#analysis)
3. [Results](#results)
    3.1. [Findings](#findings)
    3.2. [Discussion](#discussion)
```

## Development

To set up the development environment:

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

## License

MIT License - see LICENSE file for details 
