sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.43k stars 2.1k forks source link

Incorrect line number being shown #10308

Open tomkivlin opened 2 years ago

tomkivlin commented 2 years ago

Describe the bug

I am using sphinx-build to build some markdown pages.
I noticed some errors in the build yesterday that were referring to lines that don't exist in the file affected.

e.g. I received this error message:

/opt/azdo-agent/_work/1/s/solution_components/platform-tci.md:6172: WARNING: Non-consecutive header level increase; 2 to 4 [myst.header]

So this suggests the error is on line 6172 of the platform-tci.md file. However, that file only has 5475 lines.

When checking, all the other warnings that were found in that build (and others) refer to seemingly random line numbers?

How to Reproduce

Hard to share steps as I can't share the document in use (sensitive info), but essentially:

make html

where the Makefile is:

SPHINXOPTS    = -W -n --keep-going
SPHINXBUILD   = sphinx-build
SOURCEDIR     = .
BUILDDIR      = .
# Put it first so that "make" without argument is like "make help".
help:
    @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
    @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Expected behavior

I expect the number that is shown after the file name to refer to the line number that the error refers to.

Your project

n/a

Screenshots

No response

OS

Ubuntu 20.04

Python version

3.8

Sphinx version

4.3.1

Sphinx extensions

myst_parser, sphinxcontrib.mermaid, sphinxcontrib.inkscapeconverter, sphinx.ext.githubpages, sphinx.ext.autosectionlabel, sphinx_markdown_tables, sphinx_panels

Extra tools

No response

Additional context

Additional warnings that also have wrong line numbers:


2022-03-29T08:30:30.1265834Z /opt/azdo-agent/_work/1/s/solution_components/platform-tci.md:876: WARNING: image file not readable: solution_components/figures/platform-tci-vnf-physicalnetworkdesign.png
2022-03-29T08:30:30.1269589Z /opt/azdo-agent/_work/1/s/solution_components/platform-tci.md:7368: WARNING: duplicate label solution_components/platform-tci:14. platform lifecycle, other instance in /opt/azdo-agent/_work/1/s/solution_components/platform-tci.md
tk0miya commented 2 years ago

Is this happened with markdown document? If so, please report this to the myst_parser project first.

tomkivlin commented 2 years ago

Is this happened with markdown document? If so, please report this to the myst_parser project first.

Thanks, will do so.