# Instiki itex Endpoint

### Instiki

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.

URL:
http://my.wiki.com/itex
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 http://my.wiki.com/web_list .
Request:
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.
Response:
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='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,

http://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>&#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.