I don’t know if you will consider it a bug, but I decided to report it nevertheless.
When input reStructuredText has errors and you silence them with report_level=4, the following HTML will be generated:
>>> from docutils.core import publish_parts
>>> parts = publish_parts('`', settings_overrides={'report_level': 4}, writer_name='html5')
>>> print(parts['html_body'])
<main>
<p><a href="#system-message-1"><span class="problematic" id="problematic-1">`</span></a></p>
</main>
The link is pointing to #system-message-1, however there is no element with id="system-message-id" because the warning itself was not generated.
Sorry, I meant “there is no element with
id="system-message-1"” of course.Thank you for the report.
This is a bug. It occurs also with the html4css and latex writers.
OTOH, it is not that urgent, as it only happens in documents where there are problems/errors anyway.
The problem is already in the document tree: with report_level: 4 the FilterMessages transform removes SystemMessages but leaves "problematic" nodes untouched.
Last edit: Günter Milde 2022-01-10
We need to define the intended behaviour for error messages generated during the parsing of inline elements:
a) silently drop the faulty inline element,
b) insert rawsource
c) insert "problematic" node but don't link
d) Insert invalid inline markup as Text.
The attached patch implements alternative d). "Accidential" inline markup characters in the document are kept as text if errors are silenced with
--quiet.Last edit: Günter Milde 2022-01-10
The patch was implemented in [r8997].
With
report_level== 4, inline markup that leads to an error is ignored and the raw source is inserted into the document as Text node.Thank you for the report
Related
Commit: [r8997]
Fixed in release 0.19.
Thank you for the report.