grav-plugin-mathjax icon indicating copy to clipboard operation
grav-plugin-mathjax copied to clipboard

1.6.0 Regression: Formulas are not rendered within HTML

Open Thunderbolt32 opened this issue 6 years ago • 1 comments

Formulas are not rendered with MathJax if they are enclosed in HTML code.

This (HTML)-code is simply interpreted as HTML code. MathJax does not render the formula.

<p>Test ... $x^2$ ...bla..bla...</p>

This (MarkDown)-code is rendered by MathJax as expected.

Test ... $x^2$ ...bla..bla...

Expected behavior: In both cases formulas are rendered with MathJax.

Regression / Incompatibility with Grav TinyMCE Plug-in (Version 1.5.1 has been compatible with TinyMCE)

Thunderbolt32 avatar Apr 17 '18 14:04 Thunderbolt32

Hey @Thunderbolt32 ,

well this is because previous versions just rendered math expressions even when they were not preprocessed. This has changed in v1.6.0, more specifically here mathjax.js. You can restore the previous behaviour either by setting built_in_js: false and provide your own mathjax.js in the theme and add

    // Array of pairs of strings that are to be used as in-line math delimiters
    inlineMath: [ ['\\(','\\)'], ['$', '$'] ],
    // Array of pairs of strings that are to be used as delimiters for displayed equations.
    displayMath: [ ['\\[','\\]'], ['$$', '$$']  ],

or set

<p markdown="1">Test ... $x^2$ ...bla..bla...</p>

The attribute invokes the parser to check for markdown tags in the content. You can also switch to \( ... \) for inline and \[ ... \] for block code, which still works as expected (even without the html attribute).

Sommerregen avatar Apr 17 '18 16:04 Sommerregen