Subject: Getting "Duplicate explicit target name" errors
make clean html
/Users/barbara/Documents/filenamet.rst:25: WARNING: Duplicate explicit target name: "details".
/Users/barbara/Documents/filenamet.rst:25: WARNING: Duplicate explicit target name: "details".
No errors
Add lines like these to your file:
- `Details <https://github.com/signalfx/integrations/tree/release/collectd>`_
- `Details <https://github.com/signalfx/integrations/tree/release/collectd-docker>`_
- `Details <https://github.com/signalfx/integrations/tree/release/signalfx-metadata>`_
Unfortunately, it is a part of spec of reST.
docutils; the reference implementation of reST utilities also behaves as same:
$ cat details.rst
- `Details <https://github.com/signalfx/integrations/tree/release/collectd>`_
- `Details <https://github.com/signalfx/integrations/tree/release/collectd-docker>`_
- `Details <https://github.com/signalfx/integrations/tree/release/signalfx-metadata>`_
$ rst2html.py details.rst > /dev/null
details.rst:1: (WARNING/2) Duplicate explicit target name: "details".
details.rst:1: (WARNING/2) Duplicate explicit target name: "details".
Please use anonymous reference instead:
$ cat details.rst
- `Details <https://github.com/signalfx/integrations/tree/release/collectd>`__
- `Details <https://github.com/signalfx/integrations/tree/release/collectd-docker>`__
- `Details <https://github.com/signalfx/integrations/tree/release/signalfx-metadata>`__
use double underscores ``__`` to make references here!
$ rst2html.py details.rst > /dev/null
# => No warnings
Double underlines - ya gotta love it! Thanks for the response.
This is right up there with requiring a space after the text and before the < of the URL. When I was first learning RST I pulled my hair out trying to figure out why none of my links worked! That will be my next request to change, when I get around to it.
It would be nice if some lint tool is given :-)
I was unable to find anything about "anonymous references" in the Sphinx docs. If anyone reads this I would appreciate a pointer. This seems like a pretty easy issue to run into so I expected to see it mentioned here: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks
Please read the specification of reST markup.
https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks
As you said, it would be nice if our document describes all of reST syntax perfectly!
Most helpful comment
Unfortunately, it is a part of spec of reST.
docutils; the reference implementation of reST utilities also behaves as same:
Please use anonymous reference instead: