How to have math expression in spoiler block in markdown

36 views Asked by At

I want to have math expression in a spoiler block, actually a details/summary block in markdown for a github repository. When I try to use the math synthax using $$ in the block, the math expression is not displayed properly.

example code:

<details> 
  <summary>a)</summary>
$$
    \omega = \sqrt{\frac{4 m g h}{M_{1} R^{2}}}
$$
^ this is not displayed nicely
</details>


$$
    \omega = \sqrt{\frac{4 m g h}{M_{1} R^{2}}}
$$
^ this is displayed nicely
1

There are 1 answers

0
Schwern On BEST ANSWER

Add a blank line between the HTML and MathJax markers.

<details> 
  <summary>a)</summary>
  
$$
    \omega = \sqrt{\frac{4 m g h}{M_{1} R^{2}}}
$$
</details>


$$
    \omega = \sqrt{\frac{4 m g h}{M_{1} R^{2}}}
$$

Demonstration