For LaTeX, I used to rely on htlatex, latex2html, or more rarely tth. I know that we can use XML with ConTeXt, although I have no experience with this, and that Pandoc let us use Markdown syntax and provides several output formats (including ConTeXt and (X)HTML), as well as templates facilities.
However, does there exist a 'tex->html' converter for ConTeXt working out of the box, i.e. one that would accept a raw ConTeXt file (that can produce a PDF file) and transform it to HTML (single or multi-page)?
Best Answer
ConTeXt does not directly output XHTML, it outputs XML. However the current browsers (at least Opera, Firefox and Chromium) are able to display XML correctly. The XML can be styled using CSS.
When you want real XHTML, you have to transform the XML to XHTML using external tools. ConTeXt standalone ships with an example file:
texmf-context/tex/context/base/export-example.{tex,css}
. Here is a modified and shortened version of this file for demonstration.And here comes the corresponding CSS file, that is responsible for the styling in the browser.
Here is a screenshot from the PDF version:
And this is a screenshot from the browser:
As you can see, the style is pretty close. It can be further optimized through tweaking the CSS file. Included graphics, of course, have to be present in a format that the browser can handle.
Hyphenation is also present. ConTeXt inserts soft hyphen (
0x00AD
) characters where hyphenation is possible, which enables the browser to justify the paragraphs.The resulting XML can be displayed by browsers and e-book readers. However, not all e-book reader are compatible, especially when it comes to math. Browsers also have their problems with displaying math.