Instiki 0.19 and later includes an itex2MML web service. The service is used by Instiki’s built-in WYSIWYG SVG-editor, to provide support for equations in SVG graphics. But it may have other uses, so it’s documented here.
The specification for the endpoint is as follows.
http://my.wiki.com/itex
http://my.wiki.com/web_list
.tex
(mandatory):display
(optional):inline
or block
. Defaults to inline
if absent, or unrecognized.application/xml
).<merror>
element.<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'>
<merror>
<mtext>Please install the itex2MML Ruby bindings.</mtext>
</merror>
</math>
As an example, the request, to this site,
https://golem.ph.utexas.edu/wiki/itex?tex=\phi%2B\psi&display=block
returns
<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><semantics><mrow><mi>ϕ</mi><mo>+</mo><mi>ρˆ</mi></mrow><annotation encoding='application/x-tex'>\phi+\psi</annotation></semantics></math>
N.B.: itex’s \begin{svg}...\end{svg}
syntax allows one to insert essentially arbitrary foreign content into the equation. While we ensure that the MathML document that we return is well-formed, we don’t promise that it conforms to any particular profile. You probably want to pass it through a white-list sanitizer, before using it.
Instiki’s itex endpoint is realized as a Rails Metal, so should be very efficient. It uses Nokogiri as its XML parser.