Wednesday, 18 April 2007

MathML in HTML

As mentioned in an earlier post, I'm experimenting with Peter Jipsen's script for using MathML in posts served as text/html. The original script assumed a MathML enabled browser, I've just added some conditional code so that if Gecko or MathPlayer are not detected, some CSS, mainly due to George Chavchanidze, is inserted. It doesn't do all of presentation MathML yet but it renders fractions, msqrt and superscripts enough to make the above post more or less legible in Opera. Things need a bit more tuning yet, I seem to have introduced a noticeable delay before the mathematics is rendered (in all browsers), but progress, I think...

5 comments:

Dr. Dayal D. Purohit said...
This comment has been removed by the author.
D^3P said...

I deleted my earlier comment because I relocated my mathml blog to elsewhere. Its now at http://www.jds.com/mathematics/math107

You can also view my tips to place mathml in blogger blog at this blog http://mathmlblogs.blogspot.com

Also, perhaps, you have not noticed it, and i think so reading your above post that Peter's script includes the stylesheet to render mathml in Firefox too. It is not the native rendering of Firefox. The script includes mechanisms for mathplayer to kick in if the browser is Internet Explorer, otherwise it renders it using its own stylesheet.

David said...

Also, perhaps, you have not noticed it, and i think so reading your above post that Peter's script includes the stylesheet to render mathml in Firefox too. It is not the native rendering of Firefox.

I'm not sure what you mean here, FF has no default rendering of mathml in text/html (as served by a blogger hosted blog) the script used on this site doesn't actually render mathml but it converts the html DOM to an XML DOM if used with FF so that firefoxe's native rendering is triggered.

D^3P said...

I had just discovered a few hours ago that if the MathML code is generated on the fly using the XML DOM interface calls, Firefox would happily render it natively. The same MathML code would not be rendered if it was part of the HTML. As you mention in your comment, Firefox sees the newly generated MathML as XML code and renders it natively.

So I decided to use the two helper functions included in your blog and authored by Peter Jipsen and use it in my blog http://mathmlblogs.blogspot.com and the MathML is rendered is just fine in both IE and firefox and I have posted straight MathML code not ASCII code. So, I am not using ASCCI to MathMl routines.

I looked at the pair of helper functions in Peter's javascript code included in your blog more carefully and found that the stylesheet included in it are for browsers that do not have native rendering excluding IE. Firefox renders it natively as you you say in your comment.

Ben said...
This comment has been removed by a blog administrator.