Skip to content Skip to sidebar Skip to footer

Get Rid Of "duplicate Label" Warning In Sphinx

In Sphinx I get a ton of warnings like: /PATH/FILENAME:LINE: WARNING: duplicate label LABELNAME, other instance in /PATH/FILENAME It seems to see all section titles as 'label's an

Solution 1:

The issue was us still using a deprecated conf.py option for recommonmark. We were still using the option for Sphinx-1.3 and earlier as per recommonmark.readthedocs.io/en/latest/ Changing

from recommonmark.parser importCommonMarkParsersource_parsers= {
    '.md': CommonMarkParser,
}

source_suffix = ['.rst', '.md']

to

extensions = ['recommonmark']

fixed the issue.

Big thanks to @StevePiercy for making me aware of our deprecated config.

Solution 2:

It looks like the sphinx parser parses every .rst file in the folder to create a HTML. When some of these .rst files are included in the main.rst it looks like we are getting this duplicate label messages. To help the parser from not parsing these includes you can try changing the extension from .rst to something else like .rest and then these messages are gone. Make sure that the include now includes the files with the new file extension like .rest as called out before

Post a Comment for "Get Rid Of "duplicate Label" Warning In Sphinx"