itex Endpoint

Instiki 0.19 includes an itex2MML web service. The service is used by Instiki 0.19’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.

N.B.: this is located at the root level of your Instiki installation, not at the level of an individual web. I.e.: your list of webs is found at .
The endpoint accepts HTTP POST requests, with two parameters:
tex (mandatory):
the itex equation (sans $‘s).
display (optional):
either inline or block. Defaults to inline if absent, or unrecognized.
A MathML document (MIME-type application/xml).
Error Handling:
Returns a MathML document, containing an <merror> element.
For instance, if the itex2MML Ruby bindings are not installed, returns
<math xmlns='' display='inline'>
       <mtext>Please install the itex2MML Ruby bindings.</mtext>

As an example, the request, to this site,\phi%2B\psi&display=block


<math xmlns='' display='block'><semantics><mrow><mi>&#x03D5;</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.