Metadata-Version: 2.4
Name: sphinx-touchbook
Version: 0.1.0
Summary: Sphinx directives and Web Components for interactive textbook content.
Project-URL: Homepage, https://github.com/DaveParillo/sphinx-touchbook
Project-URL: Issues, https://github.com/DaveParillo/sphinx-touchbook/issues
Author-email: Dave Parillo <dparillo@sdccd.edu>
License: Unless otherwise indicated, all code in the Sphinx-Touchbook project is
        licenced under the two clause BSD licence below.
        
        Copyright (c) 2026, Dave Parillo,
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are
        met:
        
        * Redistributions of source code must retain the above copyright
          notice, this list of conditions and the following disclaimer.
        
        * Redistributions in binary form must reproduce the above copyright
          notice, this list of conditions and the following disclaimer in the
          documentation and/or other materials provided with the distribution.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
        HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
        SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
        LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Sphinx :: Extension
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Documentation :: Sphinx
Classifier: Topic :: Education
Requires-Python: >=3.10
Requires-Dist: sphinx>=7
Provides-Extra: docs
Requires-Dist: sphinx-nefertiti; extra == 'docs'
Requires-Dist: sphinx>=7; extra == 'docs'
Provides-Extra: publish
Requires-Dist: build; extra == 'publish'
Requires-Dist: hatchling; extra == 'publish'
Requires-Dist: twine; extra == 'publish'
Provides-Extra: test
Requires-Dist: beautifulsoup4; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# sphinx-touchbook
[![Tests](https://img.shields.io/github/actions/workflow/status/daveparillo/sphinx-touchbook/publish-authorguide.yml?branch=main&label=tests)](https://github.com/daveparillo/sphinx-touchbook/actions/workflows/publish-authorguide.yml)
[![Author Guide](https://img.shields.io/github/actions/workflow/status/daveparillo/sphinx-touchbook/publish-authorguide.yml?branch=main&label=docs)](https://github.com/daveparillo/sphinx-touchbook/actions/workflows/publish-authorguide.yml)
[![License](https://img.shields.io/github/license/daveparillo/sphinx-touchbook)](LICENSE)

`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](https://github.com/RunestoneInteractive),
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:

```bash
python3 -m venv .venv
source .venv/bin/activate
```

Install the Python package with test and documentation dependencies:

```bash
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:

```bash
npm ci
```

## Build Documents

Build the author guide as HTML:

```bash
python3 -m sphinx -b html docs build/authorguide --fail-on-warning
```

The generated site starts at:

```text
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:

```bash
python3 -m sphinx -b latex docs build/latex --fail-on-warning
```

Build the author guide PDF with the Sphinx LaTeX container:

```bash
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:

```bash
python3 -m pytest tests/test_*.py
```

Run isolated JavaScript component tests:

```bash
npm run test:web-components
```

See the author guide in `docs/` for directive syntax, options, examples,
accessibility notes, and fallback behavior.
