sphinx-doc / sphinx-doc/sphinx

C++, allow the creation of link anchors to deal with namespaces in parameters' types

Open
#8,228 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domains:cpp type:enhancement
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Problem description

When I describe a class or struct with .. cpp:class:: I like to give the full namespace qualification. But when I use this class as a parameter type in .. cpp:function:: or as type in .. cpp:var::, I prefer to keep it clear and lightweighted. As a result, the links from the parameters to their types are broken.

My logs are full of such error message:

docstring of simgrid::s4u::VirtualMachine::on_resume:1: WARNING: cpp:identifier reference target not found: xbt::signal<void(VirtualMachine const&)>

(Here, the problem seems to come from the fact that the xbt::signal template is used on the partially qualified VirtualMachine type name while the documented name is the full simgrid::s4u::VirtualMachine)

Solution I'd like
Since I'm using the cpp domain almost directly, I'd like to have a manual solution at hand, such as a .. cpp:anchor or something that would allow me to write something as follows:

.. cpp:anchor:: VirtualMachine

   (no parameter nor content here)

.. cpp:class:: simgrid::s4u::VirtualMachine

   (class description here)

.. cpp:var:: xbt::signal< void(VirtualMachine const  &)> simgrid::s4u::VirtualMachine::on_resume

   (variable description here)

Alternative I've considered

I've considered qualifying all types in parameters and such, but this leads to very heavy rendering in the doc. I think that this greatly hinders the doc readability.

Capture d’écran_2020-09-21_10-00-12

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the C++ domain entries for cpp:class, cpp:function, and cpp:var and how they resolve identifiers. Add a manual anchor mechanism that makes the partially qualified parameter type resolve to the documented class, then add regression coverage showing the example links without requiring fully qualified parameter types.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
documentation, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.