jgm/pandoc — Issue #428: pandoc escapes characters inside of math expressions when using gladTeX
Author: jtdaugherty
Created: 2012-02-21 04:57:03+00:00
State: open

Greetings,

When using version Pandoc 1.9.1.1, writing an HTML file with `gladTeX` fragments causes the contents of those fragments to be HTML-escaped when they should not be escaped. The use case is that `gladTeX` is run on the output of Pandoc in a separate processing pass, so the output of Pandoc in this case is not intended to be proper HTML, since `gladTeX` is going to replace the equations with proper `IMG` tags.

Here's an example session with 1.8.2.1, in which the feature works as expected:

~~~
% pandoc --version
pandoc 1.8.2.1
Compiled with citeproc support.
Copyright (C) 2006-2011 John MacFarlane
Web: http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
% cat test.md
$bad < good$
$good > bad$
% pandoc --gladtex < test.md

bad < good good > bad

~~~

Now with 1.9.1.1:

~~~
% dist/build/pandoc/pandoc --version
pandoc 1.9.1.1
Compiled with [snipped lots of output]
Copyright (C) 2006-2012 John MacFarlane
Web: http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
% dist/build/pandoc/pandoc --gladtex < ~/test.md

bad < good good > bad

~~~

It looks like the solution is just to wrap the `gladTeX` contents, as well as the `EQ` tags, with `preEscapedString`.