A Node.js HTTP API to render MathJax equations in HTML content.
This service uses the MathJax-node implementation that is optimised for mathjax embedded in HTML content. It is currently limited to Tex to SVG conversion.
To run the API locally you must have the following:
-
nvm installed:
brew install nvm
Then add the following to your
~/.bashrc
or~/.zshrc
:export NVM_DIR="$HOME/.nvm" [ -s "$(brew --prefix nvm)/nvm.sh" ] && \. "$(brew --prefix nvm)/nvm.sh" [ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix nvm)/etc/bash_completion.d/nvm"
and reload your shell:
exec $SHELL -l
-
The node version specified in
.nvmrc
installed through nvm:nvm install
Once you have node installed, run the following to install the dependencies and run the server:
make debug
The API binds to port 8080, and is currently not configurable.
To test the API is running correctly:
-
Test the server is working by doing a HTTP GET or navigate to http://localhost:8080:
curl http://localhost:8080
-
Test
POST
ing content to the service for conversion:curl -X POST -H "Content-Type: text/plain" --data "input=$ Gamma(z) = int_0^infty t^{z-1} $" http://localhost:8080
Copyright © Crown Copyright (Office for National Statistics)
Released under MIT license, see LICENCE for details.