sphinx-mdinclude icon indicating copy to clipboard operation
sphinx-mdinclude copied to clipboard

example.md breaks Sphinx 8.1.0 (and probably earlier versions too)

Open juliangilbey opened this issue 11 months ago • 1 comments

Description

When building the documentation with Sphinx 8.1.3, the build breaks with a bizarre warning/error message:

$ sphinx-build -W -b html docs docs/_build/html
Running Sphinx v8.1.3
root = PosixPath('/home/jdg/debian/spyder-packages/jupyter-server/build-area/sphinx-mdinclude-0.6.2')
loading translations [en]... done
making output directory... done
loading intersphinx inventory 'python' from /usr/share/doc/python3/html/objects.inv ...
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 4 source files that are out of date
updating environment: [new config] 4 added, 0 changed, 0 removed
reading sources... [ 25%] changelog
reading sources... [ 50%] example
reading sources... [ 75%] included
reading sources... [100%] index

/home/jdg/debian/spyder-packages/jupyter-server/build-area/sphinx-mdinclude-0.6.2/docs/example.md:233: WARNING: Footnote [#] is not referenced. [ref.footnote]
/home/jdg/debian/spyder-packages/jupyter-server/build-area/sphinx-mdinclude-0.6.2/docs/example.md:234: WARNING: Footnote [#] is not referenced. [ref.footnote]
looking for now-outdated files... none found
[...]
build finished with problems, 2 warnings (with warnings treated as errors).

The bizarre nature of the error is that there is no such footnote in the file. Also, if I look at the example.html file generated by an older version of Sphinx (7.4.7), it seems possibly broken (the first two markdown footnotes are not hyperlinked):

<section id="footnote">
<h3>Footnote<a class="headerlink" href="#footnote" title="Link to this heading">
¶</a></h3>
<p>Footnote[#fn-1]_ and footnote[#fn-KEY]_ with markdown.</p>
<p>Footnote with reST<a class="footnote-reference brackets" href="#a" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>.</p>
<!-- footnote definition --><aside class="footnote-list brackets">
<aside class="footnote brackets" id="a" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id3">1</a><span class="fn-bracket">]</span></span>
<p>reST footnote</p>
</aside>
<aside class="footnote brackets" id="fn-1" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></span>
<p>footnote 1</p>
</aside>
<aside class="footnote brackets" id="fn-key" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></span>
<p>footnote key</p>
</aside>
</aside>
</section>
</section>
</section>

The cause certainly seems to be the Markdown style footnotes, but I have no idea why they are so problematic.

juliangilbey avatar Dec 25 '24 20:12 juliangilbey

Ah, found the problem: https://github.com/omnilib/sphinx-mdinclude/blob/c467e81f0c2b89732debc57792738d124263f53f/docs/example.md?plain=1#L174 does not have spaces before the footnote links; it should read Footnote [^1] and footnote [^key] with markdown.

juliangilbey avatar Dec 26 '24 17:12 juliangilbey