Convert IPYNB to EPUB3
Max file size 100mb.
IPYNB vs EPUB3 Format Comparison
| Aspect | IPYNB (Source Format) | EPUB3 (Target Format) |
|---|---|---|
| Format Overview |
IPYNB
Jupyter Notebook
Interactive computational notebook format used in data science, machine learning, and scientific computing. Contains code cells, markdown text, and rich output including visualizations. Based on JSON structure with cells for code execution and documentation. Interactive Data Science |
EPUB3
Electronic Publication 3.x
EPUB 3 is the latest version of the EPUB standard, maintained by the W3C. It introduces HTML5 content documents, CSS3 styling, MathML for mathematical notation, SVG graphics, JavaScript scripting, and enhanced accessibility features. EPUB3 is ideal for technical and scientific content that requires math equations and code formatting. Modern Ebook HTML5/CSS3 |
| Technical Specifications |
Structure: JSON with cells array
Encoding: UTF-8 JSON Format: Open format (Jupyter/IPython) Cell Types: Code, Markdown, Raw Extensions: .ipynb |
Structure: ZIP archive with HTML5/CSS3 content
Encoding: UTF-8 (HTML5 content documents) Standard: EPUB 3.3 (W3C Recommendation) Content: HTML5, CSS3, MathML, SVG, JavaScript Extensions: .epub |
| Syntax Examples |
IPYNB uses JSON cell structure: {
"cell_type": "code",
"source": ["import pandas as pd\n",
"df = pd.read_csv('data.csv')"],
"outputs": [{"output_type": "stream",
"text": [" col1 col2\n"]}]
}
|
EPUB3 uses HTML5 content with enhanced features: <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:epub="http://www.idpf.org/2007/ops">
<head><title>Chapter 1</title></head>
<body>
<section epub:type="chapter">
<h1>Introduction</h1>
<math><mi>x</mi></math>
</section>
</body>
</html>
|
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2014 (Project Jupyter)
Current Version: nbformat 4.5 Status: Active, widely adopted Evolution: From IPython Notebook to Jupyter ecosystem |
Introduced: 2011 (IDPF)
Current Version: EPUB 3.3 (2023, W3C) Status: Active, W3C Recommendation Evolution: From EPUB 3.0 to 3.3 with HTML5 and accessibility |
| Software Support |
Jupyter: Native format
VS Code: Full support Google Colab: Full support Other: JupyterLab, nteract, Kaggle, DataBricks |
Readers: Apple Books, Thorium, Kobo (partial)
Apps: Google Play Books, Readium, Calibre Editors: Sigil, Calibre Editor, oXygen XML Creation: Pandoc, nbconvert, Calibre |
Why Convert IPYNB to EPUB3?
Converting Jupyter Notebooks to EPUB3 is the best choice for creating ebooks from technical and scientific notebooks. Unlike EPUB 2, EPUB3 supports MathML for mathematical equations, which is essential for data science notebooks that contain LaTeX math expressions.
EPUB3's HTML5 foundation provides superior code block formatting compared to EPUB 2. Code cells from your notebooks are rendered with proper CSS3 styling, including monospaced fonts, background colors, and syntax highlighting on compatible readers. This makes the reading experience much better for technical content.
The enhanced accessibility features of EPUB3 make your converted notebooks accessible to readers with disabilities. ARIA attributes, semantic HTML5 elements, and navigation landmarks ensure that screen readers and assistive technologies can properly interpret your content.
Key Benefits of Converting IPYNB to EPUB3:
- Math Support: MathML rendering for LaTeX equations from notebooks
- Better Code Blocks: HTML5/CSS3 styling for improved code readability
- Accessibility: WCAG-compliant with ARIA attributes and semantic markup
- SVG Graphics: Native SVG support for vector visualizations
- Modern Standard: W3C Recommendation with active development
- Navigation: Enhanced table of contents with EPUB Nav document
- Scientific Publishing: Ideal for STEM content with equations and code
Practical Examples
Example 1: Interactive Textbook to EPUB3
Input IPYNB file (notebook.ipynb):
{
"cells": [
{
"cell_type": "markdown",
"source": ["# Linear Algebra Fundamentals\n",
"## Matrix Multiplication\n",
"Given matrices A and B, the product C = A x B\n",
"is computed as: $C_{ij} = \\sum_k A_{ik} B_{kj}$"]
},
{
"cell_type": "code",
"source": ["import numpy as np\n",
"A = np.array([[1, 2], [3, 4]])\n",
"B = np.array([[5, 6], [7, 8]])\n",
"C = A @ B\n",
"print('Result:')\n",
"print(C)"],
"outputs": [{"text": "Result:\n[[19 22]\n [43 50]]"}]
}
]
}
Output EPUB3 file (notebook.epub):
[EPUB3 with HTML5 and MathML]
Chapter: Linear Algebra Fundamentals
Section: Matrix Multiplication
Given matrices A and B, the product C = A x B
is computed as:
[MathML rendered equation: C_ij = sum_k A_ik B_kj]
[Code Block - CSS3 styled, monospaced]
<pre><code class="language-python">
import numpy as np
A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])
C = A @ B
print('Result:')
print(C)
</code></pre>
Output:
[[19 22]
[43 50]]
[EPUB Nav document with TOC]
Example 2: ML Guide to EPUB3
Input IPYNB file (analysis.ipynb):
{
"cells": [
{
"cell_type": "markdown",
"source": ["# Neural Networks from Scratch\n",
"## The Sigmoid Activation Function\n",
"The sigmoid function maps any value to (0, 1):\n",
"$\\sigma(x) = \\frac{1}{1 + e^{-x}}$"]
},
{
"cell_type": "code",
"source": ["import numpy as np\n",
"def sigmoid(x):\n",
" return 1 / (1 + np.exp(-x))\n",
"\n",
"x_vals = [-2, -1, 0, 1, 2]\n",
"for x in x_vals:\n",
" print(f'sigmoid({x:+d}) = {sigmoid(x):.4f}')"],
"outputs": [{"text": "sigmoid(-2) = 0.1192\nsigmoid(-1) = 0.2689\nsigmoid(+0) = 0.5000\nsigmoid(+1) = 0.7311\nsigmoid(+2) = 0.8808"}]
}
]
}
Output EPUB3 file (analysis.epub):
[EPUB3 with MathML Support]
Chapter: Neural Networks from Scratch
Section: The Sigmoid Activation Function
The sigmoid function maps any value to (0, 1):
[MathML rendered: sigma(x) = 1/(1+e^(-x))]
[Code Block - HTML5 semantic markup]
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
x_vals = [-2, -1, 0, 1, 2]
for x in x_vals:
print(f'sigmoid({x:+d}) = {sigmoid(x):.4f}')
Output:
sigmoid(-2) = 0.1192
sigmoid(-1) = 0.2689
sigmoid(+0) = 0.5000
sigmoid(+1) = 0.7311
sigmoid(+2) = 0.8808
Example 3: Research Compilation to EPUB3
Input IPYNB file (research.ipynb):
{
"cells": [
{
"cell_type": "markdown",
"source": ["# Genome Sequence Analysis Toolkit\n",
"## DNA Sequence Statistics\n",
"Computing GC content and nucleotide frequencies."]
},
{
"cell_type": "code",
"source": ["sequence = 'ATCGATCGAATTCCGG'\n",
"gc_count = sequence.count('G') + sequence.count('C')\n",
"gc_content = gc_count / len(sequence) * 100\n",
"print(f'Sequence length: {len(sequence)} bp')\n",
"print(f'GC content: {gc_content:.1f}%')\n",
"for base in 'ATCG':\n",
" print(f' {base}: {sequence.count(base)}')"],
"outputs": [{"text": "Sequence length: 16 bp\nGC content: 50.0%\n A: 3\n T: 4\n C: 5\n G: 4"}]
}
]
}
Output EPUB3 file (research.epub):
[EPUB3 with Accessibility Features]
Chapter: Genome Sequence Analysis Toolkit
Section: DNA Sequence Statistics
Computing GC content and nucleotide
frequencies.
[Code Block - ARIA-labeled, CSS3 styled]
sequence = 'ATCGATCGAATTCCGG'
gc_count = sequence.count('G') +
sequence.count('C')
gc_content = gc_count / len(sequence) * 100
print(f'Sequence length: {len(sequence)} bp')
print(f'GC content: {gc_content:.1f}%')
for base in 'ATCG':
print(f' {base}: {sequence.count(base)}')
Output:
Sequence length: 16 bp
GC content: 50.0%
A: 3
T: 4
C: 5
G: 4
Frequently Asked Questions (FAQ)
Q: What is the difference between EPUB 2 and EPUB 3?
A: EPUB 3 uses HTML5 instead of XHTML 1.1, supports CSS3 styling, MathML for equations, SVG graphics, JavaScript scripting, and enhanced accessibility features. EPUB 2 is simpler but lacks math support and modern web technologies, making EPUB 3 better for technical content.
Q: Are LaTeX equations rendered properly in EPUB3?
A: EPUB3 supports MathML, which can represent mathematical equations. LaTeX equations from notebook markdown cells are converted to MathML notation in the EPUB3 output. Rendering quality depends on the e-reader's MathML support -- Apple Books provides excellent rendering.
Q: Which e-readers support EPUB3?
A: Apple Books, Thorium Reader, and Readium provide excellent EPUB3 support. Google Play Books and Kobo offer partial support. Older e-readers and some budget devices may fall back to EPUB 2 rendering. Calibre also supports EPUB3 for desktop reading.
Q: How are code cells styled in the EPUB3?
A: Code cells use CSS3 styling with monospaced web fonts, background colors, and proper indentation. HTML5 semantic elements (<pre> and <code>) are used, providing better rendering than EPUB 2 on compatible readers.
Q: Is the EPUB3 output accessible?
A: Yes. EPUB3 includes accessibility features such as ARIA roles, semantic HTML5 elements, and proper document structure. This ensures that screen readers and other assistive technologies can navigate and read the content effectively.
Q: Can I add JavaScript interactivity to the EPUB3?
A: EPUB3 supports JavaScript, but support varies widely across readers. Most e-readers either disable JavaScript entirely or provide limited support. For reliable reading, the conversion focuses on static content. Interactive visualizations are converted to static representations.
Q: Can I convert the EPUB3 to Kindle format?
A: Yes. You can use Calibre to convert the EPUB3 file to AZW3 (Kindle Format 8). However, some EPUB3 features like MathML may not translate perfectly to Kindle format. For direct Kindle conversion, consider using our IPYNB to AZW3 converter.
Q: Why choose EPUB3 over EPUB 2 for notebooks?
A: EPUB3 is strongly recommended for notebooks because of MathML equation support, better code formatting via CSS3, SVG graphics support, and accessibility features. If your notebook contains math equations or requires good code rendering, EPUB3 is the clear choice.