From 5b16d442b12cd7bbc200dc5fa93f494d05075c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Milde?= Date: Tue, 21 Oct 2025 16:19:28 +0200 Subject: [PATCH 1/2] Fix encoding name in Git file attributes. Try to avoid files marked as changed due to an error when auto-recoding from UTF-8 to ISO-8859-1 see https://github.com/sphinx-doc/sphinx/pull/13811#issuecomment-3243213202 --- .gitattributes | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index c8acd10815a..0a185ba6752 100644 --- a/.gitattributes +++ b/.gitattributes @@ -51,8 +51,10 @@ tests/roots/test-pycode/cp_1251_coded.py dos # Non UTF-8 encodings tests/roots/test-pycode/cp_1251_coded.py working-tree-encoding=windows-1251 -tests/roots/test-root/wrongenc.inc working-tree-encoding=latin-1 -tests/roots/test-warnings/wrongenc.inc working-tree-encoding=latin-1 +# the real encoding is iso-8859-1 (latin-1), but Git chokes on both names +# cf. https://github.com/sphinx-doc/sphinx/pull/13811#issuecomment-3243213202 +tests/roots/test-root/wrongenc.inc working-tree-encoding=iso-8859 +tests/roots/test-warnings/wrongenc.inc working-tree-encoding=iso-8859 # Generated files # https://github.com/github/linguist/blob/master/docs/overrides.md From 66b7832aaa574ba00cd9d675f1ff85dfea1c20db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Milde?= Date: Mon, 11 Aug 2025 17:16:16 +0200 Subject: [PATCH 2/2] Fix docstring of sphinx.util.parsing.nested_parse_to_nodes(). "section" elements can only be children of "document" or "section" elements, not "sidebar". Cf. https://docutils.sourceforge.io/docs/ref/doctree.html#section --- sphinx/util/parsing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sphinx/util/parsing.py b/sphinx/util/parsing.py index 4c4a6477683..61c2e07fcf2 100644 --- a/sphinx/util/parsing.py +++ b/sphinx/util/parsing.py @@ -39,8 +39,7 @@ def nested_parse_to_nodes( Note that this option bypasses Docutils' usual checks on doctree structure, and misuse of this option can lead to an incoherent doctree. In Docutils, section nodes should - only be children of ``Structural`` nodes, which includes - ``document``, ``section``, and ``sidebar`` nodes. + only be children of ``document`` or ``section`` nodes. :param keep_title_context: If this is False (the default), then *content* is parsed as if it were an independent document, meaning that title decorations (e.g. underlines) @@ -49,6 +48,9 @@ def nested_parse_to_nodes( a completely different context, such as docstrings. If this is True, then title underlines must match those in the surrounding document, otherwise the behaviour is undefined. + Warning: Up to Docutils 0.21, sections with an decoration style + matching a level that is higher than the current section level are + silently discarded! Since Docutils 0.22.1, an error is reported. .. versionadded:: 7.4 """