Hi RG Factory,
I’ve not been able to reproduce this issue.
Does this (also) occur when creating a completely new post?
Could you share the post’s code? In the editor, press the three vertical dots in the top right, and select “code editor”.
Hi Thomas,
yes it happens when creating a completely new post.
This is the post’s code :
<!-- wp:paragraph -->
<p>this is a test </p>
<!-- /wp:paragraph -->
<!-- wp:katex/display-block -->
<div class="wp-block-katex-display-block katex-eq rgf-test" data-katex-display="true">\overrightarrow{OB} \begin{cases} x = v_0.\cos(\alpha).t
\\ y = -\dfrac{1}{2}.g.t^2 + v_0.\sin(\alpha).t + h
\end{cases}</div>
<!-- /wp:katex/display-block -->
I unfortunately am still not able to reproduce this issue with the same versions of WordPress, this plugin, and the theme Twenty Eleven. The additional class is added as expected.
However, the code your shared is immediately changed by WordPress to:
<!-- wp:paragraph -->
<p>this is a test </p>
<!-- /wp:paragraph -->
<!-- wp:katex/display-block {"className":"rgf-test"} -->
<div class="wp-block-katex-display-block katex-eq rgf-test" data-katex-display="true">\overrightarrow{OB} \begin{cases} x = v_0.\cos(\alpha).t
\\ y = -\dfrac{1}{2}.g.t^2 + v_0.\sin(\alpha).t + h
\end{cases}</div>
<!-- /wp:katex/display-block -->
Note the addition of {"className":"rgf-test"}. Could you try whether this code does render inside the block editor?
Thomas,
I tried your code with the className, but when I save the post the code is replaced by the one without the classname…
But I figured out what is the problem (kind of…) : the wordpress framework Bedrock
Yeah, I forgot to say this, I use the framework Bedrock.
So here is what I did :
Fresh install without Bedrock, your plugin works like a charm, you are right.
Fresh install with Bedrock, this css custom class bug appears.
I am a new user of Bedrock, so it will be difficult for me to find the origin of the bug…
So for now I’am gonna use the classic WordPress, without Bedrock, it is not a problem at all.
What do I do ? I mark as resolved, or do you wanna try to fix this Bedrock bug ?
Thank you again Thomas.
I was able to reproduce the issue on Bedrock. I am not sure why the issue occurs on Bedrock and not on a “normal” WordPress install.
Regardless, I believe I’ve fixed the issue. The fix is available in the development version: https://wordpress.org/plugins/katex/advanced/
Please test it and let me know whether it works for you.
Hello Thomas,
I tried with the development version (2.0.3) but it does not work on a fresh install of bedrock.
The css custom class bug is still there.
Hi RG Factory,
I made a mistake with the previous development version. Could you download the new development version and try again?
It works !
Thank you very much.
Did you figured out why this error only appeared in Bedrock ?
Thank you for the confirmation!
I have not found out why it broke specifically for Bedrock. Bedrock uses the exact same WordPress 5.4 code as a “normal” install, so it probably has something to do with the WordPress configuration.
I was able to ascertain the issue was caused by a Bedrock installation requiring className to be explicitly mentioned as an attribute on the KaTeX block, whereas in a “normal” install it was not required (and, I believed, that was how it was intended).
I’ve not been able to tell what the specific difference between Bedrock and a normal install is that made this issue crop up, though.