githubmathmarkdownmathjaxgithub-flavored-markdown

How to have math expression in spoiler block in markdown


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 syntax 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

Solution

  • 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