Friday, January 11, 2013

Comparing MathML support in HTML5 between Chrome 24, Firefox 18 and Opera 12

Yesterday Google was releasing Google Chrome 24 stable which should have native MathML support. I waited for this release for a long time because Chrome is my standard browser and I know Firefox does a very good job with MathML since Firefox 3.

So I tested Chrome 24 with this MathML browser test site: https://eyeasme.com/Joe/MathML/MathML_browser_test

First I was very excited because the first examples looked promising and right in Chrome. But when looking at more complex MathML Chrome rendered it wrong.

I installed Chromium Dev 26.0.1380.0 and I was hoping the Chromium team already fixed it. But my hope did not lasted long. Chromium 26 was showing me the same results as Chrome 24. This bug is already reported to Chromium's bug tracker (star it if you're interested in a fix).

I recently installed also Opera just to cover the last to me known modern browser which supports MathML natively (winkwink Internet Explorer). Opera had the most issues with rendering and some serious font problems with MathML on my Ubuntu machine.

So I guess we still need to use the very good MathJax JS library for a longer time to display all kind of MathML right in every browser except Firefox.

Result:

  •  Firefox: Very good, near perfect native MathML support.
  •  Chrome: Partial MathML support.
  •  Opera: Partial MathML support but too many rendering issues.
  •  Internet Explorer: No MathML support!

But see the rendered browser results yourself:


UPDATE: Here is a direct link to the picture to see the results in big (2696x1872).

Saturday, December 15, 2012

Installing tidy-html5 on Ubuntu, first step to get valid & structured HTML5

At my work (OERPUB) we are starting to transform any HTML and especially HTML5 content to a structured HTML5 for further processing into various output formats (html5, epub, pdf, xml).

The problem with transforming HTML5 to a more structured HTML5 is the parsing. The way to make this transformation is currently XSLT and we need XML compatible (X)HTML5 for this.

In the past we used HTML tidy which handles all HTML soup and transforms it to valid XHTML. The only problem is that it is dated, the last version is from 2008 and it does not support HTML5 (and we also want MathML support).

After some searching we've found http://w3c.github.com/tidy-html5/ which is a fork of tidy with support of HTML5. After my quick tests it seems compatible with the old tidy and (more important for me) also compatible to pytidylib so that I can still use my old python code but with new HTML5 tidy options. :)

Here are instructions on how to replace the old HTML tidy which is included in Ubuntu (tested on 10.04 & 12.04) with the new HTML5 tidy:

  1. Remove all old tidy implementations
    sudo apt-get remove libtidy-0.99-0 tidy
  2. Get git, libtool and automake if you do not have them already
    sudo apt-get install git-core automake libtool
  3. Clone tidy-html5 repository in a directory of your choice
    git clone https://github.com/w3c/tidy-html5
    cd tidy-html5
    
  4. Building the libtidy shared library and install libtidy and tidy program (copied from here)
    sh build/gnuauto/setup.sh && ./configure && make
    sudo make install
    
  5. So tidy and libtidy are now installed but Ubuntu will not find libtidy by default because libtidy installed to the folder "/usr/local/lib" which is normally not searched for runtime libraries. So we have to edit ldconfig's search folders. Open (with root/sudo rights) the file "/etc/ld.so.conf". Example:
    gksu gedit /etc/ld.so.conf
    
  6. and add this line to the file "/etc/ld.so.conf"
    /usr/local/lib
    
  7. Finally restart ldconfig and you are set!
    sudo ldconfig
    

Just a side note:
To remove HTML5 tidy and install old tidy again just go to its cloned directory and type
sudo make uninstall
sudo apt-get install tidy libtidy-0.99-0