Metadata-Version: 2.4
Name: conda_sphinx_theme
Version: 0.3.0
Summary: Conda theme for Sphinx
Author: Travs Hathaway
License: BSD 3-Clause License
        
        Copyright (c) 2023, conda-incubator
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. 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.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        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.
        
Project-URL: homepage, https://github.com/conda-incubator/conda-sphinx-theme/
Project-URL: repository, https://github.com/conda-incubator/conda-sphinx-theme
Classifier: Framework :: Sphinx :: Theme
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Documentation
Classifier: Topic :: Documentation :: Sphinx
Requires-Python: >=3
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydata-sphinx-theme<0.17.0,>=0.13.1
Requires-Dist: sphinx-favicon
Dynamic: license-file

# Conda Sphinx Theme

This is the Conda Sphinx Theme. It extends the [PyData Sphinx Theme][pydata-sphinx-theme]
project  by adding custom styling.

## Install

You can install the `conda-sphinx-theme` via conda-forge:

```
conda install -c conda-forge conda-sphinx-theme
```

or PyPI:

```
pip install conda-sphinx-theme
```

## Configuring

When creating a conda subproject you can include this theme by changing this
line in your conf.py file

```python
html_theme = 'conda_sphinx_theme'
```

## Version Anchors Extension

The theme includes a `version_anchors` Sphinx extension that automatically creates anchors for version headings in changelog files. This makes it easy to link directly to specific versions in your changelog.

### Usage

To use the version anchors extension, add it to your `extensions` list in `conf.py`:

```python
extensions = [
    # ... your other extensions
    "conda_sphinx_theme.version_anchors",
]
```

### How it works

The extension automatically detects changelog files (files with names containing "changelog", "release", "history", or "news") and scans for headings that match version patterns. When found, it creates anchor IDs that you can link to.

For example, if you have a heading like:

```
25.5.0 (2025-05-21)
===================
```

The extension will create an anchor with ID `version-25.5.0` that you can link to with `:version:`25.5.0`` (recommended), `:ref:`version-25.5.0``, or by URL fragment `#version-25.5.0`.

### Configuration

You can customize the behavior with these configuration options in your `conf.py`:

```python
# Pattern to match version headings (must have exactly one capture group for the version)
version_anchor_pattern = r"^(\d+\.\d+(?:\.\d+)?)\s*\(.*?\)$"  # Default

# Format template for anchor IDs (use {version} as placeholder)
version_anchor_format = "version-{version}"  # Default (REQUIRED: must contain {version})

# File patterns that indicate changelog files (case-insensitive)
version_anchor_changelog_files = ["changelog", "release", "history", "news"]  # Default
```

**Note**: The `version_anchor_format` must contain the `{version}` placeholder. The extension will validate this at startup and raise an error if the placeholder is missing.

Alternative patterns and formats you might want to use:

```python
# For "Version 1.2.3" format
version_anchor_pattern = r"^Version\s+(\d+\.\d+(?:\.\d+)?).*$"

# For "Release 1.2.3" format
version_anchor_pattern = r"^Release\s+(\d+\.\d+(?:\.\d+)?)"

# For "v1.2.3" or "1.2.3" format
version_anchor_pattern = r"^v?(\d+\.\d+(?:\.\d+)?)"

# Alternative anchor formats:
version_anchor_format = "v{version}"           # Creates anchors like "v25.5.0"
version_anchor_format = "release-{version}"    # Creates anchors like "release-25.5.0"
version_anchor_format = "{version}"            # Creates anchors like "25.5.0" (not recommended for HTML4/XHTML)
```

[pydata-sphinx-theme]: https://pydata-sphinx-theme.readthedocs.io/en/stable/
