使用Chrome浏览器插件在github中支持Mathjax? [英] Mathjax support in github using a Chrome browser plugin?

查看:430
本文介绍了使用Chrome浏览器插件在github中支持Mathjax?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望Mathjax能够在我的所有github页面上工作(例如,在github上显示Markdown,问题跟踪器)。我有很多从R Markdown生成的文件,它们也有方程式。



尽管我非常喜欢github为Mathjax提供可选的支持,但我认为更现实的目标是是有一些浏览器插件,检测到我在github页面上,并自动运行mathjax脚本。




  • 是否有任何浏览器插件对于在指定的URL上自动运行MathJaX脚本的Chrome浏览器(例如 http * github * )?


    最初的想法



    还有一个关于MathOverflow的长时间讨论。然而,讨论包括对一系列技术的讨论(不仅仅是MathJax),而且许多解决方案都是针对Firefox浏览器的。 解决方案

这是一个GreaseMonkey脚本,它应该可以做你想做的事:在Github上运行MathJax 。它应该可以在所有主流浏览器上运行(尽管有些插件需要运行GreaseMonkey脚本;请参阅 \(... \)用于内嵌数学运算并且 \ [... \] $$ ... $$ 来显示数学。特别是,单数美元不能用作数学分隔符(因为它们在普通的非数学文本中出现得太频繁)。如果您想启用单美元定界符,则需要编辑脚本以在加载MathJax.js之前添加MathJax配置脚本。



设置脚本触发 http://github.com/* https://github.com/* 。并不是所有的GreaseMonkey实现都提供了URL主机部分的模式匹配,但是如果你的确如此,你可以使它更加复杂,以便它也能获得github的子域名。



希望能够满足您的需求。



编辑:脚本现在支持 $ ... $根据提问者的要求,用于在线数学。


I'd like Mathjax to work on all my github pages (e.g., Markdown displayed on github, issue trackers). I have a lot of files generated from R Markdown that also have equations.

While I'd love github to provide optional support for Mathjax, I thought a more realistic aim would be to have some browser plugin that detects that I'm on a github page and automatically runs the mathjax script.

  • Are there any browser plugins for the Chrome browser that automatically run a MathJaX script on specified URLs (e.g., http*github*)?

Initial thoughts

There's quite a long discussion on MathOverflow. However, the discussion includes discussion of a range of technologies (not just MathJax) and many of the solutions are specific to the Firefox browser.

解决方案

Here is a GreaseMonkey script that should do what you want: Run MathJax in Github. It should work in all the major browser (though some need plugins to run GreaseMonkey scripts; see the installation instructions for this question for details).

This script only loads MathJax on pages that contain TeX or MathML markup (it does a very simple test for that, which certainly could be made more sophisticated). Note that the default delimiters are \(...\) for in-line math and \[...\] or $$...$$ for displayed math. In particular, single-dollars aren't enable as math delimiters (since they occur too frequently in ordinary non-math text). If you wanted to enable single-dollar delimiters, you would need to edit the script to add a MathJax configuration script prior to loading MathJax.js itself.

The script is set to trigger on http://github.com/* and https://github.com/*. Not all the GreaseMonkey implementations provide for pattern matching in the host part of the URL, but if yours does, you can make it more sophisticated so that it will get subdomains of github as well.

Hope that does what you need.

Edit: The script now enables $...$ for in-line math, as requested by the asker.

这篇关于使用Chrome浏览器插件在github中支持Mathjax?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆