Skip to main content

Bi-directional Jupyter Notebook conversion: beautify ipynb/HTML to clean responsive pages, or restore HTML back to ipynb

Project description

nixnb

Bi-directional Jupyter Notebook conversion tool.

  • Forward: Turn .ipynb or Jupyter-exported HTML into a clean, responsive page that works on desktop, tablet, and mobile
  • Reverse: Restore such HTML back to .ipynb, recovering code, markdown, and outputs as a validated nbformat notebook

Installation

pip install nixnb

For .ipynb input (forward mode), nbconvert is also required:

pip install nbconvert

Usage

Forward: ipynb/html → beautified HTML

nixnb notebook.ipynb                    # → notebook-beautified.html
nixnb notebook.html                     # → notebook-beautified.html
nixnb notebook.html -o output.html      # explicit output path
nixnb notebook.html -o outputs/         # output to directory

Reverse: html → ipynb

nixnb notebook.html -o output.ipynb     # trigger by .ipynb suffix
nixnb notebook.html --to-ipynb          # explicit flag, auto-named output
nixnb notebook.html --to-ipynb -o out.ipynb

Full help

nixnb -h

Features

  • Responsive layout (desktop / tablet / mobile)
  • Floating sidebar TOC (desktop), drawer TOC (mobile)
  • Styled pandas DataFrames (zebra striping, hover highlight, tabular numbers)
  • Re-colored syntax highlighting
  • Auto-resize images
  • Reverse conversion preserves code, markdown, and outputs as validated nbformat notebooks (correct output types, cell IDs, and metadata)

Credits

Reverse conversion is based on takluyver/html_to_ipynb, with additions: (1) it works on the beautified HTML that nixnb itself produces, (2) it preserves cell outputs — text, DataFrames, and images — rather than dropping them, (3) it strips stray whitespace so the recovered source code is clean, and (4) it builds notebooks through the official nbformat library so the output validates against the nbformat 4.5 specification.

License

MIT

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

nixnb-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

nixnb-0.1.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nixnb-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.5

File hashes

Hashes for nixnb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e58d1e22f4ae56e0eb3806c67c3f55ffef82b6321d2a2ae515154bd1a4868f96
MD5 0a3bc255b0ff637ff003f15a48d5a1b3
BLAKE2b-256 13ae3be8d9165a53f74beea61f088f1d4808bf4dd2870b5ec251889a3ae671e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nixnb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.5

File hashes

Hashes for nixnb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b80cfd38f10f01f7d66cf5c18195ac3b9408ccaeb224a103f5d8f92a61321321
MD5 d7ace423bf203c42d2cde699ace051d4
BLAKE2b-256 1b833195970e869ac8c2518b2ed7886e0f89fde136aa1485fa50fc159af1f533

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