I'm don't know the answer to your question, but you can use the SUP and SUB html tags for superscript and subscript. i.e.
X[sup]y[/sup] gives: X<sup>y</sup>
when you replace the [] with <>
and
X[sub]n[/sub] gives: X<sub>n</sub>
you can even nest the tags if necessary:
X<sub>n</sub><sup>y<sub>i</sub><sup>2</sup></sup>
__________________
|