Skip to main content

Script for preparing the html output of the Sphinx documentation system for github pages.

Project description

ATTENTION!

This project is designed to help you get around the github-pages Jekyll behaviour of ignoring top level directories starting with an underscore.

This is solved in a much neater way by creating a .nojekyll in the root of you github-pages which will disable Jekyll as described here and here.

This makes this project largely useless! Thank you to acdha for making me aware of this.

What?

A Python script for preparing the html output of the Sphinx documentation system for github pages.

It renames any top level folders which start with an underscore and edits any references to them within the html files.

Why?

GitHub processes the incoming html with Jekyll which believes top level folders starting with an underscore are special and does not let their content be accessible to the server. This is incompatible with Sphinx which uses underscores at the start of folder names for static content.

Usage

The sphinxtogithub.py script can be run on the command line or used as a Sphinx extension.

Extension

Place the script on the PYTHONPATH and add sphinxtogithub to the extensions list in the conf.py file in your Sphinx project:

extensions = [ "sphinxtogithub" ]

Additionally there are three config variables you can use to control the extension. The first enables/disables the extension, the second enables verbose output and the third determines the encoding which is used to read & write files. The first two are True by default and the third is set to utf-8:

sphinx_to_github = True
sphinx_to_github_verbose = True
sphinx_to_github_encoding = "utf-8"

Command Line

Run the script with the path to the html output directory as the first argument. There is a --verbose flag for basic output.

Further Information

Install from GitHub

It should be possible to install this tool directly from github using pip:

pip install -e git+git://github.com/michaeljones/sphinx-to-github.git#egg=sphinx-to-github

Thanks to winhamwr’s work.

Requirements

The script uses /usr/bin/env and python.

Running Tests

Unit tests can be run using the setuptools test target. eg:

$ python setup.py test

Alternatives

dinoboff’s project github-tools provides similar functionality combined with a much more comprehensive set of tools for helping you to manage Python based projects on github.

Credits

Thank you to:

For their contributions, which are beginning to outweigh mine, to Georg Brandl for Sphinx and the github crew for the pages functionality.

Project details


Download files

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

Source Distribution

sphinxtogithub-1.1.0.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file sphinxtogithub-1.1.0.tar.gz.

File metadata

File hashes

Hashes for sphinxtogithub-1.1.0.tar.gz
Algorithm Hash digest
SHA256 15222b1ea55f83dfdf1e09a76d4ef1b9273a2590b73a5a16c4bff972894eae4e
MD5 ed77afb540f41c2d86267096142539ae
BLAKE2b-256 bb2647f00ce30c9e91ae5d8e9c9dcd7907a46d4e5f87c2e2485472d33c453f90

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page