Skip to main content

MkDocs plugin treating Jupyter notebooks, Python scripts and Markdown files as first-class citizens for documentation with dynamic execution and real-time synchronization

Project description

nbsync

PyPI Version Python Version Build Status Coverage Status

Connect Jupyter notebooks to your MkDocs documentation

nbsync is a MkDocs plugin that seamlessly embeds Jupyter notebook visualizations in your documentation, solving the disconnect between code development and documentation.

Why Use nbsync?

The Documentation Challenge

Data scientists, researchers, and technical writers face a common dilemma:

  • Development happens in notebooks - ideal for experimentation and visualization
  • Documentation lives in markdown - perfect for narrative and explanation
  • Connecting the two is painful - screenshots break, exports get outdated

Our Solution

This plugin creates a live bridge between your notebooks and documentation by:

  • Keeping environments separate - work in the tool best suited for each task
  • Maintaining connections - reference specific figures from notebooks
  • Automating updates - changes to notebooks reflect in documentation

Key Benefits

  • True Separation of Concerns: Develop visualizations in Jupyter notebooks and write documentation in markdown files, with each tool optimized for its purpose.

  • Intuitive Markdown Syntax: Use standard image syntax with a simple extension to reference notebook figures: ![alt text](notebook.ipynb){#figure-id}

  • Automatic Updates: When you modify your notebooks, your documentation updates automatically in MkDocs serve mode.

  • Clean Source Documents: Your markdown remains readable and focused on content, without code distractions or complex embedding techniques.

  • Enhanced Development Experience: Take advantage of IDE features like code completion and syntax highlighting in the appropriate environment.

Quick Start

1. Installation

pip install nbsync

2. Configuration

Add to your mkdocs.yml:

plugins:
  - nbsync:
      src_dir: ../notebooks

3. Mark Figures in Your Notebook

In your Jupyter notebook, identify figures with a comment:

# #my-figure
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(8, 4))
ax.plot([1, 2, 3, 4], [10, 20, 25, 30])

4. Reference in Markdown

Use standard Markdown image syntax with the figure identifier:

![Chart description](my-notebook.ipynb){#my-figure}

Advanced Usage

For more detailed information on how to use nbsync, see:

The Power of Separation

Creating documentation and developing visualizations involve different workflows and timeframes. When building visualizations in Jupyter notebooks, you need rapid cycles of execution, verification, and modification.

This plugin is designed specifically to address these separation of concerns, allowing you to:

  • Focus on code in notebooks without documentation distractions
  • Focus on narrative in markdown without code interruptions
  • Maintain powerful connections between both environments

Each environment is optimized for its purpose, while the plugin handles the integration automatically.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

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

nbsync-0.1.1.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

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

nbsync-0.1.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nbsync-0.1.1.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for nbsync-0.1.1.tar.gz
Algorithm Hash digest
SHA256 121a04cf4ff5a26a6e1faad5a57a514bea256bce5bb87cb10aeac001d7856f09
MD5 58f0e43d188419d61898e1ece4a15eb0
BLAKE2b-256 e5b3bdf9dd31e7a2170054cc1a317c05cdb17ffaa6bf3969f139499731bbc0b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nbsync-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for nbsync-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0012e1aec7eb87515993cbc22691b6f29e7a6a26c785da6143e713d897b8b429
MD5 c6f149c683fd1addce9b6f17b8c12f0b
BLAKE2b-256 9f90d3597495503cce3e9a715d0d173352b1e7eca5c04b78feb43ef1ab58cf4a

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