Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate explicit target name errors #3921

Closed
barbara-sfx opened this issue Jul 11, 2017 · 5 comments
Closed

Duplicate explicit target name errors #3921

barbara-sfx opened this issue Jul 11, 2017 · 5 comments

Comments

@barbara-sfx
Copy link
Contributor

Subject: Getting "Duplicate explicit target name" errors

Problem

  • I have links to several pages; the text for each link is the same: "Details". I am getting errors that 1) show the text as lower case, which is confusing; 2) show a random line number; and 3) should not be occurring at all.

Procedure to reproduce the problem

make clean html

Error logs / results

/Users/barbara/Documents/filenamet.rst:25: WARNING: Duplicate explicit target name: "details".
/Users/barbara/Documents/filenamet.rst:25: WARNING: Duplicate explicit target name: "details".

Expected results

No errors

Reproducible project / your project

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>`_

Environment info

  • OS: Mac 10.11.6
  • Python version: 2.7.10
  • Sphinx version: 1.6.3
@tk0miya
Copy link
Member

tk0miya commented Jul 16, 2017

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

@barbara-sfx
Copy link
Contributor Author

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.

@tk0miya
Copy link
Member

tk0miya commented Jul 18, 2017

It would be nice if some lint tool is given :-)

@tk0miya tk0miya closed this as completed Jul 18, 2017
dwayne added a commit to dwayne/herbert-python that referenced this issue Oct 2, 2018
There were duplicate explicit target name errors in the README.

Learn more here, sphinx-doc/sphinx#3921.
thibaudcolas pushed a commit to wagtail/wagtail that referenced this issue Mar 15, 2019
* Fix "Duplicate explicit target name" warnings on extending_draftail.rst

ref: sphinx-doc/sphinx#3921

* Fix 'Unknown target name' warning on third_party_tutorials.rst

* Add docstrings to Page.get_ancestors, get_descendants and get_siblings

Documents the `inclusive` flag and avoids the "Field list ends without a blank line; unexpected unindent" warning when building docs
kchawla-pi added a commit to kchawla-pi/nilearn that referenced this issue Apr 20, 2019
runeflobakk added a commit to digipost/signering-docs that referenced this issue May 15, 2019
sphinx-doc/sphinx#3921 (comment)

Omformulerer også noe for å slippe å si "home page", og "click here".
Bedre med at lenken havner på Adekvat Frase™ i tekst fremfor at teksten
selv "vet" at den er en lenke.
duboism added a commit to labgem/microscope-user-doc that referenced this issue Jun 26, 2019
jalogisch added a commit to Graylog2/documentation that referenced this issue Nov 11, 2019
to avoid errors with named links changed the links to double underscored `__` references

sphinx-doc/sphinx#3921 (comment)
@cgay
Copy link

cgay commented Dec 21, 2019

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

jmcfarland-swri added a commit to ymlasu/para-atm that referenced this issue May 8, 2020
Use anonymous reference for GNATS web link so that it doesn't conflict
with name of internal link.  See
sphinx-doc/sphinx#3921.
jqmp added a commit to square/bionic that referenced this issue Jun 24, 2020
When building the docs, Sphinx will emit a warning if two links have the
same text. This is a weird constraint but apparently it's part of the
ReST spec. This commit fixes this by using double-underscore links.

More explanation: sphinx-doc/sphinx#3921
mwleeds added a commit to flatpak/flatpak-docs that referenced this issue Jul 1, 2020
kip-hart added a commit to kip-hart/MicroStructPy that referenced this issue Oct 4, 2020
shoaibsufi added a commit to softwaresaved/event-organisation-guide that referenced this issue Oct 14, 2020
…r all but one of them on the same page - which is __ rather that _ - you gotta love RST! - sphinx-doc/sphinx#3921
TheAssassin added a commit to AppImage/docs.appimage.org that referenced this issue Nov 25, 2020
Issue in the reST spec, see
sphinx-doc/sphinx#3921 (comment)
for more information.

Fixes/prevents "duplicate explicit target name" errors.
ChristophWurst added a commit to nextcloud/documentation that referenced this issue Nov 26, 2020
Apparently Sphinx doesn't like that we use the same name multiple times,
though the link pointed to different URLs.
sphinx-doc/sphinx#3921 (comment)
suggests using `__` for "anonymous references".

This will remove some of the github action comments that show for every
PR.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
backportbot-nextcloud bot pushed a commit to nextcloud/documentation that referenced this issue Nov 27, 2020
Apparently Sphinx doesn't like that we use the same name multiple times,
though the link pointed to different URLs.
sphinx-doc/sphinx#3921 (comment)
suggests using `__` for "anonymous references".

This will remove some of the github action comments that show for every
PR.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
smartie2076 added a commit to rl-institut/multi-vector-simulator that referenced this issue Dec 9, 2020
use `name <link>`__ instead of `name <link>`_
as per sphinx-doc/sphinx#3921
jqnatividad added a commit to jqnatividad/ckan that referenced this issue Mar 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants