Sphinx/Jupyter Book directives and assets for Munchboka and VGS books
Project description
munchboka-edutools
Reusable Sphinx / Jupyter Book directives and assets for Norwegian educational content.
NEW: Includes muncho - a command-line tool for building beautiful, print-ready books with enhanced typography, layout, and automatic LaTeX math rendering for PDFs. See CLI_README.md for details.
Key Features
✨ Auto-configured Sphinx extensions for Jupyter Book
📚 Custom educational directives (quiz, dialogue, plots, animations, etc.)
🖨️ Print-optimized PDF builds with proper typography
🧮 Automatic PDF math rendering - LaTeX expressions work seamlessly in PDFs
🎨 Multiple build profiles (print, web, custom)
🎬 Animated plots - Create animations with transparent backgrounds (WebP/GIF)
📄 Print-friendly CSS - Browser "Print to PDF" creates clean problem sheets with answer keys
Install
pip install munchboka-edutools
Optional (nicer progress bars during slow builds, e.g. interactive-graph frame generation):
pip install munchboka-edutools[progress]
Usage
As Sphinx Extensions (Jupyter Book _config.yml)
sphinx:
extra_extensions:
- munchboka_edutools
All packaged directives are auto-registered. Static assets (including print-friendly CSS and JS) are placed under _static/munchboka/ during the build.
Print-Friendly PDFs
Simply press Ctrl+P (or Cmd+P) in your browser when viewing any page to create a clean PDF with:
- All tabs flattened with part labels (a, b, c, etc.)
- Answers and solutions hidden from main content
- Automatic answer key page at the end
- CAS popup buttons hidden
- Better page breaks
See docs/print_pdf.md for details.
As Build Tool
Build books with enhanced formatting:
# Print-optimized build (includes automatic PDF math rendering)
muncho build matematikk_1t --profile print
# Web-optimized build
muncho build matematikk_r1 --profile web
# See all options
muncho --help
PDF Math Rendering: When building PDFs, muncho automatically configures sphinx.ext.imgmath to render LaTeX math expressions as high-quality SVG images. No changes to your source files needed!
See CLI_README.md for full CLI documentation and QUICKSTART.md for a quick start guide.
Development
Clone and install dev extras:
pip install -e .[dev]
Local demo book
Build the embedded demo book:
jupyter-book build book/
Adding a new directive
- Create
src/munchboka_edutools/directives/my_directive.pyexposingsetup(app). - The package auto-loads modules under
munchboka_edutools.directives. - Add an example page in
book/examples/.
Testing
Run tests:
pytest -q
Quick Links
- Animation Quickstart - Create animated plots
- CLI Documentation - Build tool guide
- Quick Start - Get started quickly
- Print PDF Guide - Browser printing features
- Examples - See all directive examples
Releasing
Tag a version (v0.1.0) and the GitHub Action will build and publish.
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file munchboka_edutools-0.3.23.tar.gz.
File metadata
- Download URL: munchboka_edutools-0.3.23.tar.gz
- Upload date:
- Size: 28.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc1ad4b7499685183dc64c148232f3f6d1c5023098f890e3ee45785ff4e329f3
|
|
| MD5 |
7c31569dd2eaceb48e074447c23d7392
|
|
| BLAKE2b-256 |
3a2803bbc4c7b97e9968e92a99679fa090682ce6bad2dfb8b6f55c0d2ad42007
|
File details
Details for the file munchboka_edutools-0.3.23-py3-none-any.whl.
File metadata
- Download URL: munchboka_edutools-0.3.23-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4bbe391d5de399fb70d2923a9c4c11415b8bb9941155e6f2c5c269fe675dbe4
|
|
| MD5 |
a80d94e7fc67a38b358760d5e7dbc4a2
|
|
| BLAKE2b-256 |
8ffffa272ff944d26c035508e83e0307e7cdc117738deecce4fed4ad45e65f26
|