Skip to content

Commit 51dcdc4

Browse files
authored
Merge pull request #98 from matplotlib/dstansby-patch-1
Cleanup README
2 parents 3d40411 + ef7aed5 commit 51dcdc4

File tree

2 files changed

+88
-92
lines changed

2 files changed

+88
-92
lines changed

README.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Matplotlib Sphinx Theme
2+
3+
This is the official Sphinx theme for Matplotlib documentation. It extends the
4+
`pydata-sphinx-theme` project, but adds custom styling and a navigation bar.
5+
6+
A demo of the theme built with the `main` branch can be seen at
7+
https://matplotlib.org/mpl-sphinx-theme/.
8+
9+
When creating a Matplotlib subproject you can include this theme by changing this
10+
line in your `conf.py` file
11+
12+
```python
13+
html_theme = 'mpl_sphinx_theme'
14+
```
15+
16+
And by including `mpl_sphinx_theme` as a requirement in your documentation
17+
installation.
18+
19+
See the `docs/conf.py` file for other settings.
20+
21+
There are two main templates that replace the defaults in `pydata-sphinx-theme`:
22+
23+
```
24+
navbar_center = mpl_nav_bar.html
25+
navbar_end = mpl_icon_links.html
26+
```
27+
28+
Note that the logo options need not be specified as they are included in theme
29+
initialization. The logo is stored at
30+
`mpl_sphinx_theme/static/logo_{light,dark}.svg`.
31+
32+
To change the top navbar, edit `mpl_sphinx_theme/mpl_nav_bar.html`
33+
34+
To change the social icons, edit `mpl_sphinx_theme/mpl_icon_links.html`
35+
36+
To change the style, edit `mpl_sphinx_theme/static/css/style.css`
37+
38+
## Overriding hard coded elements
39+
40+
This theme is primarily designed to be used with subprojects that are part of the main
41+
Matplotlib webiste (e.g., [our cheatseets](https://github.com/matplotlib/cheatsheets)
42+
and [list of third-party packages](https://github.com/matplotlib/mpl-third-party)).
43+
As such several elements are hard coded. However, the theme may also be used by
44+
other subprojects that need to change the hard-coded defaults.
45+
The following sections explain how to reset these back to their defaults by modifying
46+
`html_theme_options` in `conf.py`.
47+
48+
### Header section links
49+
50+
Use a copy of [the default pydata-sphinx-theme navbar](https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html) and set the `'navbar_center'` key to this HTML file in `html_theme_options`.
51+
52+
## Building
53+
54+
To build the theme with a sample page, navigate into the `doc/` directory and run
55+
56+
```
57+
make html
58+
```
59+
60+
The built html pages can be found in `doc/_build/html/`
61+
62+
## Releasing
63+
64+
This project [uses GitHub Actions](https://github.com/matplotlib/mpl-sphinx-theme/blob/main/.github/workflows/release.yml)
65+
to automatically push a new release to PyPI whenever a release is made.
66+
67+
For example, to release a new `3.9.0` version of `mpl-sphinx-theme`:
68+
69+
- be sure to edit `mpl_sphinx_theme/_version.py`
70+
- checkout the commit you would like to release
71+
- add a git tag
72+
- push the tag to the `matplotlib/mpl-sphinx-theme` repository
73+
74+
```sh
75+
git checkout <commit-hash>
76+
git tag -s -a v3.9.0 -m 'REL: 3.9.0'
77+
git push upstream --tags
78+
```
79+
80+
Finally, [turn the tag into a GitHub release](https://github.com/matplotlib/mpl-sphinx-theme/releases/new).
81+
82+
Update the required `mpl-sphinx-theme` version in the following files:
83+
84+
- [matplotlib/matplotlib](https://github.com/matplotlib/matplotlib): requirements/doc/doc-requirements.txt
85+
- [matplotlib/mpl-brochure-site](https://github.com/matplotlib/mpl-brochure-site): requirements.txt
86+
- [matplotlib/mpl-third-party](https://github.com/matplotlib/mpl-third-party): docs/requirements.txt
87+
- [matplotlib/governance](https://github.com/matplotlib/governance): requirements-doc.txt
88+
- [matplotlib/mpl-gui](https://github.com/matplotlib/mpl-gui): requirements-doc.txt

README.rst

-92
This file was deleted.

0 commit comments

Comments
 (0)