Sphinx directives and Web Components for interactive textbook content.
Project description
sphinx-touchbook
sphinx-touchbook is a Sphinx extension project for authors who want
interactive textbook pages without giving up ordinary Sphinx documents.
Authors write semantic reStructuredText directives, Sphinx parses them into
docutils nodes, Python generators render builder-specific output, and
JavaScript components progressively enhance the generated HTML.
This project is inspired by
Runestone Interactive,
which pioneered interactive textbook components for computer science education.
sphinx-touchbook is a Sphinx-oriented port of that general idea: it keeps
authoring and builds inside Sphinx while Runestone's main project has moved
away from Sphinx-based authoring and toward PreTeXt-authored books.
The focus of this project is 'Sphinx-native' interactive books and nothing else. Runestone is a much more sophisticated environment with instructor resources, student tracking, and LMS integration. If you want those features then you should consider Runestone as a resource.
Setup
To build documents Python is required.
Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
Install the Python package with test and documentation dependencies:
python3 -m pip install --upgrade pip
python3 -m pip install ".[test,docs]"
To test documents Node.js with npm is required.
Install JavaScript test dependencies:
npm ci
Build Documents
Build the author guide as HTML:
python3 -m sphinx -b html docs build/authorguide --fail-on-warning
The generated site starts at:
build/authorguide/index.html
To build LaTeX or PDF requires either a local LaTeX installation compatible with Sphinx, or a docker image:
Build LaTeX source locally:
python3 -m sphinx -b latex docs build/latex --fail-on-warning
Build the author guide PDF with the Sphinx LaTeX container:
docker run --rm \
-v "$PWD:/docs" \
-w /docs \
sphinxdoc/sphinx-latexpdf:latest \
sh -c 'python3 -m pip install ".[docs]" && python -m sphinx -M latexpdf docs build/latexpdf --fail-on-warning'
Run Tests
Run the Python directive and generator tests:
python3 -m pytest tests/test_*.py
Run isolated JavaScript component tests:
npm run test:web-components
See the author guide in docs/ for directive syntax, options, examples,
accessibility notes, and fallback behavior.
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 sphinx_touchbook-0.1.0.tar.gz.
File metadata
- Download URL: sphinx_touchbook-0.1.0.tar.gz
- Upload date:
- Size: 6.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27e817cb352a7424aab6dae5146384b4ee8dcb8620a5c0d5af3ce719e940db0e
|
|
| MD5 |
472e3eefd213154b966590e6153f210a
|
|
| BLAKE2b-256 |
dae2e8d329d24040028339229963e7cec7f883e0141dd0f474e9deb0f15f2f7c
|
File details
Details for the file sphinx_touchbook-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sphinx_touchbook-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da111b94452dce720dcab235dd17d925323b3d3eddff0f3a5bc5c88602f795e7
|
|
| MD5 |
59262840b187a806f004efd743fbeb19
|
|
| BLAKE2b-256 |
6553e4d4af0e7b70ef392d1e3aa1ef6508cafafd21902c6dd1158c65d83ff7d0
|