您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Keep LaTeX content as raw text without rendering it into formulas
当前为
// ==UserScript== // @name Keep Raw LaTeX Visible (No Rendering) // @namespace http://tampermonkey.net/ // @version 0.5 // @description Keep LaTeX content as raw text without rendering it into formulas // @author You // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // Function to make sure LaTeX code is kept as raw text function keepRawLatex() { // Target all LaTeX elements (common ones like <span>, <div>, <p> containing LaTeX expressions) const latexElements = document.querySelectorAll('span, div, p'); latexElements.forEach(element => { // Check for LaTeX expressions using regex if (element.innerHTML && (element.innerHTML.match(/\\\[(.*?)\\\]/) || element.innerHTML.match(/\\\((.*?)\\\)/))) { // Replace rendered LaTeX content with raw LaTeX code, keeping it as plain text const rawLatex = element.innerHTML.replace(/\\\[(.*?)\\\]/g, '\\[ $1 \\]').replace(/\\\((.*?)\\\)/g, '\\( $1 \\)'); element.innerHTML = rawLatex; } }); } // Run the function when the document is fully loaded window.addEventListener('load', function() { keepRawLatex(); }); // If the page updates dynamically, re-check LaTeX every second setInterval(keepRawLatex, 1000); })();