Metadata-Version: 2.5
Name: makersquad-sphinx-theme
Version: 3.5.0
Summary: Sphinx theme of the Makersquad charte, on the PyData Sphinx Theme
Project-URL: Homepage, https://www.makersquad.fr/
License-Expression: MIT AND OFL-1.1
License-File: LICENSE
License-File: src/makersquad_sphinx_theme/theme/makersquad/static/charte/fonts/OFL.txt
Classifier: Framework :: Sphinx :: Theme
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11.5
Requires-Dist: pydata-sphinx-theme<0.25,>=0.24
Requires-Dist: sphinx>=8.2
Description-Content-Type: text/markdown

# makersquad-sphinx-theme

Sphinx theme of the Makersquad charte, a child of the [PyData Sphinx Theme](https://pydata-sphinx-theme.readthedocs.io/): it inherits PyData's layout, fills its header and footer slots with the charte's own, and maps the charte's colours, type and spacing onto PyData's CSS variables. Each Makersquad release of the charte publishes it, at the charte's version.

```sh
pip install makersquad-sphinx-theme
```

The options below are its public API, under semantic versioning from 3.0: a 3.x only adds options and `--charte-*` custom properties; a removal or rename is announced in a 3.x and made in 4.0.

Python 3.11.5 or later. The theme opens in the reader's mode (`default_mode = "auto"`, the OS setting) and the header carries PyData's light/dark switcher. Dark follows the charte's dark palette, the accent derived for it from `charte_accent`. A doc opens light with `"default_mode": "light"` in `html_theme_options`; the mode is set only there, PyData's `html_context = {"default_mode": …}` has no effect on it. Without `image_dark` the dark header shows the light logo, so a logo that vanishes on a dark background needs PyData's `image_dark`.

```python
# conf.py
html_theme = "makersquad"
html_theme_options = {
    "charte_name": "HARP Proxy",
    "charte_start_year": 2023,
    "charte_accent": "#0d7fc1",
    "logo": {"image_light": "logo.svg", "text": None, "alt_text": "HARP"},  # the product logo, a PyData option
}
```

Every PyData option keeps working; the logo is PyData's `logo`. The charte's own options are the `charte_*` ones. An invalid value fails the build at its start, with a message naming the option and the value (`makersquad theme: charte_accent 'red' is not a #rrggbb colour or empty`).

## Options

| Option | Default | Accepts |
|---|---|---|
| `default_mode` | `"auto"` | `"auto"` (the reader's OS setting), `"light"` or `"dark"`: the mode the doc opens in; the switcher changes it. |
| `charte_site` | `""` | Registry id of the site the doc belongs to (`makersquad`, `harp`), left out of the footer cross-links; `""` for a doc outside the registry, which links every live site. The Makersquad docs (`makersquad`) carry no « by Makersquad » signature. |
| `charte_name` | `""` | The product's name, shown in the footer; empty falls back to Sphinx's `project`. A string. |
| `charte_lang` | `"en"` | `"fr"` or `"en"`: the language of the footer labels, and of nothing else. A French doc also sets Sphinx's `language = "fr"` (PyData's and Sphinx's own labels, `<html lang>`). |
| `charte_start_year` | `""` | A four-digit year, as a string or an integer, or empty. Gives « © 2023–2026 » (the build's year; « © 2023 » in 2023 itself); empty shows no copyright. |
| `charte_holder` | `""` | The copyright holder, a string; empty is « Makersquad ». |
| `charte_accent` | `""` | The product accent, `#rrggbb`, or empty for the Makersquad blue. Written to the `--charte-accent` custom property. |
| `charte_blurb` | `""` | A sentence under the name in the footer, a string; empty shows none. |
| `charte_columns` | `""` | The footer's link columns, a list of `{"title": …, "links": […]}` (`Footer` `columns`); each link is `{"label": …, "href": …, "external": …}`. Empty shows none. |
| `charte_social` | `""` | The footer's social links under the blurb, a list of `{"label": …, "href": …, "external": …}`. Empty shows none. |
| `charte_cross_links` | `""` | Replaces the footer's links to the other sites (`Footer` `crossLinks`): a list of `{"label": …, "href": …, "external": …}`; `[]` drops them; empty keeps the registry's live sites, `charte_site` left out. |

A link's `label` and `href` are non-empty strings; `external` is `true` or `false` (default `false`) and opens the link in a new tab with `rel="noopener"`. A link whose scheme is not `http`, `https`, `mailto` or `tel` (`javascript:`, `data:`…) fails the build, as `safeHref` turns it into `#` on the sites. A relative link is read from the doc root: `usage.html` reaches the root's `usage.html` from every page (written `../usage.html` on `guide/install.html`); one that starts with `/`, `#` or `?` is written as given. A key other than `label`, `href`, `external` (`title`, `links` for a column) fails the build too. The error names the option and the part: `makersquad theme: charte_social[1].href 'javascript:alert(1)' is not a relative link or one with the scheme http, https, mailto or tel`.

The footer takes the charte's `--color-footer` background and the white Makersquad logo. The « by Makersquad » signature (« par » with `charte_lang` `fr`) opens in a new tab and never carries an external-link marker or hidden new-tab text, as on the sites.

## Charte data

The wheel carries the charte's tokens (`--charte-*` custom properties), Lato, the Makersquad logo and the footer data (`charte.json`, with the links to the live Makersquad sites). They are generated from the charte at each release, never edited here.

Lato ships in the wheel under the SIL Open Font License, version 1.1, whose text is `theme/makersquad/static/charte/fonts/OFL.txt` (copied into a built doc's `_static/charte/fonts/`).

## License

`MIT AND OFL-1.1`. The theme's code and templates are under the MIT license (`LICENSE`, held by Makersquad). Lato, shipped in the wheel, stays under the SIL Open Font License, version 1.1 (`OFL.txt`). The Makersquad name and logo are not licensed: neither license allows using them to present another project. Both files are the wheel's license files.

## Develop

In the charte repository (Makersquad only), run `node scripts/sphinx-data.ts` from the repository root, then from its `sphinx/` directory:

```sh
uv sync
uv run pytest
uv run sphinx-build -W --keep-going -b html fixture _build/fixture
uv build --wheel
```

The fixture build is also what `tests/e2e/sphinx-axe.spec.ts` checks with axe and `tests/e2e/sphinx-footer.spec.ts` compares with the footer baselines (1280 and 390 px), in the pinned Playwright image: after the `sphinx-build` line, run `pnpm test:e2e sphinx-axe.spec.ts sphinx-footer.spec.ts` from the repository root (without the build, the specs are skipped, and fail under `CI`). A footer change rewrites its baselines with `pnpm test:sphinx-footer:update`, after the build.
