Switch to callback-style in document-to-html for performance reasons