Skip to content

Intersphinx: link title contains vfoo for non-numeric versions #13712

@dwilding

Description

@dwilding

Describe the bug

When linking to a project that uses non-numeric versions (latest, stable, etc) the titles of intersphinx links are formatted as:

(in project vfoo)

For example:

Image

This looks strange and also can cause spelling checks to fail.

It would be great if the relevant code (here?) could only prepend "v" to the version if the version is numeric.

How to Reproduce

In conf.py:

extensions = [
    'sphinx.ext.intersphinx',
]

intersphinx_mapping = {
    'charmcraft': ('https://canonical-charmcraft.readthedocs-hosted.com/en/stable/', None),
}

Then in a .rst document:

:external+charmcraft:ref:`manage-charms`

Here's my testing repo: https://github.com/dwilding/intersphinx-test

Environment Information

Platform:              linux; (Linux-6.11.0-26-generic-x86_64-with-glibc2.39)
Python version:        3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0])
Python implementation: CPython
Sphinx version:        8.2.3
Docutils version:      0.21.2
Jinja2 version:        3.1.6
Pygments version:      2.19.2

Sphinx extensions

['sphinx.ext.intersphinx']

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    easyissue that can be solved by beginnersextensions:intersphinxsprintFor work completed at a conference or similar event.type:bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions