Skip to main content

Swarmauri HTML publishing tool for rendering Jupyter notebooks with nbconvert and optional inline presentation assets.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterexporthtml Discord

Swarmauri Jupyter Export HTML Tool

swarmauri_tool_jupyterexporthtml converts Jupyter notebook JSON into HTML using nbconvert.HTMLExporter, with optional template selection and inline CSS or JavaScript injection.

Why

  • Publish notebooks as web-ready HTML artifacts.
  • Apply presentation-specific HTML templates without rewriting notebook content.
  • Add inline CSS or JavaScript for branded notebook presentation workflows.

Features

  • Parses notebook JSON into a NotebookNode.
  • Exports notebook content through nbconvert.HTMLExporter.
  • Supports optional template_file overrides.
  • Can inject inline CSS into the document head.
  • Can inject inline JavaScript before the closing body tag.

FAQ

What input does this tool accept?

It expects a JSON string representing the notebook, not a file path and not a Python dictionary.

Does it write an HTML file?

No. It returns the generated HTML string in exported_html.

When should I use extra CSS or extra JS?

Use them when the exported notebook needs lightweight presentation customization without managing a full custom exporter package.

Installation

uv add swarmauri_tool_jupyterexporthtml
pip install swarmauri_tool_jupyterexporthtml

Usage

from swarmauri_tool_jupyterexporthtml import JupyterExportHtmlTool

notebook_json = """
{
  "cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Demo"]}],
  "metadata": {},
  "nbformat": 4,
  "nbformat_minor": 5
}
"""

tool = JupyterExportHtmlTool()
result = tool(notebook_json=notebook_json)

print(result["exported_html"][:200])

Examples

Export HTML with custom CSS

result = JupyterExportHtmlTool()(
    notebook_json=notebook_json,
    extra_css="body { max-width: 960px; margin: 0 auto; }",
)

html = result["exported_html"]

Export HTML with custom JavaScript

result = JupyterExportHtmlTool()(
    notebook_json=notebook_json,
    extra_js="console.log('Notebook rendered');",
)

Related Packages

Foundational Swarmauri Packages

More Documentation

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

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

File details

Details for the file swarmauri_tool_jupyterexporthtml-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterexporthtml-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 108a3c08ce63f8deb0044dc98af9bcfb07b4adbc377b8d650f54076f8ce55180
MD5 1bdd91858ba518cc2555d20f97462ec3
BLAKE2b-256 0f20235818512ce54402b4dd54999c5d00911a7084bc0374ad57fa34aad3e52b

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexporthtml-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexporthtml-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterexporthtml-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 54443bd389b45b51700d423e0807bab987367cf0a2ca6fa4cd90cfa408a57209
MD5 819a60a21cd063a7d79e5819600fe4b8
BLAKE2b-256 554522cced60382525c4bc720500c66d515fbab62e250151dcb81bcee77ddad9

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