More output formats and better executable finding

This incorporates some changes in another pull request, so it works more portably.

Also, I added support for pandoc's "html5" output format as well as mathjax.