javascript - Can MathJax be made to only convert LaTeX if it's inside a certain tag? - Stack Overflow

I have a text editor in which a user can write HTML code. I don't want them to write LaTeX outside

I have a text editor in which a user can write HTML code. I don't want them to write LaTeX outside of a particular element. It might be something like:

<x-latexmath>...</x-latexmath>

I want it so if they have LaTeX math outside of that tag, it's just displayed as normal text. How might this be possible?

I have a text editor in which a user can write HTML code. I don't want them to write LaTeX outside of a particular element. It might be something like:

<x-latexmath>...</x-latexmath>

I want it so if they have LaTeX math outside of that tag, it's just displayed as normal text. How might this be possible?

Share Improve this question asked Jul 1, 2012 at 22:11 Phlox MidasPhlox Midas 4,3694 gold badges40 silver badges58 bronze badges 1
  • 3 elements: mathjax/docs/2.0/options/hub.html – mu is too short Commented Jul 1, 2012 at 22:25
Add a ment  | 

1 Answer 1

Reset to default 11

MathJax doesn't have a way to use user-defined tags to trigger math processing, but you can use MathJax's tex2jax preprocessor's processClass and ignoreClass parameters to allow you to control which parts of the page to process. See the text2jax configuration for details, but the idea would be to use

<body class="tex2jax_ignore">
...
<span class="tex2jax_process">...</span>
...
</body>

so that the main part of the page isn't processed, and only the span's (or div's if you prefer) containing the mathematics will be processed by MathJax.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745388824a4625564.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信