Skip to content

Instantly share code, notes, and snippets.

@pkra
Created July 2, 2015 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkra/04e65905ada213673d7c to your computer and use it in GitHub Desktop.
Save pkra/04e65905ada213673d7c to your computer and use it in GitHub Desktop.
MathJax-node mjpage test
var mjAPI = require("./lib/mj-page.js");
var jsdom = require("jsdom").jsdom;
var document = jsdom("<!DOCTYPE html><html lang='en'><head><title>Test</title></head><body>\\[\sqrt{f: X \to Y }0\\]\\[\sqrt{f: X \to Y }1\\]\\[\sqrt{f: X \to Y }2\\]\\[\sqrt{f: X \to Y }3\\]\\[\sqrt{f: X \to Y }4\\]\\[\sqrt{f: X \to Y }5\\]\\[\sqrt{f: X \to Y }6\\]\\[\sqrt{f: X \to Y }7\\]\\[\sqrt{f: X \to Y }8\\]\\[\sqrt{f: X \to Y }9\\]\\[\sqrt{f: X \to Y }10\\]\\[\sqrt{f: X \to Y }11\\]\\[\sqrt{f: X \to Y }12\\]\\[\sqrt{f: X \to Y }13\\]\\[\sqrt{f: X \to Y }14\\]\\[\sqrt{f: X \to Y }15\\]\\[\sqrt{f: X \to Y }16\\]\\[\sqrt{f: X \to Y }17\\]\\[\sqrt{f: X \to Y }18\\]\\[\sqrt{f: X \to Y }19\\]\\[\sqrt{f: X \to Y }20\\]\\[\sqrt{f: X \to Y }21\\]\\[\sqrt{f: X \to Y }22\\]\\[\sqrt{f: X \to Y }23\\]\\[\sqrt{f: X \to Y }24\\]\\[\sqrt{f: X \to Y }25\\]\\[\sqrt{f: X \to Y }26\\]\\[\sqrt{f: X \to Y }27\\]\\[\sqrt{f: X \to Y }28\\]\\[\sqrt{f: X \to Y }29\\]\\[\sqrt{f: X \to Y }30\\]\\[\sqrt{f: X \to Y }31\\]\\[\sqrt{f: X \to Y }32\\]\\[\sqrt{f: X \to Y }33\\]\\[\sqrt{f: X \to Y }34\\]\\[\sqrt{f: X \to Y }35\\]\\[\sqrt{f: X \to Y }36\\]\\[\sqrt{f: X \to Y }37\\]\\[\sqrt{f: X \to Y }38\\]\\[\sqrt{f: X \to Y }39\\]\\[\sqrt{f: X \to Y }40\\]\\[\sqrt{f: X \to Y }41\\]\\[\sqrt{f: X \to Y }42\\]\\[\sqrt{f: X \to Y }43\\]\\[\sqrt{f: X \to Y }44\\]\\[\sqrt{f: X \to Y }45\\]\\[\sqrt{f: X \to Y }46\\]\\[\sqrt{f: X \to Y }47\\]\\[\sqrt{f: X \to Y }48\\]\\[\sqrt{f: X \to Y }49\\]\\[\sqrt{f: X \to Y }50\\]\\[\sqrt{f: X \to Y }51\\]\\[\sqrt{f: X \to Y }52\\]\\[\sqrt{f: X \to Y }53\\]\\[\sqrt{f: X \to Y }54\\]\\[\sqrt{f: X \to Y }55\\]\\[\sqrt{f: X \to Y }56\\]\\[\sqrt{f: X \to Y }57\\]\\[\sqrt{f: X \to Y }58\\]\\[\sqrt{f: X \to Y }59\\]\\[\sqrt{f: X \to Y }60\\]\\[\sqrt{f: X \to Y }61\\]\\[\sqrt{f: X \to Y }62\\]\\[\sqrt{f: X \to Y }63\\]\\[\sqrt{f: X \to Y }64\\]\\[\sqrt{f: X \to Y }65\\]\\[\sqrt{f: X \to Y }66\\]\\[\sqrt{f: X \to Y }67\\]\\[\sqrt{f: X \to Y }68\\]\\[\sqrt{f: X \to Y }69\\]\\[\sqrt{f: X \to Y }70\\]\\[\sqrt{f: X \to Y }71\\]\\[\sqrt{f: X \to Y }72\\]\\[\sqrt{f: X \to Y }73\\]\\[\sqrt{f: X \to Y }74\\]\\[\sqrt{f: X \to Y }75\\]\\[\sqrt{f: X \to Y }76\\]\\[\sqrt{f: X \to Y }77\\]\\[\sqrt{f: X \to Y }78\\]\\[\sqrt{f: X \to Y }79\\]\\[\sqrt{f: X \to Y }80\\]\\[\sqrt{f: X \to Y }81\\]\\[\sqrt{f: X \to Y }82\\]\\[\sqrt{f: X \to Y }83\\]\\[\sqrt{f: X \to Y }84\\]\\[\sqrt{f: X \to Y }85\\]\\[\sqrt{f: X \to Y }86\\]\\[\sqrt{f: X \to Y }87\\]\\[\sqrt{f: X \to Y }88\\]\\[\sqrt{f: X \to Y }89\\]\\[\sqrt{f: X \to Y }90\\]\\[\sqrt{f: X \to Y }91\\]\\[\sqrt{f: X \to Y }92\\]\\[\sqrt{f: X \to Y }93\\]\\[\sqrt{f: X \to Y }94\\]\\[\sqrt{f: X \to Y }95\\]\\[\sqrt{f: X \to Y }96\\]\\[\sqrt{f: X \to Y }97\\]\\[\sqrt{f: X \to Y }98\\]\\[\sqrt{f: X \to Y }99\\]</body></html>");
mjAPI.start();
var start = Date.now();
mjAPI.typeset({
html: document.body.innerHTML,
renderer: "SVG",
inputs: ["TeX"],
xmlns: "mml"
}, function(result) {
"use strict";
document.body.innerHTML = result.html;
var HTML = "<!DOCTYPE html>\n" + document.documentElement.outerHTML.replace(/^(\n|\s)*/, "");
console.log(HTML);
console.log(Date.now() - start);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment