Skip to content

Bad references in man pages #14427

Open

Description

@Nahor

Describe the bug

:doc: and :ref: generate some bad content in recent Sphinx version (I tried 9.0.4 and 9.1.0). See additional details below for output examples.

I also tried some older versions (7.2.6 and 8.2.3) and those work fine.

How to Reproduce

Steps:

mkdir src dst

cat >./src/conf.py <<"EOF"
project = "foo"
EOF

cat >./src/index.rst <<"EOF"
A :ref:`ref <other-ref>`. A :doc:`doc <other>`
EOF

cat >./src/other.rst <<"EOF"
:orphan:

.. _other-ref:
EOF

sphinx-build -b man ./src ./dst

man ./dst/foo.1

Environment Information

Platform:              linux; (Linux-6.6.114.1-microsoft-standard-WSL2-x86_64-with-glibc2.39)
Python version:        3.12.3 (main, Mar 23 2026, 19:04:32) [GCC 13.3.0])
Python implementation: CPython
Sphinx version:        9.1.0
Docutils version:      0.22.4
Jinja2 version:        3.1.6
Pygments version:      2.20.0


Platform:              cygwin; (MSYS_NT-10.0-26200-3.6.9-aa532e7b.x86_64-x86_64-64bit-WindowsPE)
Python version:        3.12.13 (main, Mar  5 2026, 09:00:26) [GCC 15.2.0])
Python implementation: CPython
Sphinx version:        9.1.0
Docutils version:      0.22.4
Jinja2 version:        3.1.6
Pygments version:      2.20.0


Platform:              cygwin; (MSYS_NT-10.0-26200-3.6.9-aa532e7b.x86_64-x86_64-64bit-WindowsPE)
Python version:        3.12.13 (main, Mar  5 2026, 09:00:26) [GCC 15.2.0])
Python implementation: CPython
Sphinx version:        9.0.4
Docutils version:      0.22.4
Jinja2 version:        3.1.6
Pygments version:      2.20.0

Sphinx extensions

Additional context

./dst/foo.1 contains A ref \%<#\:other-ref>\&. A doc \%<>, which renders as:

A ref <#other-ref>. A doc <>

With sphinx 7.2.6 and 8.2.3 it works as expected. The generated content is A \fI\%ref\fP\&. A \fI\%doc\fP, which renders as:

A ref. A doc

Activity

  1. Nahor commented on May 12, 2026

    @Nahor
    Author

    This is related to Docutils. With docutils-0.21.2, it works fine, with docutils-0.22.0, it does not. But this way beyond my area of knowledge, so I do not know if it's an issue with docutils itself or with how Sphinx uses Docutils.

  2. grubert commented on May 13, 2026

    @grubert

    :def: and :ref: look like reStructuredText Interpreted Text Roles https://docutils.sourceforge.io/docs/ref/rst/roles.html#code
    but are defined in sphinx not in docutils.

    referencing other pages on manpages would look like "other(1)" for manpage "other" in the section "1"

    but they are not clickable on the console ... what would you expect?

  3. Nahor commented on May 13, 2026

    @Nahor
    Author

    what would you expect?

    In previous versions, it showed just the title, with an underline (see additional context in the top post), which was fine. Even if not clickable, it still told the user that it is something important that they might want to look up (and those references are clickable in the online version of the documentation).
    Those <#other-ref> and <> however are pointless and meaningless, and just a confusing waste of space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions