# Escape Inside for HTML

Issue #1388 new
Anonymous created an issue

I would like to be able to put LaTeX math in HTML output, so it is formatted by MathJax. This can be done for LaTeX with minted package using Pygments, with escapeinside feature.

There may be another way to do this, if there is a class of output which Pygments emits raw "as is", then I could get my language lexer to do the job.

This issue should be replaced by another one I think. I have looked at this problem and I think what needs to happen is more fundamental, as follows:

1. First, we need a Math token standard in Pygments.

2. The formatters have to be upgraded so Math tokens are output raw.

For HTML this means wrapping the raw text of the Math token inside $$ and $$ delimiters, and also fixing Pygments to use these and not \$ which is considered deprecated notation.

For LaTex, it would be the same. In both case we're primarily interested in inline math.

Then the various lexers have to be upgraded. This means at least my system felix, but also Ocaml. Ocaml uses 'a, 'b etc which should be typeset as the Greek letters alpha, beta, etc.

For HTML, the user, such as sphinx or whatever, will have to load mathJax. For LaTeX, it can already do math, provided it can see the math delimiters.

For lexers supporting inline math we will also usually want TWO lexers, one which actually formats the maths as maths, and one which formats the language encoding as written. Perhaps this can be handled with an option to a single lexer, I don't know, but typically an author will require both in a document so that they can explain that typing certain ASCII characters in program text is intended when mathematics is seen in the document. Alternatively this could be done by using a "text" lexer.