Closed onionyst closed 3 years ago
Hi @onionyst,
I wouldn't consider this to be a bug in BookStack, as reported, since this is related to a MathJax rendering/library which is not built in or officially supported.
This is occurring since the underscores in your MathJax content are assumed to be markdown italic syntax, so the actually resulting HTML is actually:
<p>$$
{v}<em>{a</em>{i,j}}
$$</p>
This therefore breaks the MathJax library parsing. You can get around this by wrapping the MathJax content in HTML tags to get the content to be parsed as HTML instead of MathJax. For example, pasting the below in the Markdown editor should get the result you desire:
<p>$$
{v}_{a_{i,j}}
$$<p>
Note, You may come across other oddities but having MathJax run globally across all page content like it looks to do by default.
Thanks, @ssddanbrown.
I understand that it is caused by the rendering sequence. Would it be possible to have pre-markdown-rendering hooks to have custom modifications?
Another question would be, is there any method to have custom header (e.g. MathJax) available also on the Markdown preview pane on the right?
I understand that it is caused by the rendering sequence. Would it be possible to have pre-markdown-rendering hooks to have custom modifications?
We do provide editor hooks (BookStack Editor Events) although they might be rudundant soon as we change editor and I don't think this would help here. Markdown is rendered to HTML server-side so you won't be able to get in-front of the markdown parsing for page views. You could maybe tweak the back-end render using the logical theme system.
We current don't inject custom header scripts into the preview pane, as to avoid any issues, we only inject styles. You could use the linked editor hooks above to inject scripts in yourself if desired.
Describe the Bug
When using Markdown with MathJax, the following pattern cannot display normally:
Steps to Reproduce
Expected Behaviour
Should render the equation.
A minimal demo works properly (you can check it here or locally):
So I suppose BookStack has something with this pattern (maybe a higher priority on italics) and conflicts with MathJax.
Screenshots or Additional Context
No response
Exact BookStack Version
v21.10.3
PHP Version
No response
Hosting Environment
Latest Docker image provided by linuxserver.