DSpace / dspace-angular

DSpace User Interface built on Angular.io
https://wiki.lyrasis.org/display/DSDOC8x/
BSD 3-Clause "New" or "Revised" License
122 stars 394 forks source link

Rendering markdown before mathjax can lead to wrong outcome #3111

Open AndreaBarbasso opened 3 weeks ago

AndreaBarbasso commented 3 weeks ago

Describe the bug Since we are now rendering markdown templates before LaTeX formulas, any math formula that includes characters usually found on markdown templating could lead to a wrong output.

To Reproduce Try to use any string that contains LaTeX formulas including markdown syntax in any place where the markdown is rendered. For example, the following text is not rendered correctly because of underscores inside it: ...measurements in (EDT-TTF-CONH$_2$)$_2^{+}$[BABCO$^{-}$] (EDT-BCO) confirmed the absence...

Expected behavior Both formulas and markdown should be rendered correctly. Since LaTeX line delimiters are "rarer" than markdown delimiters, it's best to render LaTeX with mathjax first, and markdown right after that.

Related work PR: https://github.com/DSpace/dspace-angular/pull/3112

mwoodiupui commented 3 weeks ago

The MathJax documentation has some suggestions on combining markup languages.