Skip to content

Commit

Permalink
Add math gimmick via MathJax
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynalon committed Oct 6, 2013
1 parent 83b0c0a commit 57053a4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = function(grunt) {
'js/gimmicks/googlemaps.js',
'js/gimmicks/highlight.js',
'js/gimmicks/image_linker.js',
'js/gimmicks/math.js',
// 'js/gimmicks/leaflet.js',
'js/gimmicks/themechooser.js',
'js/gimmicks/twitter.js',
Expand Down
18 changes: 18 additions & 0 deletions js/gimmicks/math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function($) {
var mathGimmick = {
name: 'math',
once: function() {
$.md.linkGimmick(this, 'math', load_mathjax);
}
};
$.md.registerGimmick(mathGimmick);

function load_mathjax($links, opt, ref) {
$links.remove();
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
document.getElementsByTagName('head')[0].appendChild(script);
}

}(jQuery));

0 comments on commit 57053a4

Please sign in to comment.