From 5740c647d647460be68813fec7354586d06ef4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 9 Mar 2015 15:09:32 +0100 Subject: [PATCH] Basic MathJax hackery --- index.html | 11 ++++++++++- js/filters.js | 13 +++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index d1dd0ed..509d4a9 100644 --- a/index.html +++ b/index.html @@ -36,6 +36,15 @@ + + @@ -278,7 +287,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
+ --> diff --git a/js/filters.js b/js/filters.js index 9921d8a..5490335 100644 --- a/js/filters.js +++ b/js/filters.js @@ -150,4 +150,17 @@ weechat.filter('emojify', function() { }; }); +weechat.filter('mathjax', function() { + return function(text, selector) { + if (text.indexOf("$$") != -1 || text.indexOf("\\[") != -1 || text.indexOf("\\(") != -1) { + // contains math + //var math = document.getElementById("MathExample"); + var math = document.querySelector(selector); + MathJax.Hub.Queue(["Typeset",MathJax.Hub,math]); + } + + return text; + }; +}); + })();