您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Disable LaTeX rendering and keep raw LaTeX code visible
当前为
// ==UserScript== // @name Disable LaTeX Rendering // @namespace http://tampermonkey.net/ // @version 0.2 // @description Disable LaTeX rendering and keep raw LaTeX code visible // @author You // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // Define the function to keep raw LaTeX code function disableLatexRendering() { // Find elements containing LaTeX code, such as those within <script> tags or classes like mathjax, KaTeX, etc. // Remove any rendering libraries like MathJax or KaTeX const scripts = document.querySelectorAll('script[src*="mathjax"], script[src*="katex"]'); scripts.forEach(script => script.remove()); // Find all LaTeX elements and convert them back to raw code (replacing the rendered parts with their raw LaTeX) const latexElements = document.querySelectorAll('span, div, p, img'); latexElements.forEach(element => { if (element.innerHTML && element.innerHTML.match(/(?:\\\[.*\\\]|\\\(.*\\\))/)) { // Replace any rendered LaTeX back to the raw LaTeX text element.innerHTML = element.innerText; } }); } // Run the function when the document is fully loaded window.addEventListener('load', function() { disableLatexRendering(); }); })();