Open asmeurer opened 4 years ago
This happens at the parser level. I think the node level that we are currently working at is too late in the process. Even if we could reconstruct it from the node, the warning will already be omitted. So I think we need to modify the extension to work at the parser level. The node level may also be necessary to prevent math from being used inside of code blocks.
I guess we can make a parser subclass and register it. https://www.sphinx-doc.org/en/master/extdev/parserapi.html
I don't know how easy this will be to fix. For now, if you get a warning like this from using dollar math, you should just use the :math: role as a workaround.
$|y| \geq |x^e|$
Have you tried it like this $\ |y| \geq |x^e|\ $
?
That doesn't work. The problem is that Sphinx parses out the |y|
and |x^e|
as substitutions before the sphinx-math-dollar extension parsers the dollar signs as math. The substitution parsing happens very early in the RST parser, even earlier than the creation of the AST.
I think that it is possible to make a workaround like ${ | y | \geq | x^e | }$
where
|
{}
The math
$|y| \geq |x^e|$
produces an errorChanging the transformer priority to lower than that of substitutions doesn't seem to fix it. http://docutils.sourceforge.net/docs/ref/transforms.html