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 on links with same name #18

Open
diasdm opened this issue Sep 22, 2022 · 1 comment
Open

Duplicate explicit target name on links with same name #18

diasdm opened this issue Sep 22, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@diasdm
Copy link

diasdm commented Sep 22, 2022

Hi,
(Bit of a novice in Sphinx, not completely sure the issue is in sphinx_mdinclude)

Description

I'm adding a README.md with the following contents to my Sphinx documentation:

# Title
Example 1 occurs ...
See example [here](https://github.com/amyreese/sphinx-mdinclude/blob/main/requirements-dev.txt).

Example 2 occurs ...
See example [here](https://github.com/amyreese/sphinx-mdinclude/blob/main/requirements.txt).

When building the docs I get the following:

$ sphinx-build -E -W -c ./docs/source/ -b html ./docs/source/ ./docs/build/
Running Sphinx v5.1.1
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 9 source files that are out of date
updating environment: [new config] 9 added, 0 changed, 0 removed
reading sources... [100%] tests                                                                                                                                                                                    

Warning, treated as error:
README.md:3:Duplicate explicit target name: "here".

Chaging here to be unique no longer shows the issue so I might take that approach.

Details

  • OS: Ubuntu 20.04.5 LTS
  • Python version: Python 3.8.10
  • Project version: Sphinx==5.1.1, sphinx-mdinclude==0.5.2
  • Can you repro on main? Didn't reproduced on main
  • Can you repro in a clean virtualenv? Yes
@amyreese amyreese added the enhancement New feature or request label Sep 25, 2022
@amyreese
Copy link
Member

this might be as simple as keeping track of how many links were seen with that target name, and automatically adding a -X suffix for subsequent links, such as here-2 for your specific example. Would need to make sure it only happens for links where both the target name and URL are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants