/sphinx_radiac_theme

Sphinx theme for radiac.net

Primary LanguageSassMIT LicenseMIT

Radiac.net Sphinx Theme

This Sphinx theme is a fork of the official `Read the Docs`_ theme, which adds:

  • radiac.net colour scheme
  • Top nav

Using in docs

Install:

pip install -e https://github.com/radiac/sphinx_radiac_theme.git

Add to conf.py:

import sphinx_radiac_theme
extensions = [
    ...
    'sphinx_radiac_theme',
]
html_theme = "sphinx_radiac_theme"

Optional settings for conf.py:

html_theme_options = {
  "radiac_project_slug": "projectslug",
  "radiac_project_name": "project name",
  "radiac_subsite_links": [
    ('https://radiac.net/projects/projectslug/demo/', 'Demo'),
  ],
}

Developing

  1. Check out the project from git

  2. Update conf.py as above, but add:

    html_theme_path = ["/path/to/sphinx_radiac_theme"]
    
  3. Watch static and open the demo site in a browser:

    nvm install
    nvm use
    npm install
    npm run dev
    

The upstream project does not currently use black, so take care to not apply auto-formatting to files which originate upstream.

Releasing a new version

  1. Build static:

    npm run build
    
  2. Update the fork number in the version string in setup.py and sphinx_radiac_theme/__init__.py

  3. Commit and push to master.

This project is not on pypi.

Merging from upstream

  1. Pull into new branch:

    git remote add upstream https://github.com/readthedocs/sphinx_rtd_theme.git
    git fetch upstream
    git checkout master
    git pull
    git checkout -b merge-upstream
    git merge upstream/master
    
  2. Resolve any conflicts (ignoring sphinx_radiac_theme/static - we'll rebuild that). In particular, check for changes in these files:

    • README.rst - keep our version
    • setup.*, MANIFEST.in - check for new sphinx_rtd_theme
    • setup.py - update version (add .fork0 to upstream)
    • sphinx_radiac_theme/__init__.py - update version and check theme name is sphinx_radiac_theme
    • src/sass/theme.sass - make sure theme_variables is followed by radiac_variables and radiac_styles is at the bottom
    • Updated sphinx_radiac/theme/layout.html from sphinx_rtd_theme, copying across the radiac_title and radiac_nav blocks
    • sphinx_rtd_theme/* - move files over to sphinx_radiac_theme

    Test with:

    npm install
    npm run dev
    
  3. Rebuild and push:

    npm run build
    git add .
    git commit
    git checkout master
    git merge merge-upstream
    git branch -d merge-upstream
    git push
    

More information

See original documentation for: