Forgot password?
 Create new account
View 965|Reply 3

恢复公式代码

[Copy link]

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

hbghlyj Posted at 2024-1-18 20:22:32 |Read mode
Last edited by hbghlyj at 2025-4-6 07:15:35
  1. MathJax.startup.document.removeFromDocument(true)
Copy the Code

Rate

Number of participants 1威望 +2 Collapse Reason
uk702 + 2 很有用!

View Rating Log

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2024-1-18 22:56:23
哦,试了一下,在控制台运行它,整个页面的公式变回代码😀那可以做成一个按钮来切换。

不过代码的换行似乎全没了,还是点右上角那眼比较好阅读😊

Comment

老大大创举!赶快申请专利啊。  Posted at 2024-1-22 09:38

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2025-4-2 23:21:37

v2

如StackExchange使用MathJax v2,
根据google group mathjax-users帖子,
  1. var jax = MathJax.Hub.getAllJax();
  2. for (var i = 0, m = jax.length; i < m; i++) {
  3.   var tex = jax[i].originalText;
  4.   var isDisplay = (jax[i].root.Get("display") === "block");
  5.   if (isDisplay) tex = "$$"+tex+"$$"; else tex = "$"+tex+"$";
  6.   var script = jax[i].SourceElement();
  7.   jax[i].Remove();
  8.   var preview = script.previousSibling;
  9.   if (preview && preview.className === "MathJax_Preview")
  10.     preview.parentNode.removeChild(preview);
  11.   script.parentNode.insertBefore(document.createTextNode(tex),script);
  12.   script.parentNode.removeChild(script);
  13. }
Copy the Code

手机版Mobile version|Leisure Math Forum

2025-4-20 12:11 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list