On 2022-03-07, Brecht Machiels wrote:
> From time to time, I receive bug reports for rinohtype that are caused
> by an invalid document tree. Sphinx plugins sometimes fail to respect
> the separation between body and inline elements. For example, Breathe
> adds a literal_block node as a child of a paragraph node [1]. While
> most Sphinx builders happily render invalid document trees, I like to
> be more strict about it.
> Of course, if Sphinx plugin authors do not get any feedback when
> building an invalid document tree, it's easy to make this mistake.
> Therefore, I would like to propose to add some basic document tree
> checks to docutils. What do you think?
This sounds like a sensible idea to me.
Do you have some concrete ideas how to do this?
It should, IMO, not add to much overhead nor prevent the rendering of
"dirty" documents by writers that can handle this.
We currently have only an indirect test: the output of the docutils-xml
writer can be validated against the DTD e.g. with xmllint.
https://docutils.sourceforge.io/docs/dev/testing.html#footnote-3
Günter
> [1] https://github.com/brechtm/rinohtype/issues/312
|