Dear Takeshi, dear Sphinx developers,
thank you for the backport releases adding a pin to a maximum Docutils
version to Sphinx series 1 and 2.
On 21.11.21, Takeshi KOMIYA wrote on github (Issue #9807):
> IMO, docutils-0.18.1 resolves some of the troubles. But some of them
> will not be resolved. That's the reason why the latest Sphinx does not
> still support docutils-0.18.
How can we help here?
What are the remaining problems?
I tried the combination Sphinx 3.4.3 (from Debian/stable) with
Docutils 0.18.1b for the documentation of
https://repo.or.cz/pylit.git and
managed to get an acceptable result:
* There are 0 errors and 1 warning:
WARNING: while setting up extension sphinx.addnodes: node class
'meta' is already registered, its visitors will be overridden
Since 0.18, <meta> is a standard node, so the re-registration by Sphinx
can be skipped ``if docutils_version >= (0, 18)``.
* In the HTML, there are two ``<meta name="viewport" ...>`` nodes.
One from Sphinx::
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
and one added by the Docutils HTML5 writer (since 0.18)::
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
* Footnotes were unstyled, because they use different HTML tags since 0.18.
I could fix this in my custom CSS style sheet.
In conf.py::
html_style = 'pylit-sphinx.css'
And the following lined from docutils/writers/html5_polyglot/minimal.css
copied to pylit-sphinx.css::
/* Footnotes and Citations */
.footnote {
font-size: small;
}
.footnote, .citation { margin: 1em 0; } /* default paragraph skip (Firefox) */
/* hanging indent */
.citation { padding-left: 2em; }
.footnote { padding-left: 1.7em; }
.footnote.superscript { padding-left: 0.9em; }
.citation > .label { margin-left: -2em; }
.footnote > .label { margin-left: -1.7em; }
.footnote.superscript > .label { margin-left: -0.9em; }
.footnote > .label + *,
.citation > .label + * {
display: inline-block;
margin-top: 0;
vertical-align: top;
}
.footnote > .backrefs + *,
.citation > .backrefs + * {
margin-top: 0;
}
.footnote > .label + p, .footnote > .backrefs + p,
.citation > .label + p, .citation > .backrefs + p {
display: inline;
vertical-align: inherit;
}
.backrefs > a { font-style: italic; }
Adding these lines to "spinxdoc.css" may solve this issue in Sphinx 1.4.x.
If the style variant with superscript footnotes shall be supported out of
the box, also::
/* superscript footnotes */
a[role="doc-noteref"].superscript,
.footnote.superscript > .label,
.footnote.superscript > .backrefs {
vertical-align: super;
font-size: smaller;
line-height: 1;
}
a[role="doc-noteref"].superscript > .fn-bracket,
.footnote.superscript > .label > .fn-bracket {
/* hide brackets in display but leave for copy/paste */
display: inline-block;
width: 0;
overflow: hidden;
}
[role="doc-noteref"].superscript + [role="doc-noteref"].superscript {
padding-left: 0.15em; /* separate consecutive footnote references */
/* TODO: unfortunately, "+" also selects with text between the references. */
}
I hope we can get a smoot and stable co-operation of Sphinx and Docutils.
Thanks,
Günter Milde